Managing Raw SOAP message within Spring Integration
Join the DZone community and get the full member experience.Join For Free
in spring integration if we use int-ws:outbound-gateway, once a message is associated to the request channel, the spring integration container add the soap header information and sends the soap payload to the target system to be processed. most of the time, this is what is needed, but sometimes, we just need the integration layer to act as a proxy. the soap payload coming from the source system is just handed to the target system retaining all the properties of source system like security, enrichment and others.
in this case the trick is instead of using int-ws:outbound-gateway, we should use int-http:inbound-gateway and int-http:outbound-gateway. this way you can fool the target system to accept this as a soap message. we can also make it aware what soapaction we need to execute is a below,
<int-http:inbound-gateway id="webservice.inbound.gateway" request-channel="http.outbound.enrich.in" reply-channel="ws.outbound" name="/receivegateway" supported-methods="post" /> <int:header-enricher input-channel="http.outbound.enrich.in" output-channel="ws.inbound"> <int:header name="content-type" value="text/xml;charset=utf-8" /> <int:header name="soapaction" value="http://www.webservicex.net/conversionrate" /> </int:header-enricher> <int:channel id="ws.outbound" /> <int-http:outbound-gateway id="webservice.outbound.gateway" request-channel="ws.inbound" reply-channel="ws.outbound" url="http://www.webservicex.net/currencyconvertor.asmx" expected-response-type="java.lang.string" />
the spring integration flow is as below,
i hope this blog helped you.
Published at DZone with permission of Krishna Prasad, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.