user1552545
user1552545

Reputation: 1331

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.

Upvotes: 2

Views: 841

Answers (1)

Gary Russell
Gary Russell

Reputation: 174484

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>

Upvotes: 2

Related Questions