node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

ReferenceError: WSDL is not defined

Open gastonmorixe opened this issue 14 years ago • 10 comments

This is my code

var  soap = require('soap')
   , http = require('http')

var smsApi = { 
    SmsApiService: { 
        MoSmsPort: { 
            smsMoSync: function (args) {
                return 'Thxs!!!';
            }
        }
    }
}

var xml = require('fs').readFileSync('/sites/texty/moSmsApi.wsdl', 'utf8');

var server = http.createServer(function(request,response) {
        response.end('404: Not Found: ' + request.url)
    });

server.listen(8000);
soap.listen(server, '/wsdl', smsApi, xml);

And I get this....

node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ ReferenceError: WSDL is not defined at Object.listen (/sites/texty/node_modules/soap/lib/soap.js:33:20) at Object. (/sites/texty/app.js:139:7) at Module._compile (module.js:432:26) at Object..js (module.js:450:10) at Module.load (module.js:351:31) at Function._load (module.js:310:12) at Array.0 (module.js:470:10) at EventEmitter._tickCallback (node.js:192:40) worker 5504 died

gastonmorixe avatar Dec 18 '11 15:12 gastonmorixe

@imd23 hey can u post the wsdl some where? I would love to replicate this issue...

Proful avatar Dec 20 '11 09:12 Proful

http://pastebin.com/BDpCY7N3

gastonmorixe avatar Dec 20 '11 18:12 gastonmorixe

I meet the same problem too.

kaven276 avatar Dec 28 '11 02:12 kaven276

In soap.js, add the var declare as below WSDL = require('./wsdl').WSDL; and It's ok. It's a base mistake.

kaven276 avatar Dec 28 '11 03:12 kaven276

great, now I get this

node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Cannot call method 'shift' of undefined at [object Object].processIncludes (/sites/texty/node_modules/soap/lib/wsdl.js:495:61) at Array.0 (/sites/texty/node_modules/soap/lib/wsdl.js:477:14) at EventEmitter._tickCallback (node.js:192:40) worker 22542 died

gastonmorixe avatar Dec 28 '11 05:12 gastonmorixe

The error occured at the wsdl paring step, so maybe your wsdl has error. I have not met the error.

kaven276 avatar Dec 31 '11 15:12 kaven276

It works perfectly with php soap class

gastonmorixe avatar Jan 13 '12 13:01 gastonmorixe

A workaround is to insert into WSDL.prototype.processIncludes (wsdl.js, line 495) a check for existence of includes:

var self = this,
uri = this.definitions && this.definitions.includes && this.definitions.includes.shift();

avrelian avatar Jan 28 '12 19:01 avrelian

fixed

milewise avatar Apr 30 '12 15:04 milewise

thx

gastonmorixe avatar Apr 30 '12 15:04 gastonmorixe