1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    bobbaluba is on a distinguished road

      0  

    Question 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?

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    bobbaluba is on a distinguished road

      0  

    Default


    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);

  3. #3
    Sencha User semiaddict's Avatar
    Join Date
    Mar 2010
    Posts
    45
    Vote Rating
    2
    semiaddict is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    14
    Vote Rating
    0
    bobbaluba is on a distinguished road

      0  

    Default


    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.

  5. #5
    Sencha User semiaddict's Avatar
    Join Date
    Mar 2010
    Posts
    45
    Vote Rating
    2
    semiaddict is on a distinguished road

      0  

    Default


    Too bad. Thanx anyways.
    ---
    Oussama Mubarak // Semiaddict

Thread Participants: 1