2016-03-16 4 views
2

У меня есть следующий исходящий HTTP-шлюз.Как добавить заголовок SOAPAction в HTTP-сообщение в Spring-Integration?

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

Я хочу добавить SAOPAction в HTTP-заголовок. Как я могу это сделать? Использование шлюза исходящей веб-службы не является для меня вариантом, поскольку мой конверт SOAP не является стандартным конвертом SOAP.

ответ

2

Используйте обогатитель заголовка и пользовательский 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> 
Смежные вопросы