2016-03-30 7 views
0

私が理解していないトランスフォームメッセージコンポーネントとmule ESBでの作業に問題があります。 私はうまく動作する単純なフローを持っています。最初はHTTPエンドポイントであり、最後はTransformメッセージコンポーネントで、1つのJSONを別のものに変換します。Mule esbとTransformメッセージ(wave transformコンポーネント)

今、私は店のペイロードにしようとする前に、変数にメッセージを変換し、その変数にペイロードを設定し、I変換メッセージコンポーネントで例外を取得:見つけ 型の不一致 :名前、:文字列 が必要:名前、:オブジェクト( com.mulesoft.weave.engine.ast.dynamic.DispatchException) com.mulesoft.weave.engine.ast.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> 

私は、変換前にペイロードをログに記録するロガーを入れたとき、それは両方のフローで同じである.... 缶誰かを:作品 フロー何が間違っているのか教えてください。

ありがとうIvan。

答えて

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