How to drop empty SOAP-Body elements in REST-SOAP-REST proxy

Not applicable

I created a REST - SOAP - REST proxy in Edge. Input is application/json via POST.

lets say json input is

{ "A": { "B": { "C": "D", "E": "F" } } }

this gets converted to soap internally via json payload extract and build soap policy to

<soapenv:Envelope><soapenv:Body><A><B><C>D</C><E>F</E></B></A></soapenv:Body></soapenv:Envelope>

this is fine and works. But when i have scenarios like this

json input is

{ "A": { "B": { "E": "F" } } }

this gets converted to soap internally via json payload extract and build soap policy to

<soapenv:Envelope><soapenv:Body><A><B><C></C><E>F</E></B></A></soapenv:Body></soapenv:Envelope>

Iam getting error from target where C is rejected. Would do u suggest to remove C if empty.

Target is fine as long as there are no empty elements. For ex: in the above case ,

<soapenv:Envelope><soapenv:Body><A><B><E>F</E></B></A></soapenv:Body>

</soapenv:Envelope>

C is an example element. There are 10s of elements like these and could be very random as many are optional elements.

Solved Solved
0 2 1,218
1 ACCEPTED SOLUTION

Former Community Member
Not applicable

There is a XSLT here (https://stackoverflow.com/questions/6648679/removing-empty-tags-from-xml-via-xslt) that removes empty tags. I would add that XSLT after the assign message policy.

View solution in original post

2 REPLIES 2

Former Community Member
Not applicable

There is a XSLT here (https://stackoverflow.com/questions/6648679/removing-empty-tags-from-xml-via-xslt) that removes empty tags. I would add that XSLT after the assign message policy.

Worked great ! Just added a Javascript policy after xsl and overwrote request.content.

Thanks for the help !