Hi,I'm calling an external Integration which works fine, but when I try to set the "Convert JSON to Appian value" option, the Integration returns the error below.1/ How would you do to deal with that error ? do I have no other choice to deal with the raw response ?(it is an old API, and we can not ask any update)
error-result-guidance The response body could not be converted to an Appian value The jsonText parameter was not valid JSON. Received: <...
<?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='http://ldap.xxxxxx.fr/LdapWS/client/'> <SOAP-ENV:Body> <ns1:listeUsersResponse> <response> <demandeRecue>true</demandeRecue> <xml><?xml version='1.0' encoding='UTF-8'?> <data> <listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DUPONT]]></nom><prenom><![CDATA[Nicolas]]></prenom><color><![CDATA[Red]]></color><size><![CDATA[10]]></size></listeUsers> <listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DURAND]]></nom><prenom><![CDATA[Pauline]]></prenom><color><![CDATA[blue]]></color><size><![CDATA[15]]></size></listeUsers> </data> </xml> </response> </ns1:listeUsersResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Discussion posts and replies are publicly visible
You are receiving an XML but trying to use it as a json
Yes of course, as I wrote, it is some XML data, but not very practical...How would you parse it for an Appian using ?Would you convert it first to Json ? (and then to a CDT)or directly from XML to CDT ?The goal is to to be able to using it with Appian objects...
The problem is that the xml is not correct. The end tag of the first list listeUsers elements is incorrect.
IN your xml is written as listeUser, and it should be listeUsers...
Once changed, works fine
a!localVariables( local!xml: "<?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='schemas.xmlsoap.org/.../' xmlns:ns1='ldap.xxxxxx.fr/.../'><SOAP-ENV:Body><ns1:listeUsersResponse><response><demandeRecue>true</demandeRecue><xml><?xml version='1.0' encoding='UTF-8'?><data><listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DUPONT]]></nom><prenom><![CDATA[Nicolas]]></prenom><color><![CDATA[Red]]></color><size><![CDATA[10]]></size></listeUsers><listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DURAND]]></nom><prenom><![CDATA[Pauline]]></prenom><color><![CDATA[blue]]></color><size><![CDATA[15]]></size></listeUsers></data></xml></response></ns1:listeUsersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>", (xmltojson(local!xml)) )
Sorry, I made a typing error in this post (I've corrected it above addind the missing "s").My unexpected issue is that the forum code snippet has formatted my XML flow correctly, but I did not want this, to be able to explain you my problem ;-)My real flow is this one below.Could you tell me how to convert all these tags : <data> to this <data> please ?if I use striphtml() function, then it breaks the XML, and I can not make the Json conversion afterwards.----<?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='schemas.xmlsoap.org/.../' xmlns:ns1='ldap.xxxxxx.fr/.../'> <SOAP-ENV:Body> <ns1:listeUsersResponse> <response> <demandeRecue>true</demandeRecue> <xml><?xml version='1.0' encoding='UTF-8'?> <data> <listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DUPONT]]></nom><prenom><![CDATA[Nicolas]]></prenom><color><![CDATA[Red]]></color><size><![CDATA[10]]></size></listeUsers> <listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DURAND]]></nom><prenom><![CDATA[Pauline]]></prenom><color><![CDATA[blue]]></color><size><![CDATA[15]]></size></listeUsers> </data> </xml> </response> </ns1:listeUsersResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>----
and thank you for the "xmltojson" function, I understand I do not have such a function because it comes from a plugin.
Use this
a!localVariables(
local!xml: "<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='schemas.xmlsoap.org/.../' xmlns:ns1='ldap.xxxxxx.fr/.../'><SOAP-ENV:Body><ns1:listeUsersResponse><response><demandeRecue>true</demandeRecue><xml><?xml version='1.0' encoding='UTF-8'?><data><listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DUPONT]]></nom><prenom><![CDATA[Nicolas]]></prenom><color><![CDATA[Red]]></color><size><![CDATA[10]]></size></listeUsers><listeUsers><titre><![CDATA[M.]]></titre><nom><![CDATA[DURAND]]></nom><prenom><![CDATA[Pauline]]></prenom><color><![CDATA[blue]]></color><size><![CDATA[15]]></size></listeUsers></data></xml></response></ns1:listeUsersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>",
substitute(substitute(local!xml, "<", "<"), ">", ">")
)
yes, it is what I have already did :-) (like with extract or substitute)but I was looking for a real Appian function that converts all automatically... but I suppose it does not exist...
No , there is no function that makes that conversion automatically..... you can use substitute, extract, or regular expressions...
ok, thanks a lot for your help.I will install the "xmltojson" plugin, this is the function I was missing...