m子流错误-消息有效载荷的类型为:byte [] [英] Error in mule flow - Message payload is of type: byte[]
本文介绍了m子流错误-消息有效载荷的类型为:byte []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用带有有效负载的localhost URL进入名为 方法 的子流(请参见下面的代码片段). 如果必须查明,以下xpath表达式求值失败
I am able to get to the subflow named method (refer snippet below) using localhost url with a valid payload. If I had to pinpoint, following xpath expression evaluation is failing
#[xpath://Envelope/Body/add] ,错误消息是消息有效载荷的类型为:byte []
我尝试使用转换器(字节数组到字符串,字节数组到对象,对象到xml等),但是似乎没有任何方法可以解决这个问题.
I have tried using transformers (byte-array-to-string, byte-array-to-object, object-to-xml etc.) but nothing seems to resolve this.
<flow name="version1" >
<http:inbound-endpoint ........ />
<set-variable variableName="req" value="#[payload:java.lang.String]"/>
<flow-ref name="method"/>
<catch-exception-strategy>
<logger level="ERROR" message="Exception occurred when invoking add/update operation. The payload submitted was: #[flowVars['req']]"/>
</catch-exception-strategy>
</flow>
<sub-flow name="method" >
<choice doc:name="Choice" >
<when expression="#[xpath://Envelope/Body/add]">
<flow-ref name="add_v1"/>
</when>
<when expression="#[xpath://Envelope/Body/update]" >
<flow-ref name="update_v1"/>
</when>
<otherwise>
<scripting:component>
<scripting:script engine="Groovy">
<![CDATA[throw new Exception("Operation not found!");]]>
</scripting:script>
</scripting:component>
</otherwise>
</choice>
</sub-flow>
**ERROR**
Message : Failed to invoke ScriptComponent{method.component.568157096}. Component that caused exception is: ScriptComponent{method.component.568157096}. Message payload is of type: byte[]
Code : MULE_ERROR--2
推荐答案
在流版本1中
在http入站端点之后,添加对象到字符串的转换器. xpath表达式会正确执行,而不会出现错误.
after the http inbound endpoint, add object-to-string transformer. the xpath expression evalautes with out the error.
这篇关于m子流错误-消息有效载荷的类型为:byte []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文