I am trying to use this package:
However, when I do this:
var soap = require('soap');
var url = '';
var args = {name: 'value'};
soap.createClient(url, function(err, client) {
client.MyFunction(args, function(err, result) {
console.log(result);
});
});
It returns back: "undefined".
My question is I don't understand when it says "args". Is it to do with the nodes in the WDSL?
The WSDL file is as follows:
<xsd:element name="getAllMarkets">
<xsd:plexType>
<xsd:sequence>
<xsd:element name="request" type="types:GetAllMarketsReq"/>
</xsd:sequence>
</xsd:plexType>
</xsd:element>
Please help. Thanks.
I am trying to use this package: https://github./milewise/node-soap
However, when I do this:
var soap = require('soap');
var url = 'http://example./wsdl?wsdl';
var args = {name: 'value'};
soap.createClient(url, function(err, client) {
client.MyFunction(args, function(err, result) {
console.log(result);
});
});
It returns back: "undefined".
My question is I don't understand when it says "args". Is it to do with the nodes in the WDSL?
The WSDL file is as follows:
<xsd:element name="getAllMarkets">
<xsd:plexType>
<xsd:sequence>
<xsd:element name="request" type="types:GetAllMarketsReq"/>
</xsd:sequence>
</xsd:plexType>
</xsd:element>
Please help. Thanks.
Share Improve this question asked Aug 12, 2011 at 10:19 RonRon 211 silver badge2 bronze badges 1- 1 I had to patch soap.js to get it to work with Betfair API but it's a very ugly hack. Hoping to see some nicer solutions here. – mak Commented Aug 12, 2011 at 10:31
3 Answers
Reset to default 3You are logging result
, which is probably undefined because there's an error, meaning the err
argument to your callback function IS defined and will have info for you. In this case since it looks like you're calling MyFunction
instead of getAllMarkets
, your error will probably be some sort of "Unknown Method" error. Do console.log(err, result);
and see what that prints out.
instead of this :
var args = {name: 'value'};
try this :
var args = {'tns:name': 'value'};
its worked for me.
try
var args = { request: { name: 'value' } };