簡體   English   中英

通過Spring集成以及HTTP標頭調用Soap服務

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM