5

I am having some problems with easysoap (https://npmjs.org/package/easysoap) and I have been unable to find much documentation or people talking about it, so I hope some of you can help:

I’m making a simple call like this:

            var clientParams = {
                           host    : 'somewhere.com',
                           port    : '9001',
                           path    : '/somews.asmx',
                           wsdl    : '/somews.asmx?WSDL'
            };

            var clientOptions = {
                           secure : false 
            };

            //create new soap client
            var SoapClient = new soap.Client(clientParams, clientOptions);
            SoapClient.once('initialized', function() {

                           //successful initialized
                           SoapClient.once('soapMethod', function(data, header) {
                           });

                           console.log('call');

                           SoapClient.call({
                                           'method' : 'Execute',
                                           'params' : {
                                                           'ExecuteXML' : 1
                                           }}, function(attrs, err, responseArray, header){
                                           }
                           );
            });

            //initialize soap client
            SoapClient.init();  

The problem Is that I get a response saying that I am not authorized to make my request.However if I manually try the same url in the browser http://somewhere.com:9001/somews.asmx it does work.

Do you know what am I doing wrong?

Many many thanks in advance.

If any of you know of any other node module to achieve this please let me know. I attempted to use node-soap but got lost in all the dependencies required: python, Visual Studio... you really need all that to make a couple of soap calls to a server???

Thanks

Rafa Llorente
  • 447
  • 2
  • 8
  • 18

2 Answers2

5

For other nodejs soap modules. I currently use node-soap and am happy with it. You can find the project here.

Here is an example of how I'm using it.

var soap = require('soap');
//example url
var url = 'http://ws.strikeiron.com/GlobalAddressVerification5?WSDL';

var soapHeader = ''//xml string for header


soap.createClient(url, function(err, client){
  client.addSoapHeader(soapHeader);

  var args = {
    StreetAddressLines: "5322 Otter Lane",
    CountrySpecificLocalityLine: "Middleberge FL 32068",
    Country: "USA"
  };

  client.BasicVerify(args, function(err, result){
   if(err){
     throw err;
   }
   console.log(result);
  });
});
BenDavidJamin
  • 169
  • 1
  • 10
0

For me this worked:

    "use strict";

    var easysoap = require('easysoap');
    var clientParams = {
                   host    : 'http://somewhere.com:9001',
                   path    : '/somews.asmx',
                   wsdl    : '/somews.asmx?WSDL'
    };

    var clientOptions = {
                   secure : false 
    };

    var soapClient = easysoap.createClient(clientParams, clientOptions);

    soapClient.call({'method' : 'Execute',
                     'params' : {
                                  'ExecuteXML' : 1
                    }})
    .then(function (callResponse) {
            console.log(callResponse);
        })
    .catch(function (err) {
        console.log("Got an error making SOAP call: ", err);
    });
Community
  • 1
  • 1
sxm1972
  • 722
  • 8
  • 15