简体   繁体   English

如何在 Spring-Integration 中将 SOAPAction 标头添加到 HTTP 消息?

[英]How can I add SOAPAction header to a HTTP message in Spring-Integration?

I have the following HTTP outbound gateway.我有以下 HTTP 出站网关。

<int-http:outbound-gateway id="myWs"
    request-channel="requests"
    url="http://localhost/test"
    http-method="POST"
    charset="UTF-8"
    reply-timeout="1234"/>

I want to add the SAOPAction to the HTTP header.我想将 SAOPAction 添加到 HTTP 标头。 How can I do that?我怎样才能做到这一点? Using the an Outbound Web Service Gateway is not an option for me, because my SOAP Envelope is not a standard SOAP envelope.使用出站 Web 服务网关不是我的选择,因为我的 SOAP 信封不是标准的 SOAP 信封。

Use a header enricher and a custom header-mapper ...使用标题丰富器和自定义header-mapper ...

<int:chain input-channel="requestChannel">
    <int:header-enricher>
        <int:header name="SOAPAction" value="http:/foo/bar" />
    </int:header-enricher>
    <int-http:outbound-gateway
                            header-mapper="mapper"
                            url="http://localhost:18080/http/receiveGateway"
                            http-method="POST"
                            expected-response-type="java.lang.String"/>
</int:chain>

<bean id="mapper" class="org.springframework.integration.http.support.DefaultHttpHeaderMapper">
    <property name="userDefinedHeaderPrefix" value=""/> <!-- remove the default X- prefix -->
    <property name="outboundHeaderNames" value="SOAPAction" />
</bean>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM