Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  63] [ 5]  / answers: 1 / hits: 18653  / 11 Years ago, mon, april 15, 2013, 12:00:00

I am just getting started with NodeJS and I digging into talking to a SOAP service using milewise's node-soap. I am using a basic email address validation SOAP API as my test case.



I don't seem to understand the correct way to format my arguments lists.



My SOAP client code:



    var url = http://www.restfulwebservices.net/wcf/EmailValidationService.svc?wsdl;
soap.createClient(url, function(err, client){
console.log(client.describe().EmailValidationService.BasicHttpBinding_IEmailValidationService.Validate);
client.Validate({result:[email protected]}, function(err, result){
console.log(result);
});
});


The client.describe() command tells me how the API would like its input formatted, and how it will return its output. This is what is says:



{ input: { 'request[]': 'xs:string' },
output: { 'ValidateResult[]': 'xs:boolean' } }



However when I send the arguments as an object: {request:[email protected]}



I feel like my problems lies in how I am defining the arguments object...what do the brackets in request[] mean?


More From » node.js

 Answers
36

It should work, if you add namespace on request argument.
This is a sample code.



var soap = require('soap');

var url = http://www.restfulwebservices.net/wcf/EmailValidationService.svc?wsdl;

var args = {tns:request:[email protected]};

soap.createClient(url, function(err, client){
client.EmailValidationService.BasicHttpBinding_IEmailValidationService.Validate(args, function(err, result){
if (err) throw err;
console.log(result);
});
});


However, it returns Access is denied.



I use soapUI to test this web service, it returns the same result.



I try another web service, and it works.



var soap = require('soap');

var url = http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl;

var args = {tns:request:GOOG};

soap.createClient(url, function(err, client){

client.StockQuoteService.BasicHttpBinding_IStockQuoteService.GetStockQuote(args, function(err, result){
if (err) throw err;
console.log(result);
});
});

[#78908] Saturday, April 13, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
christianu

Total Points: 481
Total Questions: 124
Total Answers: 99

Location: Trinidad and Tobago
Member since Thu, Dec 1, 2022
2 Years ago
christianu questions
;