View Single Post
Old 10-08-2008   #3 (permalink)
dang57


 
 

Re: Need a technique to speed up processing

Thanks for the suggestion, Adrain.

I'm trying to get it working with a web service. So far, it doesn't
work, but I think a solution is in there somewhere. Unfortunately, I
don't quite know what the exact parameters should be, so it's a bit of
hit and miss. (mostly miss)

In the code (below), it always falls into the "readyState == 4"
condition.
I can see in the alert text that it's trying to run "Howdy.asmx?
op=HelloWorld", which is hopefully correct. I have tried calling it
from the codebehind, and it works, so I'm pretty sure the asmx is
fine. I don't want to leave it in the codebehind, because it has to
load the viewstate to get in there. Running directly from the
javascript seems like the way to go.

If you spot something wrong in the code, or if there is a better
technique, please let me know.

var soapHeader = '<?xml version="1.0" encoding="utf-8"?>'
soapHeader += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
soapHeader += '<soap:Body><HelloWorld /></soap:Body></soap:Envelope>'
var postUrl = 'Howdy.asmx';
var soapActionUrl = 'HelloWorld';

xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
xmlHTTP.open ('GET', postUrl, true);
xmlHTTP.onreadystatechange = function() { if ( xmlHTTP.readyState ==
4 ) { alert(xmlHTTP.responseText); } };
xmlHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHTTP.setRequestHeader("Host", "localhost");
xmlHTTP.setRequestHeader("SOAPAction", soapActionUrl);
xmlHTTP.setRequestHeader("Content-Length", soapHeader.length );
xmlHTTP.send(soapHeader);

Thanks again
Dan
My System SpecsSystem Spec