Mule 3 で cxf:jaxws-client を使用していますが、Web サービス呼び出しから取得した応答のタイプは ReleasingInputStream です。http-response-to-message-transformer を追加しようとしましたが、エラーが発生します - ReleasingInputStream ではなくオブジェクトとして応答を取得する方法を知っている人はいますか?
どうもありがとう。
この問題を解決するには、次のコードを変更して<cxf-client>
、セクション内<outbound-endpoint>
(NOT BEFORE IT) に配置します。
<cxf:jaxws-client
clientClass="com.xyz.services.WSServices"
port="WSServicesSoap"
wsdlLocation="classpath:wsdl-file.wsdl"
operation="GimmeDataOperation" />
<outbound-endpoint exchange-pattern="request-response" address="http://localhost:8083/OutboundService" />
ReleasingInputStream
出力を生成する
<outbound-endpoint exchange-pattern="request-response" address="http://localhost:8083/OutboundService" >
<cxf:jaxws-client
clientClass="com.xyz.services.WSServices"
port="WSServicesSoap"
wsdlLocation="classpath:wsdl-file.wsdl"
operation="GimmeDataOperation" />
</outbound-endpoint>
期待されるオブジェクトを返します。
jaxws-client の要点は、マーシャリングされていない Java オブジェクトを受け取ることなので、WS 応答を文字列として取得したり、ReleisingInputStream を取得したりすることはオプションではありません。
<cxf:jaxws-client> を、WS クライアントが動作すると予想されるように「動作」させるには、<outbound-endpoint> の INSIDE を配置すると、正しい Java オブジェクトがペイロードとして取得されます。
私はちょうどこの同じ問題を抱えていました。次のように、送信エンドポイントの応答側に ObjectToString トランスフォーマーを追加することで解決しました。
<mule>
<object-to-string-transformer name="ObjectToString"/>
<flow>
...
...
...
<cxf:jaxws-client clientClass="com.my.ClientClass"
port="MyPort"
wsdlLocation="classpath:MyWsdl.wsdl"
operation="MyOperation" />
<outbound-endpoint address="http://some.address/path/to/service"
exchange-pattern="request-response"
responseTransformer-refs="ObjectToString" />
...
...
...
</flow>
</mule>