spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column106


Web Services, Part XI: Consuming Multiple Web Services

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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