我有以下 HTTP 出站网关。
<int-http:outbound-gateway id="myWs"
request-channel="requests"
url="http://localhost/test"
http-method="POST"
charset="UTF-8"
reply-timeout="1234"/>
我想将 SAOPAction 添加到 HTTP header 。我怎样才能做到这一点? 使用出站 Web 服务网关对我来说不是一个选项,因为我的 SOAP 信封不是标准的 SOAP 信封。
最佳答案
使用 header 丰富器和自定义 header 映射器
...
<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>
关于java - 如何在 Spring-Integration 中将 SOAPAction header 添加到 HTTP 消息中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36046415/