[Solved] How can I get the response body in WSO2 ESB


You can use the payloadFactory

<payloadFactory media-type="xml">
  <format>
    <jsonObject>
      <cookie>$1</cookie>
      <product>$2</product>
      <place>$3</place>
    </jsonObject>
  </format>
  <args>
    <arg evaluator="xml" expression="//cookie"/>
    <arg evaluator="xml" expression="//product"/>
    <arg evaluator="xml" expression="//place"/>
  </args>
</payloadFactory>

But as already commented you need an enclosing element if not your xml will simply not be valid. If the goal is to output Json this element should be called jsonObject (find more info here : https://docs.wso2.com/display/EI600/JSON+Support).

If you don’t need XML the best approach would be to directly build your json object

<payloadFactory media-type="json">
  <format>
    {
      "cookie": $1,
      "product": $2,
      "place": $3
    }
  </format>
  <args>
    <arg evaluator="xml" expression="//cookie"/>
    <arg evaluator="xml" expression="//product"/>
    <arg evaluator="xml" expression="//place"/>
  </args>
</payloadFactory>

4

solved How can I get the response body in WSO2 ESB