How to transform soap response in json

Hello everyone,

i use a http node to request an external tool. It works ok, as i have a 200 ok response and this data returned :


[
{
"xml": 
"<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getEventsResponse xmlns:ns2="http://ws.ppppp.com/v6/businessEvent"><return><resultCode>0</resultCode><entities><annotations><author>[email protected]</author><date>2024-02-02T18:08:31.497+01:00</date><note>ok</note><type>NOTE</type></annotations><annotations><author>[email protected]</author><date>2024-02-02T17:59:06.636+01:00</date><note>TEST note déjà existante</note><type>NOTE</type></annotations><completionData><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>INFO_G</id><value>Informations générales</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>BDC_EXIGE</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>PLANIFICATEUR1</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>CDCLI2</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>OFFRE</id><value>Oabc V3</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>SUNSET2G</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>CONDI_INSTALL</id><value>Conditions d'installation</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>TYPE_INSTALLATION1</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>NOMBRE_BOITIER</id><value>3</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>NOM_CONTACT_SITE</id><value>E</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>NUM_CONTACT_SITE</id><value>3333</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>LOGISTIQUE</id><value>Logistique</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>NUM_EXPEDITION</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>PARAMETRAGE</id><value>Paramétrage</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>CREA_BASE</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>CREA_ACCES_ACCROCHAGE</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>SAVFACTURABLE</id><value></value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>INTER_REAL2</id><value>Oui</value></fields><fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:reportField"><id>POURQUOI2</id></fields>(etc....)</return></ns2:getEventsResponse></soap:Body></soap:Envelope>"
}
]

But i would like to get a json…
How could i transform this response in a json ?

Information on your n8n setup

n8n version: cloud version with 1.44.1**

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @alang

What do you get when you use the XML to JSON node?

I have tried the node xml2json, but i got this error :

Item has no JSON property called "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getEventsResponse xmlns:ns2="http://ws.ppppp.com/v6/businessEvent"><return><resultCode>0</resultCode><entities><annotations><author>[email protected]</author><date>2024-02-02T18:08:31.497+01:00</date><note>ok</note
(.....)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.