node-soap example

14,754 views
Skip to first unread message

Venkat OV

unread,
Sep 28, 2011, 6:59:55 AM9/28/11
to nodejs
Hi to all, 

I am very new to node and javascript. 

I am trying to figure it out how to use node-soap as a client.

the following example code I am using to get the result. 

I have installed node-soap and try to test it 

    var soap = require('./index');
    var args = {symbol: 'DOX'};
    soap.createClient(url, function(err, client) {
        client.MyFunction(args, function(err, result) {
        console.log(result);
        });

    });

I am getting following error 

TypeError: Object [object Object] has no method 'MyFunction'

In my understanding, I need to create MyFunction method inside Client.js file no luch :(  

In the document also there is no working demo. 

Since, I am new to this platform , it would be great if anyone help me to figure it out . 




Regards,
Venkat. 


--
*Disclaimer*
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Hexolabs Media and Technology Pvt. Ltd. has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Hexolabs Media and Technology Pvt. Ltd. reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Hexolabs Media and Technology Pvt. Ltd. e-mail system.
*End of Disclaimer*

mscdex

unread,
Sep 28, 2011, 5:57:32 PM9/28/11
to nodejs
On Sep 28, 6:59 am, Venkat OV <ven...@hexolabs.com> wrote:
> TypeError: Object [object Object] has no method 'MyFunction'

MyFunction is the name of a function defined by the remote SOAP
service.

You can use .describe() to see what methods are available:

soap.createClient(url, function(err, client) {
if (err) throw err;
client.describe();
});

Venkat OV

unread,
Sep 29, 2011, 12:14:36 AM9/29/11
to nod...@googlegroups.com
Hi mscdex,

Thanks for your reply.

Here is the output of client.describe()

{ StockQuote:
   { StockQuoteSoap: { GetQuote: [Object] },
     StockQuoteSoap12: { GetQuote: [Object] } } }

Then, I tried the following tied to get the result and still no luck



    var soap = require('./index');
    var url = 'http://www.webservicex.net/stockquote.asmx?WSDL';
    var args = {symbol: 'DOX'};
    soap.createClient(url, function(err, client) {
        client.StockQuote(args, function(err, result) {
        console.log(result);
        });
    });

TypeError: Property 'StockQuote' of object [object Object] is not a function

    var soap = require('./index');
    var url = 'http://www.webservicex.net/stockquote.asmx?WSDL';
    var args = {symbol: 'DOX'};
    soap.createClient(url, function(err, client) {
        client.StockQuoteSoap(args, function(err, result) {
        console.log(result);
        });
    });


TypeError: Object [object Object] has no method 'StockQuoteSoap'



    var soap = require('./index');
    var url = 'http://www.webservicex.net/stockquote.asmx?WSDL';
    var args = {symbol: 'DOX'};
    soap.createClient(url, function(err, client) {
        client.GetQuote(args, function(err, result) {
        console.log(result);
        });
    });


undefined



Regards,
Venkat.


--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

mscdex

unread,
Sep 29, 2011, 2:04:26 AM9/29/11
to nodejs
On Sep 29, 12:14 am, Venkat OV <ven...@hexolabs.com> wrote:
> Here is the output of client.describe()
> [...]

According to the node-soap docs, you may have to do it this way:

client.StockQuote.StockQuoteSoap.GetQuote(args, function(err, result)
{
console.log(result);
});

Venkat OV

unread,
Sep 29, 2011, 2:50:44 AM9/29/11
to nod...@googlegroups.com
Thanks for quick reply try and let u know.


Regards,
Venkat.



});

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Sudipto Dutta

unread,
Mar 26, 2013, 2:01:43 AM3/26/13
to nod...@googlegroups.com

Hello

I'm using the node-soap module created by milewise (and it seems great!). However, I have a requirement to provide multiple services based on different WSDLs. Is this possible with node-soap on the same sever:port? or do I need to combine the services into a single WSDL or perhaps run multiple services on separate node instances (I guess each on a separate port) and front that with a proxy?

Any ideas or assistance would be much appreciated.

Thanks!


farzana mustafa

unread,
Jan 21, 2018, 11:50:01 AM1/21/18
to nodejs

Hi,

I am new to node.js and am learning how to consume soap based asmx webservice in node.js.

The above mentioned example is working fine for me.
In the similar line i  tried for my webservice just by Creating the client and printing the client, it gives the value as undefined.
soap.createClient(url, function(err, client) {
console.log(client);
});



 When trying to access the methods from the client, it throws error cannot find the property 'xxx' of undefined.
Any idea why my soap client is not getting created.
Is there any authentication that needs to be provided. When i try to access the same webservice with Credentials in .Net it is working fine. Please some one help on this as I am clueless on how to proceed further.

Muhammad Wasim

unread,
Jan 21, 2018, 2:01:30 PM1/21/18
to nod...@googlegroups.com
You have to check for 'err' object. It must have the reason of undefined client.

You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/bb8066a9-7750-4718-8923-d8aeda0842a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

fm

unread,
Jan 22, 2018, 5:09:39 AM1/22/18
to nodejs
Hi,

I was now able to create the client and list all the functions in the webservice.
When trying to invoke the method now i get the different error. I am not creatting a soap server.. I want to consume a soap client.
The error is

Error: soap:Server: Value cannot be null.
Parameter name: input
    at finish (C:\Users\Documents\Node\DBConnectnode\node_modules\soap\lib\wsdl.js:1518:21)
    at WSDL.xmlToObject (C:\Users\Documents\Node\DBConnectnode\node_modules\soap\lib\wsdl.js:1501:10)
    at parseSync (C:\Users\Documents\Node\DBConnectnode\node_modules\soap\lib\client.js:368:23)
    at C:\Users\mfarzana\Documents\Node\DBConnectnode\node_modules\soap\lib\client.js:361:14
    at Request._callback (C:\Users\Documents\Node\DBConnectnode\node_modules\soap\lib\http.js:117:5)
    at Request.self.callback (C:\Users\Documents\Node\DBConnectnode\node_modules\request\request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (C:\Users\\Documents\Node\DBConnectnode\node_modules\request\request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (C:\Users\Documents\Node\DBConnectnode\node_modules\request\request.js:1085:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
Please help on this.

On Monday, 22 January 2018 00:31:30 UTC+5:30, Muhammad Wasim wrote:
You have to check for 'err' object. It must have the reason of undefined client.
On 21 Jan 2018 9:49 p.m., "farzana mustafa" <farza...@gmail.com> wrote:

Hi,

I am new to node.js and am learning how to consume soap based asmx webservice in node.js.

The above mentioned example is working fine for me.
In the similar line i  tried for my webservice just by Creating the client and printing the client, it gives the value as undefined.
soap.createClient(url, function(err, client) {
console.log(client);
});



 When trying to access the methods from the client, it throws error cannot find the property 'xxx' of undefined.
Any idea why my soap client is not getting created.
Is there any authentication that needs to be provided. When i try to access the same webservice with Credentials in .Net it is working fine. Please some one help on this as I am clueless on how to proceed further.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages