【问题标题】:Mule CXF Marshall Response骡子 CXF 马歇尔响应
【发布时间】:2011-09-14 19:26:15
【问题描述】:

我在 Mule 3 中使用 cxf:jaxws-client,我从 Web 服务调用中得到的响应是 ReleasingInputStream 类型。我尝试添加 http-response-to-message-transformer,但这会产生错误 - 有谁知道我如何将响应作为对象而不是 ReleasingInputStream 来检索?

非常感谢。

【问题讨论】:

    标签: cxf mule


    【解决方案1】:

    我也遇到了同样的问题。我通过在出站端点的响应端添加一个 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>
    

    【讨论】:

    • 干杯,响应是作为响应返回的字符串还是适当的对象?谢谢。
    【解决方案2】:

    jaxws-client 的全部意义在于接收未编组的 Java 对象,因此将 WS 响应作为 String 或 ReleasingInputStream 甚至不应该是一种选择。

    要使 像预期的 WS 客户端那样“工作” - 将 的 INSIDE 放入您将获得一个正确的 Java 对象作为有效负载。

    【讨论】:

      【解决方案3】:

      要解决此问题,请将&lt;cxf-client&gt; 放入&lt;outbound-endpoint&gt; 部分(不在此之前),方法是修改以下代码

          <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>
      

      返回预期的对象。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-20
        • 2015-09-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-08-22
        • 1970-01-01
        相关资源
        最近更新 更多