2016-03-30 20 views
0

我有一個問題,處理轉換消息組件和騾子ESB,我不明白。 我有一個簡單的流程,工作正常,一開始它是Http端點,最後是Transform消息組件,將一個JSON轉換爲另一個。騾esb和變換消息(波形轉換組件)

現在,當我嘗試存儲負載轉換前的消息變量,然後設置有效載荷變量,我得到變換消息組件除外: 發現類型不匹配 :名稱,:字符串 要求:名稱,:對象( com.mulesoft.weave.engine.ast.dynamic.DynamicDispatchException) com.mulesoft.weave.engine.ast.dynamic.DynamicDispatchNode:65(空)

下面是工作流,再下面是流這是行不通的。 流量的作品:

<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> 
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" doc:name="HTTP Listener Configuration"/> 
    <flow name="testFlow"> 
     <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/> 
     <byte-array-to-string-transformer doc:name="Byte Array to String"/> 
     <dw:transform-message metadata:id="b8a77df6-4692-4c52-b572-b6a175e7467e" doc:name="Transform Message"> 
      <dw:set-payload><![CDATA[%dw 1.0 
%output application/json 
--- 
{ 
    id: payload.transfer-id, 
    created-record-status: 'accepter' 
}]]></dw:set-payload> 
     </dw:transform-message> 
    </flow> 
</mule> 

流量,當我把記錄儀記錄轉化前的有效載荷不起作用>

<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> 
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" doc:name="HTTP Listener Configuration"/> 
    <flow name="testFlow"> 
     <http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/> 
     <byte-array-to-string-transformer doc:name="Byte Array to String"/> 
     <set-variable variableName="OriginalPayload" value="#[payload]" doc:name="Variable"/> 
     <set-payload value="#[flowVars.OriginalPayload]" doc:name="Set Payload"/> 
     <dw:transform-message metadata:id="b8a77df6-4692-4c52-b572-b6a175e7467e" doc:name="Transform Message"> 
      <dw:set-payload><![CDATA[%dw 1.0 
%output application/json 
--- 
{ 
    id: payload.transfer-id, 
    created-record-status: 'accepter' 
}]]></dw:set-payload> 
     </dw:transform-message> 
    </flow> 
</mule> 

,它是在兩個流一樣的.... 有人能告訴我我做錯了什麼?

謝謝伊萬。

回答

1

由於設置的有效負載缺少MIME類型你得到的錯誤使用下面的XML,我已經測試和它的工作正常。 <set-payload value="#[flowVars.OriginalPayload]" doc:name="Set Payload" mimeType="application/json"/>

<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd"> 
    <http:listener-config name="HTTP_Listener_Confi" host="localhost" port="8085" doc:name="HTTP Listener Configuration"/> 
    <flow name="testFlow"> 
     <http:listener config-ref="HTTP_Listener_Confi" path="/test" doc:name="HTTP"/> 
     <byte-array-to-string-transformer doc:name="Byte Array to String"/> 
     <logger message="#[payload]" level="INFO" doc:name="Logger"/> 
     <set-variable variableName="OriginalPayload" value="#[payload]" doc:name="Variable"/> 
     <set-payload value="#[flowVars.OriginalPayload]" doc:name="Set Payload" mimeType="application/json"/> 
     <dw:transform-message metadata:id="b8a77df6-4692-4c52-b572-b6a175e7467e" doc:name="Transform Message"> 
      <dw:set-payload><![CDATA[%dw 1.0 
%output application/json 
--- 
{ 
    id: payload.transfer-id, 
    created-record-status: 'accepter' 
}]]></dw:set-payload> 
     </dw:transform-message> 
    </flow> 
</mule> 
+0

這樣做的工作,謝謝 – Gewra