Using a WebService with DHTML and Javascript

I have been asked several times how to use a WebService in a DHTML application on the internet using Scripting. Ok, I have created a small sample using Javascript and Microsoft.XMLDOM ActiveX objects (you have to use Internet Explorer 5 or higher).

  XmlHttp.open("POST", "http://localhost/mymethod.asmx", true);
  XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
  XmlHttp.setRequestHeader("SOAPAction", "http://my-comany.com/RequestX");
  XmlHttp.onreadystatechange =
new Function("try{if(XmlHttp.readystate==4){
ParseResponse(XmlHttp.responseXML);}
}catch(e){}");
  XmlHttp.send(SoapEnvelope);

Download the complete script form http://www.schwarz-interactive.de/webservice.txt.

(Ok, this is my first Weblog,...!)

1 Comment

Comments have been disabled for this content.