骡子 - 选择组件问题 [英] Mule - choice component issue

查看:147
本文介绍了骡子 - 选择组件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行我的流程时,我收到以下错误`

When I run my flow, I get the following error `

<org.apache.cxf.staxutils.DepthXMLStreamReader>
  <reader class="org.mule.module.cxf.support.StreamClosingInterceptor$1">
    <reader class="com.ctc.wstx.sr.ValidatingStreamReader">
      <mXml11>false</mXml11>
      <mInputBuffer>xmlns:ns2=&quot;http://wsdouane/&quot;&gt;&lt;return&gt;&lt;douanePK&gt;&lt;idConteneurId&gt;ctr1&lt;/idConteneurId&gt;&lt;idCritereId&gt;C11&lt;/idCritereId&gt;&lt;/douanePK&gt;&lt;valeurId&gt;oui&lt;/valeurId&gt;&lt;/return&gt;&lt;/ns2:findResponse&gt;&lt;/S:Body&gt;&lt;/S:Envelope&gt;&#x0;&#x0;.................

我们可以从< mInputBuffer> 开始看到正确的soap响应,有没有办法只获取soap响应?

we can see the correct soap response starting from the <mInputBuffer>, is there a way to get only the soap response??

这是我的流程

 <flow name="SOAPWebService" doc:name="SOAPWebService">
    <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8088/esb" doc:name="HTTP"/>
    <object-to-string-transformer doc:name="Object to String"/>
    <choice doc:name="Choice">
        <when expression="#[payload.contains('C22')]">
            <set-variable variableName="paramCtr" value="#[message.inboundProperties['ctr']]" doc:name="conteneur"/>
            <set-variable variableName="paramC" value="#[message.inboundProperties['c']]" doc:name="critere"/>
            <component class="com.example.components.SampleComponent" doc:name="Java"/>
            <mulexml:xslt-transformer  maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="C:\MuleStudio\SandBox\resources\PrepareRequestXMLPort.xsl" doc:name="XSLT">
                <mulexml:context-property key="paramCtr" value="#[flowVars['paramCtr']]" />
                <mulexml:context-property key="paramC"  value="#[flowVars['paramC']]" />
            </mulexml:xslt-transformer>
            <cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
            <http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:8080/ClientsDB/port" doc:name="PortWS"/>
            <byte-array-to-string-transformer   doc:name="Byte Array to String" />
        </when>
        <otherwise>
            <set-variable variableName="paramCtr" value="#[message.inboundProperties['ctr']]" doc:name="conteneur"/>
            <set-variable variableName="paramC" value="#[message.inboundProperties['c']]" doc:name="critere"/>
            <component class="com.example.components.SampleComponent" doc:name="Java"/>
            <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="C:\MuleStudio\SandBox\resources\PrepareRequestXMLDouane.xsl" doc:name="XSLT">
                <mulexml:context-property key="paramCtr"  value="#[flowVars['paramCtr']]" />
                <mulexml:context-property key="paramC"  value="#[flowVars['paramC']]" />
            </mulexml:xslt-transformer>                
            <cxf:proxy-client payload="body" enableMuleSoapHeaders="true" doc:name="SOAP"/>
            <http:outbound-endpoint exchange-pattern="request-response" address="http://localhost:8080/ClientsDB/douane" doc:name="DouaneWS"/>
            <byte-array-to-string-transformer doc:name="Byte Array to String"/>
        </otherwise>
    </choice>
    <xm:object-to-xml-transformer doc:name="Object to XML"/>
    <file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml " responseTimeout="10000" doc:name="Outgoing File"/>
</flow>

谢谢。

推荐答案

此表达式#[payload.contains('c22')] 无法正常工作,因为有效负载为 InputStream 。您是不是在Mule的日志中看到堆栈跟踪?

This expression #[payload.contains('c22')] can't work because the payload is an InputStream. Aren't you seeing stack traces in Mule's logs?

在任何情况下,请尝试添加< object-to-string-transformer />在选择之前,看看它是否解决了问题。

In any case, try adding <object-to-string-transformer /> before the choice and see if it fixes the issue.

编辑:

问题是你正在使用XStream(在 xm:object-to-xml-transformer )将CXF响应对象( org.apache.cxf.staxutils.DepthXMLStreamReader )序列化为XML。不应该在流程的响应阶段中使用 cxf:proxy-client 来处理CXF响应。 xm:对象到xml-transformer 文件:outbound-endpoint 之后选择路由器可能会扰乱这种机制。尝试将它们包装在选择路由器上方的响应元素中,以便它们在响应阶段后执行。

The problem is that you're using XStream (in xm:object-to-xml-transformer) to serialize the CXF response object (org.apache.cxf.staxutils.DepthXMLStreamReader) into XML. The CXF response should not be messed with and should be handled by the cxf:proxy-client in the response phase of the flow. The xm:object-to-xml-transformer and file:outbound-endpoint after the choice router are probably disturbing this mechanism. Try to wrap them in a response element above the choice router to they execute after it in the response phase.

请注意,我已经在您的其他问题中给了您这个建议 https ://stackoverflow.com/a/16615537/387927 但你没有做出反应。

Note that I have already given you this advice in your other question https://stackoverflow.com/a/16615537/387927 but you did not react to it.

我也不认为 byte-array-to-string-transformer 做任何事情: http:outbound-endpoint 之后的消息有效负载应该是 org.apache.cxf.staxutils.DepthXMLStreamReader ,防止此变压器触发。

Also I don't think byte-array-to-string-transformer does anything: the message payload after the http:outbound-endpoints should be org.apache.cxf.staxutils.DepthXMLStreamReader, preventing this transformer to fire.

这篇关于骡子 - 选择组件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆