Nodejs Soap api call returns "Unexpected WSDL root element or includes"

I try to access the web api using the node-soap module, but every time I run the code, I get the following error: "Unexpected root element of WSDL or including"

var soap = require('soap'); var xml2js = require('xml2js'); var url = 'https://webservice.servcei.com/LoginXML'; var params = { Username:'webservice', Password:'Test123' }; soap.createClient(url,params,function(err,client){ console.log(err); }); 
+7
soap web-services
source share
1 answer

The url variable should point to the WSDL, not the web service. By convention, the WSDL should be located at the following URL: https://webservice.servcei.com/LoginXML?wsdl

So, follow these steps:

  • Check if you can access the WSDL at the following URL: https://webservice.servcei.com/LoginXML?wsdl . If not, find the correct location for the WSDL file
  • Verify that the service host is listed in the WSDL xml. If you do not use the createClient endpoint parameter to point to the actual SOAP service.
+4
source share

All Articles