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

"H E L P" Error: Cannot parse response

Open Hamatek opened this issue 11 years ago • 9 comments

Hello,

I have been trying to work my way with Meteor-soap/node-soap for hourssss but I wasn't able to figure out why every time I call a method I get : Error: Cannot parse response .

When create Client without any options : Soap.createClient(url) It seems the to be working properly since client.describe() return all the method of my WSDL

to call my method I use this syntax Client.service.port.method(args)

Also I know that the SOAP Webservice works fine because I have it run in production on a PHP website and I use tool like SOAPUI 5, they both work perfectly without any special options.

What might be wrong is that maybe I may be missing some options ? When I create client or call method ? OR Maybe it's something related to the client.service.port.method syntax rather than just client.MyFunction(args) ? ...

I really am clueless about how to debug this soap response issue, any help would be greatly appreciated !

Hamatek avatar Aug 19 '15 12:08 Hamatek

same thing here. I end up with empty body in HttpClient.prototype.handleResponse I might be doing something terribly wrong, but I do not know, what exaclty..

If I feed the request constructed by node-soap to SoapUI, I get response perfectly. I think, it's something to do with http module of node-soap..

aol-nnov avatar Sep 30 '15 07:09 aol-nnov

@jsdevel sorry for disturbing you, but could you shed some light on it? thanks in advice!

aol-nnov avatar Sep 30 '15 07:09 aol-nnov

@aol-nnov I fixed my issue, in my case node-soap was adding the same namespace 150 times to my xml envelope's header ... this kind of behavior doesn't seems necessary so i fixed it in the WSDL.prototype._xmlnsMap = function(). Also when I pass my args to the client I manually specify the datacontract namespace because node-soap doesn't do it. for example I append "q1" to number

args= { p:{"q1:Number":"123456"}

I hope my case helps,

Cheers

Hamatek avatar Sep 30 '15 07:09 Hamatek

No, unfortunately, it does not help me.. I've also noticed that same namespace is added multiple times (with different prefixes), but it does not interfere. I get raw request constructed by node-soap

client.on('request', function (xml) {
                console.log('req xml', xml);
});

And then copy it over to SoapUI without any modifications. And it works there like a charm.. body in handleResponse Is empty though... Weird..

aol-nnov avatar Sep 30 '15 08:09 aol-nnov

I've made it finally. It mainly fails due to wrong content-type header and namespace as I'm consuming a soap 1.2 service. It is somewhat related to PR #721, but my fixes are different I've tried the fix from aforementioned PR, but it does not work for me.

aol-nnov avatar Sep 30 '15 11:09 aol-nnov

@aol-nnov a pull request to fix this would be greatly appreciated.

jsdevel avatar Sep 30 '15 17:09 jsdevel

@jsdevel I'm not sure if it will be back compatible with 1.1 spec. I'm not that familiar with SOAP, unfortunately. But I can make a PR if you'd like to.

aol-nnov avatar Sep 30 '15 17:09 aol-nnov

@aol-nnov if you can provide a request-response-sample as a test, then backcompat will be ensured.

jsdevel avatar Sep 30 '15 20:09 jsdevel

i use the new version 0.10.1, also have this issue: the xml content return in the request event can get right xml response in SoapUI, but return 'Error: Cannot parse response' in this lib's Client.service.port.method and change the content-type and content-length can fix it. can u give me more adivse? @jsdevel

ChopperLee2011 avatar Oct 23 '15 05:10 ChopperLee2011