0

I use SimpleWebServiceInboundGateway for handling SOAP requests.

Here is a piece of my code:

@Router(defaultOutputChannel = "unsupportedOperation", inputChannel = "wsRequestChannel")
public String route(Message message) {
    String soapAction = (String)message.getHeaders().get(WS_SOAP_ACTION);
    ...
}

@Bean
public SimpleWebServiceInboundGateway wsInboundGateway(){
    SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway();
    simpleWebServiceInboundGateway.setRequestChannelName("wsRequestChannel");
    simpleWebServiceInboundGateway.setReplyChannelName("wsResponseChannel");
    simpleWebServiceInboundGateway.setErrorChannelName("wsErrorChannel");
    return simpleWebServiceInboundGateway;
}

The incoming soap envelope contains a soap header:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   <soapenv:Header>
      <myAuth>
         <username>user</username>
         <password>pass</password>
      </myAuth>
   </soapenv:Header>
   <soapenv:Body>
   ...

The Message object in my router does not contains the header data. How can I extract the username and the password?

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
user1552545
  • 1,233
  • 3
  • 15
  • 33

1 Answers1

0

To map SOAP headers, you need to add a customized DefaultSoapHeaderMapper to the gateway; you customize the mapper by telling it which headers you want it to map...

mapper.setRequestHeaderNames("STANDARD_REQUEST_HEADERS", "myHeader");

The header to map must match the qualified QName of the header. STANDARD_REQUEST_HEADERS (the default) maps the SoapAction.

There is similar mapping for reply headers.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179