Search code examples
jsonxmlmuleprefixtransformer-model

Mule - JSON to XML - Unbound prefix


With my mule flow I get a JSON message and I use a JSON to XML transformer to send the XML to a Web Service.

HTTP => JSON to XML => WS Consumer

The XML needs a prefix "int:" :

<int:contact>Name</int:contact>

And the JSON format is like this:

{  
   "Modify":{  
      "int:contact":"Name"
   }
}

The JSON to XML transformer return an error:

javax.xml.stream.XMLStreamException: Unbound prefix: int

How can I pass the prefix?


Solution

  • you can use Namespace manager.

    <mulexml:namespace-manager includeConfigNamespaces="true">
        <mulexml:namespace prefix="int" uri="http://int.com"/>
    </mulexml:namespace-manager>