I'm trying to consume a SOAP Webservice, but the WSDL is kind of broken, so I have to do some customization to node-soap
.
The ideal SOAP Envelope that I would like to have would be this one:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<getImagesDefinition xmlns="http://services.example.com/"/>
</Body>
</Envelope>
So far this is the nodejs
code I have to invoke the 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 to set the endpoint manually because it is broken in the WSDL
file
The envelope I get when printing client.lastRequest
is 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 that if I can force the namespace prefix on the body to have <tns:getImagesDefinition />
instead of <getImagesDefinition />
the request works perfectly.
Is there any way for me to force it?
I read the documentation saying that tns
is a default ignored namespace, so I tried to change that by doing this:
var options = {
ignoredNamespaces: {
namespaces: [],
override: true
}
}
and sending that object to the soap.createClient
method, but I see no difference on the Envelope.
Is there anyway for me to force this? or get to the ideal SOAP Envelope?
Thanks!
See this thread discussing the same issue at github:
And especially https://github.com/vpulim/node-soap/issues/537#issuecomment-72041420