doedje / jquery.soap

This script uses $.ajax to send a SOAP:Envelope. It can take XML DOM, XML string or JSON as input and the response can be returned as either XML DOM, XML string or JSON too.
352 stars 148 forks source link

toJSON() receives wrong structure #42

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hi, great plugin. really loved it.

Now when I tried using .toJSON() xml2json returns an error at line 109: Uncaught TypeError: Cannot read property 'length' of undefined

I believe it is because of line 365 in your plugin which returns: return $.xml2json(this.content); The structure of the data sent is: #document.<soap:envelope>...

I fixed this by replacing line 365 by: return $.xml2json(this.content.documentElement.outerHTML);

Is it something wrong with my SOAP sent?

doedje commented 10 years ago

I am not quite sure if there is something wrong with your SOAP being sent. I have tried toJSON with the original code and with your replacements and both seem to be working fine... I don't know, maybe there is a difference in which xml2json plugin you are using.... The one I use is:

http://www.fyneworks.com/jquery/xml-to-json/

doedje commented 10 years ago

can I close this issue?

ghost commented 10 years ago

yeah mate

Romain Gonçalvès @ Santech

On Mon, Mar 10, 2014 at 4:05 PM, Remy Blom notifications@github.com wrote:

can I close this issue?

Reply to this email directly or view it on GitHubhttps://github.com/doedje/jquery.soap/issues/42#issuecomment-37191961 .