-   Programming (
-   -   PhoneGap/Android - requestXML is null (

eantoranz 04-26-2012 03:13 PM

PhoneGap/Android - requestXML is null

I just developed a veeeeery simple application that uses SOAP. The js soap librery is here:

Now, I had to do some small changes to the implementation cause I think it was a little broken.

Anyway, the thing is that the wsdl file I'm using is retrieved from the web server but then responseXML is null (even though I set up apache to return that the file type is text/xml (and I'm checking that's the content-type by checking with wget).


---response begin---
HTTP/1.1 200 OK
Date: Thu, 26 Apr 2012 20:08:25 GMT
Server: Apache/2.2.20 (Ubuntu)
Last-Modified: Thu, 26 Apr 2012 19:35:12 GMT
ETag: "3e4944-9b8-4be9a161bbc00"
Accept-Ranges: bytes
Content-Length: 2488
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/xml

---response end---

I checked and in responseText I get the content of the wsdl file.

So.... what's going on? Why is it not parsed as an xml file? Or how can I do the debuggin for it?

Thanks in advance.

eantoranz 04-27-2012 11:02 AM

I was just wondering that the problem could be not in phonegap but in lower layers, right? I mean, I just looked at the phonegap src for android and there's no ajax code wihich leads me to believe that phonegap is using android APIs for ajax processing.... which leads me to this questions:

How can I see what android is doing to do the ajax processing? are there ways to do this kind of debugging somehow? Thanks in advance.

eantoranz 04-27-2012 12:18 PM

I've been able to move on (at least a little bit) by checking if responseXML is null. If it is, I could parse again responseText using DOMParser.parseFromString(responseText, "text/xml");

I'm facing other problems now with the result of the parsing process. Let's see how far I can get.

eantoranz 05-02-2012 10:23 AM

I think it's solved. The thing is that if requestXML is null, yoy can still ask a DOMParser to do the parsing for you by hand, liek this:


var parser = new DOMParser();
newResponseXML = parser.parseFromString(req.responseText, "text/xml");

That should be enough.

All times are GMT -5. The time now is 01:41 PM.