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,
Managing Raw SOAP message within Spring Integration
I hope this blog helped you.