protected JSONObject invokeServiceProcess ( String name , Object request , String requestId , Map < String , Object > parameters , Map < String , String > headers ) throws ServiceException { JSONObject responseJson ; Map < String , String > responseHeaders = new HashMap <> ( ) ; Object responseObject = ServiceLocator . getWorkflowServices ( ) . invokeServiceProcess ( name , request , requestId , parameters , headers , responseHeaders ) ; if ( responseObject instanceof JSONObject ) responseJson = ( JSONObject ) responseObject ; else if ( responseObject instanceof Jsonable ) responseJson = ( ( Jsonable ) responseObject ) . getJson ( ) ; else throw new ServiceException ( HTTP_500_INTERNAL_ERROR , "Unsupported response type: " + ( responseObject == null ? null : responseObject . getClass ( ) ) ) ; for ( String key : responseHeaders . keySet ( ) ) headers . put ( key , responseHeaders . get ( key ) ) ; return responseJson ; }
Helper method for invoking a service process . Populates response headers from variable value .