[thelist] send xml request to webservice via JS

Matt Warden mwarden at gmail.com
Fri Oct 28 09:26:54 CDT 2005


On 10/28/05, Christian Giordano <ml at nuthinking.com> wrote:
> > Are you sending a POST or GET request via xmlhttprequest?
>
> hi matt, I'm using a POST. Googling around I saw that Mozilla instead of
> a string with xml formatting (the one I was passing) wants an xml
> object, so I used:
>
> ...
> var reqText='<?xml version="1.0" encoding="UTF-8" ?> <request
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation=".....xsd"> ... </request>';
>
> req.open("POST", url, true);
> var parser = new DOMParser();
> var reqXML = parser.parseFromString(reqText, "application/xml");
> req.send(reqXML);

I would strongly suggest you build the document with DOM. I have an
example of this in code I wrote for Horde, but Horde's server seems to
be down.

When it's back up, go to:

http://cvs.horde.org

click on "incubator" then "Horde_Form" then "js"

I believe the code you want is in incrementalvalidator.js There is
also relevant code in Horde_Form/Form/IncrementalValidator.php near
the bottom.

If the code is too confusing, I can whip up a stripped down version of
it. But, basically, build the document with DOM.

hth,

--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list