-
6 Jul 2011 1:07 AM #1
How to read a js XMLHttpRequest using XmlReader?
How to read a js XMLHttpRequest using XmlReader?
Hi, I mentiioned this in another thread but I think starting a new thread would be better.
I'm trying to communicate with my SOAP web service and filling a store with the xml returned.
I'm able to get a response from the web service using regular XMLHttpRequests, but i don't know exactly what to do with the results.
My proxy has an xmlReader, and I'm pretty sure it's set up correctly, however, when i call
thisProxy.getReader().read(xmlhttprequest);
I get an empty result.
What am i doing wrong?
-
6 Jul 2011 1:56 AM #2
Turns out i did everything correctly, it was just the web service that wrapped the result in a cdata field. Isn't that kind of strange?
Is there some way i can make the xmlreader parse cdata eventhough it's supposed to be comments?
EDIT: Can i make the XmlReader just parse a string instead of an XMLHttpRequest?
EDIT: Finally got it!
The reader needs to have an xmlDocument that's already partially parsed:
Code://remove comments from xml-string var res=xmlhttp.response.replace("<![CDATA[<Agresso>","<Agresso>"); res=res.replace("</Agresso>]]>","</Agresso>"); //parse the xml into a document var parser=new DOMParser(); var xmlDoc=parser.parseFromString(res,"text/xml"); var reader = thisProxy.getReader(), result = reader.read(xmlDoc);
-
16 Nov 2011 1:46 AM #3
Do you mind posting your proxy code ?
I'm trying to communicate with a third party SOAP webservice, but don't know how to setup the proxy ...
Thanx in advance.---
Oussama Mubarak // Semiaddict
-
16 Nov 2011 8:33 AM #4
Sorry, it was an internship and I don't have access to the version control system anymore. However, since we had to make the data available offline as well, it seemed too complicated to continue using sencha's store, so we ended up making our own store and parser from scratch.
-
19 Nov 2011 5:30 AM #5
Too bad. Thanx anyways.
---
Oussama Mubarak // Semiaddict


Reply With Quote