Spring Integration WS Response Soap Headers

2019-07-18 08:17发布

问题:

I have the below use case.

  1. Request is received by the ws-inbound gateway of service1.
  2. Service1 Passes the request to another ws-outbound gateway service2
  3. Service2 ws inbound gateway has an interceptor configured, which adds a custom soap header to the response
  4. the response from service 2 is passed to the output channel of service 1 (Final response).

I am able to see that soap header is added by printing the soap envelope in interceptor (service2), but it is not present in the final response. Any pointers to solve this issue will be helpful

回答1:

The <int-ws:outbound-gateway> uses DefaultSoapHeaderMapper by default. And its logic to populate source.getSoapAction(); and source.getSoapHeader();. But for that purpose you should configure mapped-reply-headers for your desired headers on the <int-ws:outbound-gateway>.