Integration Account - Transformation - Conent interpretation

Category: azure logic apps

Question

Koushik984 on Mon, 02 Jan 2017 11:08:00


Hi,

I have Integration account with two schema files and an xslt (transforming one message type to another). This is now part of my Logic app. 

Upon running the logic app, after the transformation is performed, the raw output content has a value which I am not certain how to decode/interpret. 

Question is:

Is there a way to find exact output of the xslt within Azure portal?

After transformation is performed and "value" is returned to logicapp, value might be again serialized/encoded by logic to create raw output. Is this correct understanding? If not how does it work?

Here are brief details:

thanks for your input

Replies

FlorianDLW on Mon, 02 Jan 2017 12:38:18


Hi,

The output is a base64 string and can be found in "$content". I am not sure why it returns a base64 maybe someone else can help you with this.

You can use online tools to decode the base64 if you just want to check if the mapping went as expected.

If you want to work with the XML inside the workflow your best bet is to use the following code

xml(decodebase64(your base64 string here))

this will return the XML. If you want the JSON just put json(...) in front of it. 

I hope this helps, if you need to know more feel free to ask :)

-F

Koushik984 on Mon, 02 Jan 2017 14:28:07


Thanks indeed that was a base64 output from the XML transformer. 

xml decodebase64 part, did you mean with the code of the logicapp to update the input to the function?

"XmlToJson": {
                "inputs": {
                    "body": "xml(decodebase64(@body('Transform_XML')))",
                    "function": {
                        "id": "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/sites/{}/functions/XmlToJson"
                    }
                },
                "type": "Function"
            }

FlorianDLW on Mon, 02 Jan 2017 15:01:18


Hi,

If your function is expecting an XML input then you will have to decode the base64 string to XML and that is what my suggested code does or you can change the function itself to accept and decode the base64 before transforming it to JSON. 

You can find more information about this in workflow definition.

As a side note. If you use a function to transform XML to JSON please note that there is a conversion function inside LogicApps already.

Looking at your flow I would suggest you do the following:

Transform to XML and then skip the transform XMLtoJSON and use the following code in your next connector:

json(xml(decodebase64(@body('Transform_XML'))))

This should do the trick, if not let me know :) 

-F


Koushik984 on Mon, 02 Jan 2017 16:11:37


Thanks Florian, It was helpful.. minimized my effort in serializing to json in the function app.. although other complexity need to be handled.

@json(body('Transform_XML'))

simplified what I need

Regards

K