I have a REST web service where I request information on public records in the US Bankruptcy Court. The service returns JSON which then has embedded XML which in turn has a further section of embedded XML inside of a tag named <data>. Does anyone know how I can set this up in Mendix? 1) Here is a link to the JSON/XML that is returned: https://jsonformatter.org/json-pretty-print/081a25 2) Here is a link to the sample XML with the embedded xml in the <data> tag: https://jsonformatter.org/xml-viewer/6dde10 2a) I used a tool to create an XSD file and mapped a schema in Mendix: https://jsonformatter.org/xml-viewer/2fd676 3) Here is the above but with just the embedded XML: https://jsonformatter.org/xml-formatter/684274 4) Here is a link to the documentation: http://jdocs.bkwatch.io/api/2017-06-15/ref/#calling-the-api.page.html also here are two screenshots of whjat I have so far
I think you are on the right track, just a couple of additional steps to get this information processed:
For the 'first level' embedded XML, I think that will just get imported in to attribute data of your root object when you import the JSON. So you can access that and put it into a string variable in a microflow. Then, you can add an Import With Mapping Action to your microflow, and import the contents of the string variable with an import mapping you create from your XSD. Voila - that batch of XML will be imported, so you can go do whatever you wish with the data.
For the 'second level' embedded XML, I can't tell for sure but it looks like its been URL Encoded. If so, you can access that from the imported entities from the first import (that I mentioned above) and then decode it. Create a string variable and use the urlDecode function available in Mendix to get the XML into proper form again. You may want to do this step and copy the results so that you can create an XSD file. Once you have the XSD file in hand, you can repeat the same steps you did above - create an XML schema, create an Import Mapping from that schema and then use an Import With Mapping action in your microflow.
Hope that helps,
And of course get in touch with the US Bankruptcy Court and offer your services as integration expert. You will be able to do better compared to the people that created this mess. Also, once you're done, please add this to Mendix' Appstore so other won't have to go through the same hardship that you are experiencing now.