Document reference: https://docs.microsoft.com/en-us/azure/api-management/api-management-transformation-policies#example-1
A snippet from my "inbound processing" policies:
<inbound>
<base />
<xml-to-json kind="direct" apply="always" consider-accept-header="false" />
</inbound>
Problem:
When I apply this policy in "inbound processing" the backend API (Logic App
) that is called is given an empty body. The API receiving this request shows Content-Length = 0
.
Results from trace:
xml-to-json (0.697 ms)
"XML-to-JSON policy was applied. Original Content-Length header was removed as its value was invalidated. Content-Type header was set to 'application/json'."
Notes: When I apply this exact same policy in the "outbound processing" policies, I get the result I am expecting as JSON.
Basic XML example I am sending:
<note>
<to>PersonOne</to>
<from>PersonTwo</from>
<heading>Test</heading>
<body>Example</body>
</note>
Result I get when policy is applied to in "outbound policies" section (This is working as expected):
{
"note": {
"to": "PersonOne",
"from": "PersonTwo",
"heading": "Test",
"body": "Example"
}
}
xml-to-json
policy and it did work as expected. Do you have any other policies that maybe are affecting the request body? – PramodValavala-MSFTLogic App
would help? I have a simple Logic App that is setup as a trigger to receive this. I will try again today and simplify everything and see if there is anything else inbound that would do this. I'll post back today with some news. Thanks! – Brien Foss