title: Mule esb and Transform message (wave transform component)
body: <p>i have a problem working with transform message component and mule ESB that I do not understand.
  I have a simple flow that works fine, at the beginning it is Http endpoint and at the end it is Transform message component, transforms one JSON to another.</p>
  
  <p>Now when I try to store payload before transform message to variable and then set payload to that variable, I get exception on transform message component: 
  Type mismatch
       found :name, :string
    required :name, :object (com.mulesoft.weave.engine.ast.dynamic.DynamicDispatchException)
    com.mulesoft.weave.engine.ast.dynamic.DynamicDispatchNode:65 (null) </p>
  
  <p>Here is a flow that works, and below that is the flow that doesn't work. 
  Flow that works:</p>
  
  <pre><code>&lt;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"&gt;
      &lt;http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" doc:name="HTTP Listener Configuration"/&gt;
      &lt;flow name="testFlow"&gt;
          &lt;http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/&gt;
          &lt;byte-array-to-string-transformer doc:name="Byte Array to String"/&gt;
          &lt;dw:transform-message metadata:id="b8a77df6-4692-4c52-b572-b6a175e7467e" doc:name="Transform Message"&gt;
              &lt;dw:set-payload&gt;&lt;![CDATA[%dw 1.0
  %output application/json
  ---
  {
      id: payload.transfer-id,
      created-record-status: 'accepter'
  }]]&gt;&lt;/dw:set-payload&gt;
          &lt;/dw:transform-message&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>
  
  <p>Flow that doesn't work></p>
  
  <pre><code>&lt;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"&gt;
      &lt;http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8085" doc:name="HTTP Listener Configuration"/&gt;
      &lt;flow name="testFlow"&gt;
          &lt;http:listener config-ref="HTTP_Listener_Configuration" path="/test" doc:name="HTTP"/&gt;
          &lt;byte-array-to-string-transformer doc:name="Byte Array to String"/&gt;
          &lt;set-variable variableName="OriginalPayload" value="#[payload]" doc:name="Variable"/&gt;
          &lt;set-payload value="#[flowVars.OriginalPayload]" doc:name="Set Payload"/&gt;
          &lt;dw:transform-message metadata:id="b8a77df6-4692-4c52-b572-b6a175e7467e" doc:name="Transform Message"&gt;
              &lt;dw:set-payload&gt;&lt;![CDATA[%dw 1.0
  %output application/json
  ---
  {
      id: payload.transfer-id,
      created-record-status: 'accepter'
  }]]&gt;&lt;/dw:set-payload&gt;
          &lt;/dw:transform-message&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>
  
  <p>When i put logger to log payload before transformation, it is the same in both flows....
  Can somebody tell me what am I doing wrong?</p>
  
  <p>Thanks Ivan.</p>