I am having a problem parsing a soap service output, i am trying to apply
a! fromJson ( xmltojson ( local!result ) )
Until applying the xmltojson I have the data that does it to me:
But when I apply the a! FromToJson the value is no longer mapped
I have tried to do this since I really need to map not only this data but all that the service returns to me it would return:
a!fromJson( xmltojson( substitute(local!a.body,"<NIF>","<NIF>@") ) )
Although then I would have to delete that @
Do you know if it could be done in a cleaner way?
A greeting and thanks in advance.
Discussion posts and replies are publicly visible
Is there a reason you are casting to JSON and then from JSON to a dictionary? There is a function called torecord() that casts directly from XML to a Custom Data Type that is better because it eliminates a step and provides the type you are casting to.
The other thing to look at - that number is too large for an integer in Appian. The max length of an integer is 2^32 - 1, which is only 11 digits. If you want to get that value, you must cast to text (which again the torecord() function will help with because you can specify the CDT fields to use).
What the service returns is a string (xml format) and inside there are several structures including a list which is the one that I have to map. I have created a cdt that has the fields of the list to map I have put it in the rule as input that list but it does not map anything.
I would expect it to look something like this:
Also if the response contains a lot of nested XML, you might have to use xpathsnippet() to get to the part you need. Can you provide some sample XML and the code you used to try and do the conversion?
Good morning Peter,
I need to map the address part.
This is the CDT:
The code and the output:
"<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="">schemas.xmlsoap.org/.../" xmlns:SOAP-ENC="">schemas.xmlsoap.org/.../" xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance">
Have you tried just with index()?
For example: index(a!fromJson(local!a.body),"NIF",null)
I use something similar for my API, works well and it easy to read
Try what you tell me but it doesn't work for me:
Try this too and nothing
I keep testing.
© 2020 Appian. All rights reserved.