I came across this in my case too, because the answer was gzipped. The soap for the npm package indicates 'Accept-Encoding': 'none' , but the SOAP server (developed by my company) does not behave very well and sends the gzipped body back. Soap bag does not cope with this.
One of the alternatives I'm looking for is to pass my own httpclient into the options createClient parameter and unzip it. An example of using custom httpclient in tests for node-sap code on GitHub: https://github.com/vpulim/node-soap/blob/master/test/client-customHttp-test.js .
I have not yet decided how to unzip the answer again, but I will update this answer after developing it.
Update
For gzipped answers this is easier. You can pass any parameters that you want to call node request in the wsdl_options property of the createClient options object. This includes gzip: true , which will make request handle gzipped requests for you. eg.
soap.createClient('http://someservice.com/?wsdl', { wsdl_options: { gzip: true } }, function (err, client) {});
Then, when calling the SOAP method, add the gzip parameter to the parameter argument after your callback, for example.
client.someSoapCall({arg1:"12345"}, function (err, result) {}, { gzip: true });
I figured this out by digging into node soap code. The documents do not explicitly mention these things.
James mclachlan
source share