简体   繁体   中英

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

I have the following HTTP outbound gateway.

<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. 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.

Use a header enricher and a custom 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>

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.

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