web services - Spring Integration WS: mock Endpoint to return response -
i have setup spring integration flow configuration send messages external web service , unmarshalling response , doing post processing based on response object type.
i have following outbound-gateway
configuration:
<int:channel id="sendrequestchannel"/> <ws:outbound-gateway request-channel="sendrequestchannel" uri="${send.ws.uri}" reply-channel="responsetransformer" > <ws:request-handler-advice-chain> <ref bean="retryadviceuserupdatews" /> </ws:request-handler-advice-chain> </ws:outbound-gateway>
now, want test flow , check correct post processing triggered based on response object.
is there anyway in integration test mock endpoint response based on message i'm sending?
actually should understand part of flow better mock , return desired response.
you can inject
channelinterceptor
sendrequestchannel
presend
returnsnull
, prevent further process ,send
message desired responseresponsetransformer
.another powerful option add 1 more
advice
<ws:request-handler-advice-chain>
, implement extension ofabstractrequesthandleradvice
.and last option see via java code
mock
webservicetemplate.sendandreceive
, inject<ws:outbound-gateway>
.from other side know soapui has tool
mock
target service, so, don't need in java, unless tests.
so, choose proper way test flow.
Comments
Post a Comment