3
votes

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;
}
1

1 Answers

1
votes

This will be available in 4.2. See this JIRA.

The 4.2 release candidate is due this week, with the actual release in early september.

It's currently available in 4.2.0.BUILD-SNAPSHOT.

But the JIRA also has a work-around for earlier versions.