[英]Calling a soap service through spring integration along with http headers
I am working on spring integration for calling a soap service. 我正在从事春季整合工作,以寻求肥皂服务。 I am able to call a soap service using outbound gateway successfully.
我可以使用出站网关成功调用Soap服务。 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 .
现在我需要用相同的请求调用相同的soap服务,现在我需要在http标头中添加一些参数。有人可以帮助我完成此任务吗? Thank you very much in advance.
提前非常感谢您。
You can achieve with request-callback
injection to the <int-ws:outbound-gateway>
: 您可以通过向
<int-ws:outbound-gateway>
进行request-callback
注入来实现:
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
. 或者...如果您需要对每个
requestMessage
进行requestMessage
,则应该使用自定义SoapHeaderMapper
克服它。 Where you can extract CommonsHttpConnection
from the TransportContextHolder.getTransportContext().getConnection()
在哪里可以从
TransportContextHolder.getTransportContext().getConnection()
提取CommonsHttpConnection
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.