Using liqued template to wrap converted xml into envelope

Thomas Vogt Poulsen 1 Reputation point
2022-03-15T08:33:16.3+00:00

In APIM I have the request to convert incoming JSON message into a XML format including the SOAP envelope wrapping.
I was hoping that it would be as easy as using the policies <json-to-xml> conversion to generate the body and then applying a liquid template to wrap it with the envelope and namespaces, but I cannot seem to get it to work.

The conversion does its job, but how do I get it inserted into the request body? I am misunderstanding the liquid template functionality? I have seem that I can pick induvial values but this would be a massive job if I was to recreate the entire body one tag-by-one.

<policies>
<inbound>
<base />
<json-to-xml apply="always" consider-accept-header="true" parse-date="true" />
<set-body template="liquid">
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns="http://[namespace]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Post>
[Put in the json-to-xml converted XML]
</Post>
</soap:Body>
</soap:Envelope>
</set-body>
<set-header name="Content-Type" exists-action="override">
<value>application/soap+xml; Action="http://******** Something ******"</value>
</set-header>
</inbound>

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,446 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.