0

在此处输入图像描述

如何在 Mulesoft 中获取从 http post 到 Javascript 组件的所有有效负载?

4

1 回答 1

1

The payload is automatically available in the scripting component as the keyword payload:

    <scripting:execute engine="JavaScript" doc:name="Execute">
        <scripting:code >var x = payload;</scripting:code>
    </scripting:execute>

To decouple your script from mule internal keywords, you can pass in a list of parameters instead in the form of a dataweave map of key:value pairs:

    <scripting:execute engine="JavaScript" doc:name="Execute">
        <scripting:code >var x = myVar;</scripting:code>
        <scripting:parameters ><![CDATA[#[{'myVar': payload}]]]></scripting:parameters>
    </scripting:execute> 
于 2019-05-24T14:56:34.893 回答