Search code examples
muledataweavemule-esb

How to combine value from XML with a String?


I have a listener that receives a XML payload. In the following transform I would like to combine a string and a value this XML, but it breaks

This is the XML I receive:

<?xml version="1.0" encoding="UTF-8"?>
<INVOIC02>
  <IDOC BEGIN="1">
    <RESULT>12345</RESULT>
  </IDOC>
</INVOIC02>

This is my transformation:

%dw 2.0
output text/plain
---
"Result:" ++ (payload.INVOICE.IDOC.RESULT)

Apparently I access the payload wrong, I guess. The error message looks like this:

You called the function 'Value Selector' with these arguments: 1: String ("\n\n ...) 2: Name ("INVOICE")

But it expects one of these combinations: (Array, Name) ...

Any idea what I'm doing wrong?


Solution

  • The problem is that the xml doesn't have the mimetype set. As a workaround set the payload with value payload and set also the mimetype to xml