Skip to main content
March 22, 2024
Question

How to deal with Integration that does not return lisible reply

  • March 22, 2024
  • 8 replies
  • 0 views

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: <...



2/ In raw mode, the API response is like this (please see below). It contains XML not really practical, and there are a lot characters to escape.
How would you do to extract informations in a clean way (or to convert it in Json) ?

We've tried functions such a "tojson" but without satisfactory results. Of course using "extract" function works, but I'm looking for the best way to do it please.

 
	
	
		
			
				true
				
					
						
						
					
				
			
		
	
 

Regards

8 replies

davidj137213
March 22, 2024

You are receiving an XML but trying to use it as a json

March 22, 2024

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...

davidj137213
March 22, 2024

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))

)