12

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);
});
3
  • related question
    – stuartd
    May 10, 2016 at 10:14
  • I checked that question but could not comprehend anything, also i am not aware if the given response is returned from the web service or from soap module? May 10, 2016 at 10:18
  • Use a network capture tool like Fiddler or Wireshark to a) see exactly what you are sending and b) see exactly what you are receiving.
    – stuartd
    May 10, 2016 at 10:20

1 Answer 1

14

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.