Create dynamic XML body in HTTP request


I’m trying to modify an xml body to be used in a HTTP request activity, if a variable is empty it should be removed from the body.

Normally I would use the body as a string directly in the http request, but here I need to generate the body as a string first, and it seems that my normal procedure isn’t working.

Normally I would copy the body from SoapUI and turn it into a string using double qoutes

This body
<soapenv:Envelope xmlns:soapenv=“” xmlns:dtor=“urn:microsoft-dynamics-schemas/page/dtorderkort”>


would be like this

“<soapenv:Envelope xmlns:soapenv=”“”" xmlns:dtor="“urn:microsoft-dynamics-schemas/page/dtorderkort”"> soapenv:Header/ soapenv:Body> dtor:ReadMultiple dtor:filter dtor:Field>Reg_No</dtor:Field>"

with extra " where there already is ", but when I try the same in a string variable, the extra " is turned into a
like this
"<soapenv:Envelope xmlns:soapenv=“” xmlns:sal=“urn:microsoft-dynamics-schemas/page/salgsordre90”>

I already tried changing the " with single qoutes, but that doesn’t work either.

Any good ideas?

Kindly note: your XML snippet is broken, please use the </> format button from editor

It can be recommended to work on XML Api Approaches to modify the XML (-Template) file.

As there are XML Namespaces defined, we do have to handle. For this have a look here:

Opposite to read e.g. a XML Value by myXElementVar.Value we also can assign a new value
myXElementVar.Value = “MyNewValue”

with the help of the provided API options we also can remove / add items.

kindly note: the visual representation we do see on e.g. immediate panel is not the text content per se: