-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing response with promise #49
Comments
It took me a while to get my mind wrapped around this one, but I do understand now...
Hope this helps... |
Thanks @doedje, This is what i'm doing now to get SOAP result as JSON
Very ugly, specially when I make multiple calls of firstChild to get the response ... |
You could also use jquery to parse the XML.
You could do like this:
In your case:
Just to let you know! Good luck with coding! |
This is old, but looking at how SoapResponse does it, it's using the xhr response instead of data, not sure if that makes any difference var SOAPResponse = function(status, xhr) {
this.typeOf = "SOAPResponse";
this.status = status;
this.headers = xhr.getAllResponseHeaders().split('\n');
this.httpCode = xhr.status;
this.httpText = xhr.statusText;
this.content = (xhr.responseXML === undefined) ? xhr.responseText : xhr.responseXML;
this.toString = function(){
if (typeof this.content === 'string') {
return this.content;
}
if ($.isXMLDoc(this.content)) {
return SOAPTool.dom2string(this.content);
}
throw new Error("Unexpected Content: " + $.type(this.content));
};
this.toXML = function(){
if ($.isXMLDoc(this.content)) {
return this.content;
}
return $.parseXML(this.content);
};
this.toJSON = function(){
if ($.xml2json) {
return $.xml2json(this.content);
}
warn("jQuery.soap: Missing JQuery Plugin 'xml2json'");
};
}; |
the difference is this: you can either use the
the OP of this issue wanted to use the Promise returned by
Hope that clears the confusion a bit.... |
I think you misunderstood. I was referring to the difference between: $.xml2json(data); vs var content = (xhr.responseXML === undefined) ? xhr.responseText : xhr.responseXML;
$.xml2json(content); |
Ah I see, I misunderstood indeed, I thought your question was somehow related to this issue, but if it does I don't understand how... But the difference is unclear to me. $.soap is open source project with a handful of people collaborating to it in the past years. This got introduced at some point around the 0.10.0 version by Zach if I recall this correctly, I hope it was for the best.... =] |
first of all, thanks for this very useful lib.
I'm using it with angularJS so my soap service returns a promise to controller.
How can i parse response in done status
This is service
And controller
Error SOAPResponse is undefined
The text was updated successfully, but these errors were encountered: