0
votes

I have created a custom connector to connect to a SOAP XML API, and I am using the XML to Rest tool to create a full custom connector.

One of my API methods return a value that contains CDATA formatting, and when my Logic App is using the custom connector and returning this data, it stops at the CDATA and says "BadRequest. Http request failed: the content was not a valid JSON.".

Swagger editor in the custom connector has the property of this item as "type: string", but Logic Apps debugging comes up with the following error:

Parse error on line 1: <![CDATA[{"an ^ Expecting 'STRING', 'NUMBER',

Any help is appreciated!

1

1 Answers

0
votes

There is no CDATA in JSON. So the parser error is correct: that is not valid JSON.

You could try to encode the CDATA in a string literal using something like base64 encoding. For more information, see the answer (and comments!) to the question Binary Data in JSON String. Something better than Base64.

EDIT:
Since you created the custom connector, you are in control of how the XML is processed and 'converted' into JSON, right? This gives you the opportunity to

  • read the XML
  • convert the 'normal' data into valid JSON
  • encode the CDATA and add it to the JSON data