Hi guys I am trying to make a payload in wso2 MI and has written a code so for the below mentioned code:
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<chan:ChangeSubOfferingRqsAPI>
<Header>
<Username>$1</Username>
</Header>
<Body>
<SerialNo>$2</SerialNo>
</Body>
</chan:ChangeSubOfferingRqsAPI>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$ctx:userName"/>
<arg evaluator="xml" expression="$ctx:password"/>
</args>
</payloadFactory>
I am getting this payload:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/">
<soapenv:Body>
<chan:ChangeSubOfferingRqsAPI>
<Header xmlns="http://ws.apache.org/ns/synapse">
<Username>abcd</Username>
</Header>
<Body xmlns="http://ws.apache.org/ns/synapse">
<SerialNo>100000000</SerialNo>
</Body>
</chan:ChangeSubOfferingRqsAPI>
</soapenv:Body>
</soapenv:Envelope>
Can anyone help me understand an guide that what to change in payload factory so xmlns is removed from Header
and Body
elements? Rather than <Header xmlns="http://ws.apache.org/ns/synapse">
I want it to be <Header>
only. Same goes for the Body
element.
You need to add a empty namespace to your payload like xmlns=""
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns="" xmlns:chan="http://www.tibco.com/ChangeSubOfferingAPI/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<chan:ChangeSubOfferingRqsAPI>
<Header>
<Username>$1</Username>
</Header>
<Body>
<SerialNo>$2</SerialNo>
</Body>
</chan:ChangeSubOfferingRqsAPI>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="$ctx:userName"/>
<arg evaluator="xml" expression="$ctx:password"/>
</args>
</payloadFactory>