citrus-simulator icon indicating copy to clipboard operation
citrus-simulator copied to clipboard

Allow transport combination of HTTP and WS in one simulator instance

Open coding-yogi opened this issue 6 years ago • 4 comments

application.properties file have below settings

citrus.simulator.ws.enabled=true
citrus.simulator.rest.enabled=true
citrus.simulator.defaultScenario=DEFAULT

Simulator log shows below details on startup

Using the simulator configuration: SimulatorRestConfigurationProperties{enabled='true', urlMapping='/services/rest/**'}
Using the simulator configuration: SimulatorConfigurationProperties{enabled='true', templatePath='com/consol/citrus/simulator/templates', defaultScenario='DEFAULT', defaultTimeout=60000, exceptionDelay=5000, templateValidation=true, inboundXmlDictionary=inbound-xml-dictionary.xml, outboundXmlDictionary=outbound-xml-dictionary.xml, inboundJsonDictionary=inbound-json-dictionary.properties, outboundJsonDictionary=outbound-json-dictionary.properties}
Using the simulator configuration: SimulatorWebServiceConfigurationProperties{enabled='true', servletMapping='/services/ws/*'}

Currently there is only one Default Scenario configured. I expect default scenario to catch both the rest and soap scenarios, but when I make a call on http://localhost:8080/services/rest/, it never reaches DefaultScenario.

  • Any call apart from POST call throws 405 - Method Not Allowed
  • Any post call is still handled by some SOAP handler and I get the below response
{
    "timestamp": "2019-01-17T06:25:08.595+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "Could not create message from InputStream: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/plain. Is this an error message instead of a SOAP response?",
    "path": "/services/rest/ikykikikikikiukk"
}

coding-yogi avatar Jan 17 '19 06:01 coding-yogi

just observed that even with disabling 'ws', REST calls doesn't work

coding-yogi avatar Jan 17 '19 06:01 coding-yogi

My REST call also seems to be handled by WebServiceMessageReceiverHandlerAdapter rather than by HttpRequestHandlerAdapter

coding-yogi avatar Jan 18 '19 01:01 coding-yogi

OK it seems I may not be able to use both WS and HTTP simulators together. What I observed is if com.consol.citrus:citrus-http dependency is removed only then HttpRequestHandlerAdapter is initialized, else WebServiceMessageReceiverHandlerAdapter is initialized which doesn't handle the http requests

coding-yogi avatar Jan 18 '19 02:01 coding-yogi

Hi!

It's currently not possible to use WS and HTTP in one simulator instance. The combination of different message transports is experimental currently. I'd recommend to separate the message transports into different simulator instances.

BR, Sven

svettwer avatar Jan 25 '19 14:01 svettwer