I'm trying to consume a WSDL with node-soap. I use it as follows in my controller:
this.getSoap = function (request, response) {
var soap = require('node-soap');
var url = 'http://identificacion.uci.cu/servicios/v5/servicios.php';
var args = { IdExpediente: '016381' };
soap.createClient(url, function (err, client) {
client.ObtenerFotoDadoIdExpediente(args, function (err, result) {
if (err) {
throw err
client.describe();
} else
console.log(result);
});
});
return response.render('index', {
variable: 'valor'
});
};
And when I call I get this response in the browser:
Object function SOAPClient(options, fn) { fn = this.fn = fn; options = this.options = _.extend({}, defaults, options); var deferred; this.namespaces = ''; this.methods = ''; this.body = function (options) { return "" + "http://schemas.xmlsoap.org/soap/envelope\/\" " + "xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" " + "xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\" " + options.namespaces + ">" + "" + options.methods + "" + ''; }; this.newRequest(); return this; } has no method 'createClient'
TypeError: Object function SOAPClient(options, fn) {
fn = this.fn = fn;
options = this.options = _.extend({}, defaults, options);
var deferred;
this.namespaces = '';
this.methods = '';
this.body = function (options) {
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<SOAP-ENV:Envelope " +
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope\/\" " +
"xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" " +
"xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\" " +
options.namespaces +
">" +
"<SOAP-ENV:Body>" +
options.methods +
"</SOAP-ENV:Body>" +
'</SOAP-ENV:Envelope>';
};
this.newRequest();
return this;
} has no method 'createClient'
at Object.getSoap (/home/heimdall/Proyectos/myNODE/src/SoapModule /controller/soapController.js:19:10)
at module.exports (/home/heimdall/Proyectos/myNODE/src/SoapModule/resources/config/routing.js:16:20)
at Layer.handle [as handle_request] (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/layer.js:82:5)
at next (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/route.js:110:13)
at Route.dispatch (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/route.js:91:3)
at Layer.handle [as handle_request] (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/layer.js:82:5)
at /home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/index.js:267:22
at Function.proto.process_params (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/index.js:321:12)
at next (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/router/index.js:261:10)
at expressInit (/home/heimdall/Proyectos/myNODE/node_modules/express/lib/middleware/init.js:23:5)
I use this documentation: Github project
Now my file look that:
var soap = require('soap');
// url del wsdl
this.getSoap = function (request, response) {
var url = 'http://identificacion.uci.cu/servicios/v5/servicios.php';
var args = { IdExpediente: '016381' };
soap.createClient(url, function (err, client) {
if (err) {
console.log(err);
} else {
client.ObtenerFotoDadoIdExpediente(args, function (err, result) {
if (err) {
throw err
client.describe();
} else
console.log(result);
});
}
});
And obtain this in my server:
Cannot set property 'descriptions' of null