2

I'm using node-soap to communicate with web services, but i can't get it to work.

The code as it is below throws the error ECONNREFUSED. But if i don't put the args variable in the function I get a response. Does anyone know what can it be?

var soap = require('soap');
var wsdl, url;
var args = {cargoSn: 'MSWU0031179'};
soap.createClient(url, function(err, client) {
  //console.log('client');
  console.log(client.describe().TransportWebService.TransportWebServiceSoap.GetContainerPosition);

  client.GetContainerPosition(args, function(err, result) {
    console.log('err');
    console.log(err);
    console.log('result');
    console.log(result);
  }, {
    proxy: "http://127.0.0.1:8888",
    strictSSL: false
  });

  console.log(client.lastRequest);

}, url);

This is what i get when running the code from above:

err
{ [Error: connect ECONNREFUSED]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect' }
result
undefined

And this is what I get when calling it without arguments:

client.GetContainerPosition(function(err, result) { ...

err
null
result
{ GetContainerPositionResult: '{"Status":"ERROR","Description":"Nothing found with serial number: ","Data":null}' }

So, it works when no arguments are passed (and obviously finds nothing), but gives an error when they are.

peporro
  • 83
  • 7

0 Answers0