{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
java,architects,enterprise-integration,scala,architecture,maven,soap,modules,integration,tips and tricks,sbt

Managing Raw SOAP message within Spring Integration

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"
<int:header name="Content-Type" value="text/xml;charset=UTF-8" />
<int:header name="SoapAction"
value="http://www.webserviceX.NET/ConversionRate" />

<int:channel id="ws.outbound" />

<int-http:outbound-gateway id="webservice.outbound.gateway"
request-channel="ws.inbound" reply-channel="ws.outbound"
expected-response-type="java.lang.String" />

The Spring Integration flow is as below,

Managing Raw SOAP message within Spring Integration

Managing Raw SOAP message within Spring Integration

I hope this blog helped you.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks