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

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


Web Services, Part XI: Consuming Multiple Web Services

Consuming the Add Web Service

Here again is the Add Web service in action:

Enter First Number:
Enter Second Number:

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

<HTML>
<HEAD>
<TITLE>Consuming the ADD Web Service</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function init() {
  myWebService.useService("http://63.210.240.215/d2s/
    20011205/add.asmx?WSDL",
    "simpleCalcWebService");
}
function addNumbers(a, b) {
  myWebService.simpleCalcWebService.callService(addResult,
    "add", first.value,
    second.value);
}
function addResult(result) {
  theResult1.innerHTML = result.value;
}
// -->
</SCRIPT>
</HEAD>
<BODY onload="init()">
<DIV ID="myWebService"
  STYLE="behavior:url(webservice.htc)"></DIV>
<TABLE BORDER="0">
  <TR><TD><INPUT SIZE="4" TYPE="text" ID="first"
    STYLE="text-align:'right'"></TD></TR>
  <TR><TD><INPUT SIZE="4" TYPE="text" ID="second"
    STYLE="text-align:'right'"></TD></TR>
  <TR><TD><HR></TD><TD><INPUT VALUE="Add" TYPE="button"
    onclick="addNumbers();"></TD></TR>
  <TR><TD><DIV ID="theResult1" STYLE="text-align:'right'">
    </DIV></TD></TR>
</TABLE>
</BODY>
  </BODY>
</HTML>

Next: How to consume the IsPrime Web service

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/4.html