I'm trying to create a simple SOAP web service proxy in Spring integration. For this to work i need to pass to SOAPAction through from the client calling my service to the service im proxying. Unfortunately it seems that this value is lost in the conversion to a Spring Integration Message object. The Message object has a payload and a header. I was expecting to find the SOAPAction in the header (as "ws_soapAction") but it's not there. The only headers are replyChannel, errorChannel, id and timestamp. These are standard Spring Integration headers. I can set the ws_soapAction by hardcoding it but that makes the service much less dynamic. I have tried both SOAP 1.1 and SOAP 1.2.
Here is the application:
@SpringBootApplication
public class OmgApplication {
public static void main(String[] args) {
SpringApplication.run(OmgApplication.class, args);
}
@Autowired
MarshallingWebServiceInboundGateway entryPoint;
@Autowired
MarshallingWebServiceOutboundGateway omgGateway;
@Bean
IntegrationFlow flow() {
return IntegrationFlows.from(entryPoint)
.handle(omgGateway)
.get();
}
}
And the gateways:
@Bean
MarshallingWebServiceInboundGateway entryPoint() {
MarshallingWebServiceInboundGateway entryPoint = new MarshallingWebServiceInboundGateway(jaxb2Marshaller());
entryPoint.setHeaderMapper(new DefaultSoapHeaderMapper());
return entryPoint;
}
@Bean
MarshallingWebServiceOutboundGateway omgGateway() {
MarshallingWebServiceOutboundGateway omgGateway = new MarshallingWebServiceOutboundGateway(
"https://url.to.the/service", jaxb2Marshaller(), jaxb2Marshaller()
);
omgGateway.setHeaderMapper(new DefaultSoapHeaderMapper());
return omgGateway;
}