2017-08-23 1 views
0

私は春の統合と春の起動が初めてです。そして、私のユースケースは、JMSキュー内のメッセージをポーリングし、JMSキューから来るメッセージペイロードXMLを使用して別のWebサービスを呼び出すことです。 XMLペイロードには、SOAPエンベロープ、本文、およびSAMLヘッダーが含まれています。ws:outbound-gatewayは余分なSOAPエンベロープとヘッダーをメッセージに追加します

SOAP UIツールを使用して、XMLペイロードでWebサービスにヒットできます。

これは私の春の統合設定ファイルです。

============================================== ======

<beans:beans xmlns="http://www.springframework.org/schema/integration" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:int="http://www.springframework.org/schema/integration" 
    xmlns:http="http://www.springframework.org/schema/integration/http" 
    xmlns:jms="http://www.springframework.org/schema/integration/jms" 
    xmlns:ws="http://www.springframework.org/schema/integration/ws" 
    xmlns:stream="http://www.springframework.org/schema/integration/stream" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans.xsd 
      http://www.springframework.org/schema/integration 
      http://www.springframework.org/schema/integration/spring-integration.xsd 
      http://www.springframework.org/schema/integration/http 
      http://www.springframework.org/schema/integration/http/spring-integration-http.xsd 
      http://www.springframework.org/schema/integration/jms 
      http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd 
      http://www.springframework.org/schema/integration/ws 
      http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd 
      http://www.springframework.org/schema/integration/stream 
      http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"> 
    <jms:message-driven-channel-adapter id="jmsIn" 
      destination-name="requestQueue" 
      channel="jmsInChannel" 
      error-channel = "error-Channel" /> 


<channel id="error-Channel"/> 
<stream:stdout-channel-adapter id="error-Channel"/> 

<channel id="jmsInChannel"> 
    <interceptors> 
     <wire-tap channel="loggerChannel"/> 
    </interceptors> 
</channel> 

<logging-channel-adapter id="loggerChannel" level="INFO"/> 

<beans:bean id="MY.SOAP-MessageSender" 
    class="org.springframework.ws.transport.http.HttpComponentsMessageSender"> 
    <beans:property name="connectionTimeout" value="30000" /> 
    <beans:property name="readTimeout" value="50000" /> 
</beans:bean> 
    <chain input-channel="jmsInChannel" output-channel="outChannel"> 
     <header-enricher> 
      <header name="Content-Type" value="text/xml;charset=UTF-8" /> 
      <header name="SOAPAction" value="soapaction"/> 
     </header-enricher> 
     <ws:outbound-gateway message-sender="MY.SOAP-MessageSender" uri="http://localhost:8080/soapws-endpoint"/> 
    </chain> 

    <!-- The response from the service is logged to the console. --> 
    <!-- <stream:stdout-channel-adapter id="outChannel"/> --> 
    <channel id="outChannel"> 
     <interceptors> 
      <wire-tap channel="loggerChannel2"/> 
     </interceptors> 
    </channel> 
<logging-channel-adapter id="loggerChannel2" level="INFO"/> 

<beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
    <!-- brokerURL, You may have different IP or port --> 
    <beans:constructor-arg index="0" value="tcp://localhost:61616" /> 
</beans:bean> 

    <!-- Spring JMS Template --> 
    <beans:bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" > 

    <beans:property name="connectionFactory" ref="connectionFactory"/> 

    </beans:bean> 
</beans:beans> 

=====================================私は春が既に持っている(既存のXMLペイロードに余分なSOAPエンベロープとヘッダを追加していることを見ることができます========================

SOAPエンベロープとペイロード)。

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/> 
<SOAP-ENV:Body><soapenv:Envelope xmlns:head="http://header" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://typ"> 
    <soapenv:Header> 
. 
. 
. WS security hader 
    </soapenv:Header> 
</soapenv:Body> 
</soapenv:Envelope> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

質問:私は、追加取得している余分なSOAPエンベロープとSOAPヘッダを削除するにはどうすればよい 。私が使用できる設定では、箱から外れたものはありますか?そうでない場合は、私が利用できるサンプルコードを提供してください。 お願いします...事前に感謝します。

答えて

0

どのように設計されているのですか。あなたは内容を送信する必要があり、ゲートウェイはSOAPエンベロープを追加します。それはSpring Web Servicesに基づいています。

独自のSOAP処理をロールバックしたい場合は、代わりに単純なHTTPアウトバウンドゲートウェイを使用。

+0

カスタムSOAPヘッダを注入する必要がある場合は、このhttp://docs.spring.io/spring-integration/docs/5.0.0.M6/reference/html/ws.html#ws-message-headersをチェックします'DefaultSoapHeaderMapper'についての終わり –

0

ありがとうございました。アウトバウンド・ゲートウェイは、トリックをした:私は、HTTPの属性抽出要求ペイロード=「true」を考える

<chain input-channel="jmsInChannel" output-channel="celsiusChannel"> 
     <header-enricher> 
      <header name="Content-Type" value="text/xml;charset=UTF-8" /> 
      <header name="SOAPAction" value="soapaction"/> 
     </header-enricher> 
     <ws:outbound-gateway message-sender="MY.SOAP-MessageSender" uri="http://localhost:8080/soa-ws"/> 
    </chain> 

の代わりに、以下の構成

<header-enricher input-channel="jmsInChannel" 
output-channel="jmsOutChannel"> 
      <header name="Content-Type" value="text/xml;charset=UTF-8" /> 
      <header name="SOAPAction" value="soapaction"/> 
     </header-enricher> 
     <int:channel id="jmsOutChannel" /> 
<http:outbound-gateway extract-request-payload="true" id="webservice.outbound.gateway" request-channel="jmsOutChannel" reply-channel="celsiusChannel" url="http://localhost:8080/soa-ws" expected-response-type="java.lang.String" /> 

を使用していました。今や余分なSOAPヘッダーとエンベロープが追加されていません。

関連する問題