Search code examples
xmlsoapwso2wso2-enterprise-integrator

WSO2 enterprise integrator - How to remove xmlns="http://ws.apache.org/ns/synapse" that is automatically added to SOAP message


After creating a soap payload, as follows:

 <payloadFactory media-type="xml">
    <format>
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.test.com">
            <soapenv:Header/>
            <soapenv:Body>
                <ws:process>
                    <request>
                        <action>$1</action>
                        <transaction>
                            <id>$2</id>
                        </transaction>
                    </request>
                </ws:process>
            </soapenv:Body>
        </soapenv:Envelope>
    </format>
    <args>
        <arg evaluator="xml" expression="get-property('ACTION')"/>
        <arg evaluator="xml" expression="get-property('TRANSACTION_ID')"/>
    </args>
</payloadFactory>

WSO2 is automatically adding xmlns attribute only to the request tag as follows: causing issues when calling the endpoint. How to prevent this?


Solution

  • Just specify an empty namespace in the root element of your body.

    <ws:process xmlns="" >
        <request>
            <action>$1</action>
            <transaction>
                <id>$2</id>
            </transaction>
        </request>
    </ws:process>