Quantcast
Channel: Azure Logic Apps Problem with Liquid Transformation of SOAP XML - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Azure Logic Apps Problem with Liquid Transformation of SOAP XML

0
0

I'm using Azure Logic Apps to integrate with a legacy SOAP API. I would like to translate the XML (particularly the responses) in to something easier to use such as json.

Normally I use a Custom Connector within Logic Apps to connect to new APIs. I've tried to create a Custom Connector for this SOAP, but the WSDL contains recursive references which apparently aren't allowed. I was able to create managed API with our APIM container, but still could not produce anything that would allow me to create the custom connector. So, I moved on to dealing with the transactions individually. A Liquid transformation map from XML to json seems ideal, but so far I haven't got it to work, namely because I can't figure out the naming convention to access certain XML elements (those that happen to have the same id as their parent). For now I am using the json(xml()) function as a work around, but it seems less ideal than a Liquid map.

As you can see the AgreementId is easily accessible via the normal naming conventions, but I can't seem to access any of the child elements of the 2nd RequestReportResponse node.

This is the XML I'm trying to transform:

<SOAP-ENV:Envelope>
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <RequestReportResponse>
         <MessageHeader>
            <AgreementId>urn:agreementId:</AgreementId>
         </MessageHeader>        
      <RequestReportResponse>
            <Extension>csv</Extension>
            <FileByteArray>xyzFileBytes</FileByteArray>
            <FileName>xyzFileName</FileName>
            <StatusCode>200</StatusCode>
            <StatusDescription>SUCCESS</StatusDescription>
         </RequestReportResponse>
      </RequestReportResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is the Liquid map I'm using:

{
  "AgreementId": "  {{content.Envelope.Body.RequestReportResponse.MessageHeader.AgreementId}}",
  "FileByteArray": "{{content.Envelope.Body.RequestReportResponse.RequestReportResponse.FileByteArray}}",
  "FileName": "{{content.Envelope.Body.RequestReportResponse.RequestReportResponse.FileName}}",
  "StatusCode": "{{content.Envelope.Body.RequestReportResponse.RequestReportResponse.StatusCode}}",
  "StatusDescription": "{{content.Envelope.Body.RequestReportResponse.RequestReportResponse.StatusDescription}}"
}

Expected result:

{
  "AgreementId": "urn:agreementId:",
  "FileByteArray": "xyzFileBytes",
  "FileName": "xyzFileName",
  "StatusCode": "200",
  "StatusDescription": "SUCCESS"
}

Actual result:

{
  "AgreementId": "urn:agreementId:",
  "FileByteArray": "",
  "FileName": "",
  "StatusCode": "",
  "StatusDescription": ""
}

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images