node.js - How can I force namespace prefix usage? -
i'm trying consume soap webservice, wsdl kind of broken, have customization node-soap
.
the ideal soap envelope have one:
<envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <body> <getimagesdefinition xmlns="http://services.example.com/"/> </body> </envelope>
so far nodejs
code have invoke service:
var soap = require('soap'); var url = 'http://www.example.com/services/imagesizes?wsdl'; soap.createclient(url, function(err, client) { client.setendpoint('http://www.example.com/services/imagesizes'); client.getimagesdefinition(null, function(err, result) { console.log(result); }); console.log(client.lastrequest) });
i had set endpoint manually because broken in wsdl
file
the envelope when printing client.lastrequest
this:
<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tns="http://services.example.com/"> <soap:body> <getimagesdefinition /> </soap:body> </soap:envelope>
i know if can force namespace prefix on body have <tns:getimagesdefinition />
instead of <getimagesdefinition />
request works perfectly.
is there way me force it?
i read documentation saying tns
default ignored namespace, tried change doing this:
var options = { ignorednamespaces: { namespaces: [], override: true } }
and sending object soap.createclient
method, see no difference on envelope.
is there anyway me force this? or ideal soap envelope?
thanks!
i ran exact problem , me, fix override ignorednamespaces - remove 'tns' ignored namespace.
var options = { ignorednamespaces: { namespaces: ['targetnamespace', 'typednamespace'], override: true } }
i'm not sure why didn't work you, maybe there bug in library has since been fixed. or maybe because didn't include namespaces, rather empty array.
Comments
Post a Comment