Submitting an xml document to a web service

K

Keith Chadwick

Wonder if someone can get me on the right track. I have a web service that
returns the xml representation of some data. This returned data is loaded
in the client (i.e. 6) into a msxml4 object. The data is then rendered to
html with a xsl transformation client side. This works great and how things
will stay. Now I need to get the data the other way to a web service.

When the user clicks on Save the client side xml is updated with the values
they have changed. I then need to post this back to another web service
that will expect this data. Now obviously I can not simply pas the xml as
string on the querystring because you run into encoding problems if the user
has entered in & > or < values for example, and yes I have to allow for
these.

So my question is how to send the xml back to a web service via Jscript and
get a xml response back from the service? Do I need to wrap it in a soap
package or something similar?

Any help would be appreciated.

Cheers
Keith
 
M

Martin Honnen

Keith Chadwick wrote:

So my question is how to send the xml back to a web service via Jscript and
get a xml response back from the service? Do I need to wrap it in a soap
package or something similar?

You can do a HTTP POST request where the XML is sent in the body of the
HTTP request:
var httpRequest = new ActiveXObject('Msxml2.XMLHTTP.4.0');
httpRequest.open('POST', 'whatever.asp', true);
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState == 4) {
// process httpRequest.responseXML here
}
};
httpRequest.send(putMsxml2.DOMDocument.4.0Here);

If you really want to send the data to a web service then of course you
might need to use SOAP, then the web service behaviour should help you
on the client, seach http://msdn.microsoft.com/ for that.
 
K

Keith Chadwick

Thanks Martin,

I got as far as you mentioned last night but my problem is getting my web
service to accept the incomming data. Nothing like a weekend learner curve!

Cheer
 
D

Dan Rogers

Hi Keith,

I posted some answers to your original questions on your original post.

Regards
Dan Rogers
Microsoft Corporation
--------------------
From: "Keith Chadwick" <[email protected]>
References: <[email protected]>
Subject: Re: Submitting an xml document to a web service
Date: Sun, 28 Nov 2004 09:28:59 -0500
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:26840
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Thanks Martin,

I got as far as you mentioned last night but my problem is getting my web
service to accept the incomming data. Nothing like a weekend learner curve!

Cheer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top