Friday, February 5, 2016

[WSO2 ESB] How to remove jsonObject root element from message body

Eg: Sample SOAP message

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Header/>
    <soap:Body>
        <jsonObject>
            <foo>
                <aaa>Ajith</aaa>
                <bbb>Vitharana</bbb>
            </foo>
        </jsonObject>
    </soap:Body>
</soap:Envelope>

Eg: Sample ESB configuration.

<enrich>
        <source clone="true" xpath="$body/jsonObject/foo"/>
        <target type="body"/>
</enrich>

source : https://docs.wso2.com/display/ESB480/JSON+Support#JSONSupport-XMLrepresentationofJSONpayloads