I am working on spring integration for calling a soap service. I am able to call a soap service using outbound gateway successfully. Now I need to call the same soap service, with same request and now I need add some parameters in http headers.Can anybody help me out in achieving this task . Thank you very much in advance.
You can achieve with request-callback
injection to the <int-ws:outbound-gateway>
:
public class AddHeaderWebServiceMessageCallback implements WebServiceMessageCallback {
public void doWithMessage(WebServiceMessage message) {
CommonsHttpConnection connection = (CommonsHttpConnection) context.getConnection();
PostMethod postMethod = connection.getPostMethod();
postMethod.addRequestHeader( "foo", "bar" );
}
}
Or... If you need to do that dinamically for each requestMessage
you should overcome that with the custom SoapHeaderMapper
. Where you can extract CommonsHttpConnection
from the TransportContextHolder.getTransportContext().getConnection()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.