> Can you please confirm that it's as simple as the following:
>
[quoted text clipped - 10 lines]
> xmlhttp.setRequestHeader("Content-Type",
> "application/x-www-form-urlencoded");
You were talking about a web service used with the web service behavior
and that means to me the client so far made SOAP requests. If you now
switch to application/x-www-form-urlencoded requests then you need to
make sure that service expects/allows/understands such requests. It is
possible to configure .NET web services that way but not the default I
think.
> xmlhttp.setRequestHeader("Content-Length", sendString.length);
> xmlhttp.send("doc="+sendString);
If you want to send the request with the content type
application/x-www-form-urlencoded then your script needs to make sure
the argument to send is in that encoding, with JScript (as supported in
IE 5.5 and later) you could do
xmlhttp.send("doc=" + encodeURIComponent(sendString));
> function doHttpReadyStateChange(){
> if (xmlhttp.readyState == 4) {
> alert(xmlhttp.responsetext);
> var str = xmlhttp.responsetext;
There is no standard defined I think what format a response to such a
HTTP POST request to a web service should have but I think .NET services
still answer with an XML document so consider using responseXML and
accessing it with DOM and not using responseText. Check the
documentation for that service what kind of answers it gives.
> What should I be aware of with regards to the status property, and the
> readystate property?
It is HTTP so the xmlhttp.status property gives you the HTTP response
status code the server sends, those are defined here:
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1>

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
> xmlhttp.setRequestHeader("Content-Length", sendString.length);
> xmlhttp.send("doc="+sendString);
Forgot to mention, if you want to set Content-Length then you need to
set it to the complete length of the string argument of the send method
so do e.g.
var body = "doc=" + encodeURIComponent(sendString);
xmlhttp.setRequestHeader("Content-Length", body);
xmlhttp.send(body);

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/