Ben
2008-Jun-24 19:52 UTC
Prototype.js: Response Rendering Problem Using Ajax.Updater to call a SOAP Web Service
Hi, everyone. I am currently using Ajax.Request to call a SOAP web service. Code looks like this: var ar = new Ajax.Request( url, { method: "post", contentType: ''application/soap+xml'', requestHeaders: myRequestHeaders, postBody: mySoap, onSuccess: function(transport) { //alert("Success: " + transport.responseText); containerId.innerHTML transport.responseXML.childNodes[0].textContent; $(''soapId'').innerHTML transport.responseText.escapeHTML(); }, onFailure: function(transport) { alert("Error: " + transport.responseText); } }); ...and is working fine. The containerId points to a <DIV>, so that using the above, the web page shows the contents returned by the web service. This renders ok if I use transport.responseXML.childNodes[0].textContent, but not if I use transport.responseText. The reason is that the latter contains the entire soap envelope, while the former contains just the HTML fragment. I would like to be able to use the simpler Ajax.Updater, but whenever I try it, it apparently returns the transport.responseText (with the soap envelope), and so the final rendered <DIV> looks kind of like this in the browser: <?xml version="1.0" encoding="UTF-8"?><h2>WCM Contents</h2><table border="1"><tr bgcolor="#9acd32"><th align="left">Title</th><th align="left">Contents</th></tr><tr><td>Thar''s GOLD In Them Red Hills!</ td><td>News Flash - Gold discovered on Mars!</td></tr><tr><td>Thar''s GOLD In Them Red Hills!</td><td>News Flash - Gold discovered on Mars!</ td></tr><tr><td>Thar''s GOLD In Them Red Hills!</td><td>News Flash - Gold discovered on Mars!</td></tr><tr><td>Thar''s GOLD In Them Red Hills!</td><td>News Flash - Gold discovered on Mars!</td></ tr><tr><td>Thar''s GOLD In Them Red Hills!</td><td>News Flash - Gold discovered on Mars!</td></tr><tr><td>Thar''s GOLD In Them Red Hills!</ td><td>News Flash - Gold discovered on Mars!</td></tr></table> ...i.e. the browser is not able to correctly interpret the table markups. (Again, if I use the transport.responseXML.childNodes[0].textContent, it IS able to correctly interpret the table markups. Any thoughts on how to get this to work for the Ajax.Updater (and ultimately the PeriodicalUpdater)? I''m willing to change the way I custom-handled this in Ajax.Request, if need be. Ben Ethridge Senior Java Developer Leapfrog Systems --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---