Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs Soap api call returns "Unexpected root element of WSDL or include"

I am trying to access a web api using node-soap module, but every time i run the code i get following error "Unexpected root element of WSDL or include"

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);
});
like image 309
Taral Patoliya Avatar asked May 10 '16 09:05

Taral Patoliya


1 Answers

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

So do following:

  1. Check if you can access the WSDL on following URL: https://webservice.servcei.com/LoginXML?wsdl. If not, find the correct location of WSDL file
  2. Check the service host is specified in WSDL xml. If not use "endpoint" parameter of createClient to point to real SOAP service.
like image 150
Emil Alkalay Avatar answered Oct 24 '22 06:10

Emil Alkalay