Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Getting a error when parsing SOAP API response a [XOP/XML] using nodejs or javascript (https://www.warriorforum.com/programming/1318655-getting-error-when-parsing-soap-api-response-xop-xml-using-nodejs-javascript.html)

patidarkishor777 5th December 2017 08:00 AM

Getting a error when parsing SOAP API response a [XOP/XML] using nodejs or javascript
 
I am calling a SOAP API using a node js request api calling successfully and returning a response in a XOP/XML format.

Here is my response

--MIMEBoundary_e6fff532a5484248aea750d25d37bcec820c7 e0a3338bc30
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.f6fff532a5484248aea750d25d37bcec820c7e0a3338bc3 0@apache.org>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:listContactsResponse xmlns:ns="http://wrappers.webservice.appservices.core.inteqnet.com" ><ns:return xmlns:ax226="http://beans.webservice.components.inteqnet.com/xsd" xmlns:ax224="http://beans.webservice.appservices.core.inteqnet.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax226:DefaultServiceResponse"><ax226:err ors></ax226:errors><ax226:notes></ax226:notes><ax226:resourceName></ax226:resourceName><ax226:responseBean xsi:type="ax226:Bean"/><ax226:responseFormat>JSON</ax226:responseFormat><ax226:responseStatus>OK</ax226:responseStatus><ax226:responseText>[

{
"Email": "testca@test.com",
"Full Name": "CA, tobedeleted EndUser3",
"ID": "84",
"Job Title": "Self Service",
"Phone Details": "Business",
"Phone Number": "284335"
},
{
"Email": "testca@test.com",
"Full Name": "CA, tobedeleted EndUser4",
"ID": "85",
"Job Title": "Self Service",
"Phone Details": "Business",
"Phone Number": "284336"
},
{
"Email": "testca@test.com",
"Full Name": "CA, tobedeleted EndUser5",
"ID": "86",
"Job Title": "Self Service",
"Phone Details": "Business",
"Phone Number": "284337"
},


]</ax226:responseText><ax226:statusCode>000</ax226:statusCode><ax226:statusMessage>Success: The request was successfully fulfilled by the server; the service returned results of the operation.</ax226:statusMessage><ax226:warnings></ax226:warnings></ns:return></ns:listContactsResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundary_e6fff532a5484248aea750d25d37bcec820c7 e0a3338bc30--



In the response you can see some headers are in a response so when I parsing a this response usning a xml2json node library it returning a invalid xml input. This is because of the response is not in a xml format, it is in binary xop/xml.

I have tried a lot but unable to find a solution.

Can someone please have a look into this and provide me a solution how I can parse this response. I want this solution in a node js or a javascript.

Thanks in advance!

Kishore

codexmonkey 12th December 2017 08:04 AM

RE: Getting a error when parsing SOAP API response a [XOP/XML] using nodejs or javascript
 
Hi Kishore. I think you probably want a better library that can do more of the work for you instead of plain xml parsing. Have you considered trying something like this npm package?


All times are GMT -6. The time now is 02:40 AM.