473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Example of how to call a .net webservice via javascript on a timed delay

You can copy and paste the following into a .aspx page (change names
for your purpose) and it will call a webservice on every 1 minute. I
used this piece of code for the purpose of refreshing a datagrid
without having to make a postback to the server.

<script language="javascript">

function startRefreshDelay() {
UpdateGrid();
timer = setTimeout("startRefreshDelay()",60000);
}
function UpdateGrid()
{

var xmlObj = new ActiveXObject("Msxml2.DOMDocument");
var sXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
sXml += "<soap:Envelope "
sXml += "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
";
sXml += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ";
sXml += "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
sXml += "<soap:Body>";
sXml += "<GetDailyRetailKPI xmlns=\"http://www.tempuri.org/\">";
sXml += "<strXML><testnode>test</testnode></strXML>";
sXml += "</GetDailyRetailKPI></soap:Body></soap:Envelope>";

// Try to parse the XML string into DOM object
xmlObj.loadXML(sXml);

var xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
xmlHTTP.Open ("Post", "http://eis/GridXML/GridXML.asmx", false);
xmlHTTP.setRequestHeader("SOAPAction",
"http://tempuri.org/GetDailyRetailKPI");
xmlHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8"
);
xmlHTTP.Send(sXml);

var xmlResponse = xmlHTTP.responseXML ;
DailyRetailKPI.innerHTML =
xmlResponse.selectSingleNode("soap:Envelope/soap:Body").text ;
}
</script>
Nov 18 '05 #1
0 1088

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jojoba | last post by:
Hello to all! I have a fairly simple webservice running in asp.net ajax under c# (vs 2008). I built the service and it runs just dandy when i test it by itself in visual studio. However, to...
1
by: dearprasan | last post by:
Hi, I am making a call to a asynchronous call to a webservice using callback. Before I make the asynchronous call, I am allowed to make the following cast: IHTMLDocument2 doc = (IHTMLDocument2)...
6
by: Peter | last post by:
I have a APS.NET 3.5 webpage which calls a web service. What I need is to update this page automatically when a value changes in the webservice, does anyone have an example? Thank You ...
3
by: bnsmith001 | last post by:
I have a text file with 29766 words in it. Currently, the file is formatted with one word per line, followed by a DOS CR/LF. I'd like to write a Word-of-the-Day tool solely in javascript, where I...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.