Web Services, Part XI: Consuming Multiple Web Services: Consuming the IsPrime Web Service - Doc JavaScript | WebReference

Web Services, Part XI: Consuming Multiple Web Services: Consuming the IsPrime Web Service - Doc JavaScript


Web Services, Part XI: Consuming Multiple Web Services

Consuming the IsPrime Web Service

Here again is the IsPrime Web service in action:

Enter a number:  

Here is complete listing of a page that consumes the IsPrime Web service:

<HTML>
<HEAD>
<TITLE>Consuming the isprime Web Service</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function init() {
 myWebService.useService("http://www.dev1.eraserver.net/
   D2S/WebServiceSample/isPrime.asmx?WSDL","
     isPrimeNumberWebService");
}
function isPrimeNumber() {
  myWebService.isPrimeNumberWebService.callService
    (isPrimeNumberResult, "IsPrime",
    testValue.value);
}
function isPrimeNumberResult(result) {
  theResult2.innerHTML = "The number " +
    testValue.value + (result.value ? " is" : "
    is not") + " a prime number";
}
// -->
</SCRIPT>
</HEAD>
<BODY onload="init()">
<DIV ID="myWebService"
  STYLE="behavior:url(webservice.htc)"></DIV>
<FONT face="Arial">
<TABLE BORDER="0">
  <TR>
    <TD>Enter a number:</TD>
    <TD><INPUT SIZE="4" TYPE="text" ID="testValue"
      VALUE="0"></TD>
    <TD> </TD>
	<TD><INPUT VALUE="Click here to check if prime"
    TYPE="button" onclick="isPrimeNumber();"></TD>
  </TR>
  <TR><TD COLSPAN=4><DIV ID="theResult2"></DIV></TD></TR>
</TABLE>
</FONT>
</BODY>
</HTML>

Next: A Final Word

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: March 25, 2002
Revised: March 25, 2002

URL: http://www.webreference.com/js/column106/5.html