clients/src/main/java/com/sidis/eas/client/webserver/Controller.java
/**
     * create a new service with given data
     * @param request is the original http request to calculate links in response
     * @param data string contains json data for the service
     * @param serviceName is the name of the service
     * @param price is a possible positiv price for the service
     */
create a new service with given data
@param request is the original http request to calculate links in response
@param data string contains json data for the service
@param serviceName is the name of the service
@param price is a possible positiv price for the service
create a new service with given data @param request is the original http request to calculate links in response @param data string contains json data for the service @param serviceName is the name of the service @param price is a possible positiv price for the service
@RequestMapping(
            value = BASE_PATH + "/services",
            method = RequestMethod.POST,
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public ResponseEntity<StateAndLinks<ServiceState>> createService(
            HttpServletRequest request,
            @RequestParam(name = "service-name") String serviceName,
            @RequestParam(name = "data", required = false) String data,
            @RequestParam(name = "price", required = false) Integer price) {
        try {
            if (data == null || data.isEmpty() || JsonHelper.convertStringToJson(data) == null) {
                data = "{}";
            }
        } catch (IllegalStateException ex) {
            logger.error(ex.getMessage());
            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
        }
        try {
            final SignedTransaction signedTx = proxy
                    .startTrackedFlowDynamic(ServiceFlow.Create.class,
                            serviceName,
                            data,
                            price)
                    .getReturnValue()
                    .get();
            StateVerifier verifier = StateVerifier.fromTransaction(signedTx, null);
            ServiceState service = verifier.output().one(ServiceState.class).object();
            return this.createUpdateActionResponse(request, service, HttpStatus.CREATED);
        } catch (Throwable ex) {
            logger.error(ex.getMessage(), ex);
            return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED)
                    .body(new StateAndLinks<ServiceState>().error(ex));
        }
    }
@ RequestMapping ( value = BASE_PATH + "/services" , method = RequestMethod . POST , consumes = MediaType . APPLICATION_FORM_URLENCODED_VALUE , produces = MediaType . APPLICATION_JSON_VALUE ) @ ResponseBody public ResponseEntity < StateAndLinks < ServiceState > > createService ( HttpServletRequest request , @ RequestParam ( name = "service-name" ) String serviceName , @ RequestParam ( name = "data" , required = false ) String data , @ RequestParam ( name = "price" , required = false ) Integer price ) { try { if ( data == null || data . isEmpty ( ) || JsonHelper . convertStringToJson ( data ) == null ) { data = "{}" ; } } catch ( IllegalStateException ex ) { logger . error ( ex . getMessage ( ) ) ; return ResponseEntity . status ( HttpStatus . BAD_REQUEST ) . body ( null ) ; } try { final SignedTransaction signedTx = proxy . startTrackedFlowDynamic ( ServiceFlow . Create . class , serviceName , data , price ) . getReturnValue ( ) . get ( ) ; StateVerifier verifier = StateVerifier . fromTransaction ( signedTx , null ) ; ServiceState service = verifier . output ( ) . one ( ServiceState . class ) . object ( ) ; return this . createUpdateActionResponse ( request , service , HttpStatus . CREATED ) ; } catch ( Throwable ex ) { logger . error ( ex . getMessage ( ) , ex ) ; return ResponseEntity . status ( HttpStatus . EXPECTATION_FAILED ) . body ( new StateAndLinks < ServiceState > ( ) . error ( ex ) ) ; } }
create a new service with given data
 @param request is the original http request to calculate links in response
 @param data string contains json data for the service
 @param serviceName is the name of the service
 @param price is a possible positiv price for the service
create a new service with given data @param request is the original http request to calculate links in response @param data string contains json data for the service @param serviceName is the name of the service @param price is a possible positiv price for the service