【问题标题】:Passing String/XML request to a http outbound as text/xml将 String/XML 请求作为 text/xml 传递给 http 出站
【发布时间】:2013-04-11 03:19:44
【问题描述】:

我有一个场景,我需要通过 http:outbound 调用 Web 服务。该服务仅接受 text/xml。

但是在我的转换和转换之后,我得到了我的有效载荷(xml)作为字节 [] 或字符串。 当此有效负载通过 http:outbound 向服务传递请求时,它会返回错误提示

Exception stack is:
1. Message contained MIME type "application/atom+xml" when "text/xml" was expected.     
Message payload is of type: byte[] (org.mule.api.MessagingException)

以下是我的流程的一部分。

<mule-xml:xslt-transformer
        maxIdleTransformers="2" maxActiveTransformers="5"
        xsl-file="C:\EWS\MyProject\src\main\resources\xslt\XML_Repeater.xsl">
</mule-xml:xslt-transformer>

 <!-- <byte-array-to-string-transformer></byte-array-to-string-transformer>  -->

 <http:outbound-endpoint exchange-pattern="request-response" mimeType="text/xml"  
        address="http://sampleproj:9080/myservice/servlet/rpcrouter" />

如何将预期的 mime-type 传递给 http:outbound?

【问题讨论】:

    标签: xml mule


    【解决方案1】:

    添加:

    <set-property propertyName="Content-Type" value="text/xml" />
    

    就在http:outbound-endpoint之前。

    【讨论】:

      【解决方案2】:

      我不确定如何设置 mime-types,但您是否尝试过使用 &lt;cxf:proxy-client&gt; 发送肥皂请求,如下所示。此外,您可能需要指定 SoapAction 以指定在 web-service 上调用哪个操作

      <mule-xml:xslt-transformer
          maxIdleTransformers="2" maxActiveTransformers="5"
          xsl-file="C:\EWS\MyProject\src\main\resources\xslt\XML_Repeater.xsl">
      </mule-xml:xslt-transformer>
      <set-property propertyName="SOAPAction" value="http://operationToCall" />
      <cxf:proxy-client payload="body" enableMuleSoapHeaders="false">
         <cxf:outInterceptors>
           <spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
         </cxf:outInterceptors>
      </cxf:proxy-client>
      <http:outbound-endpoint exchange-pattern="request-response" mimeType="text/xml"  
          address="http://sampleproj:9080/myservice/servlet/rpcrouter" />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-12-01
        • 1970-01-01
        • 2019-01-20
        • 2020-05-15
        • 1970-01-01
        • 2018-03-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多