![](/img/trans.png)
[英]How to add timeout while calling SOAP Service from spring integration
[英]Calling a soap service through spring integration along with http headers
我正在从事春季整合工作,以寻求肥皂服务。 我可以使用出站网关成功调用Soap服务。 现在我需要用相同的请求调用相同的soap服务,现在我需要在http标头中添加一些参数。有人可以帮助我完成此任务吗? 提前非常感谢您。
您可以通过向<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" );
}
}
或者...如果您需要对每个requestMessage
进行requestMessage
,则应该使用自定义SoapHeaderMapper
克服它。 在哪里可以从TransportContextHolder.getTransportContext().getConnection()
提取CommonsHttpConnection
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.