Sanjay Dahiya wrote:
[color=blue]
> this.request.onreadystatechange = this.handleStateChange;
>
> if( this.request) {
> this.request.open("POST", url ,true);
> this.request.setRequestHeader("Content-Type", "text/xml");[/color]
I would set onreadystatechange each time after the open call so move the
this.request.onreadystatechange = this.handleStateChange;
down here after the open call.
[color=blue]
> var markup = serialize(doc);
> this.request.send(markup);
> }
> ---
> it works fine and I can get XML on server. but from server I write the
> same XML back -
> ---
> InputStream is = request.getInputStream();
> Document doc = XMLUtils.load(is, false);
>
> response.setCharacterEncoding("UTF-8");
> response.setContentType("text/xml");
>
> PrintWriter writer = response.getWriter();
> BufferedWriter bufWriter = new BufferedWriter(writer);
>
> XMLUtils.printDocument(doc, bufWriter);
> bufWriter.newLine();
>
> response.flushBuffer();
> bufWriter.close();
> ---
> I can receive the XML document right in responseText but responseXML is
> null. cant make out whats happening here..
>
> ----
> function processReqChange()
> {
> if (req.readyState == 4) {
> // only if "OK"
> if (req.status == 200) {
> alert(req.responseText);
> handler.handle(req.resposeXML); // req.responseXML is NULL
> HERE[/color]
Could you check the response headers e.g.
alert(req.getAllResponseHeaders())
to the see the content type header that is sent?
And are you sure the markup sent is well-formed?
--
Martin Honnen
http://JavaScript.FAQTs.com/