spacer
Yehuda Shiran December 6, 2001
Calling the EchoBase64 Web Service
Tips: December 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

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

You can use the echoBase64 method to convert characters to their ASCII values. The following Internet Explorer call will return the ASCII values of a and b (97,98):

iCallID = webServiceCallerBody.echo.callService(handleResult, 
                                                "echoBase64", 
                                                "ab");
Learn more about Web services in Column 96 (Web services, Part I: Introduction) and Column 97 (Web Services, Part II: Calling Service Methods).

Here is an HTML file that demonstrates calling a Web service with Internet Explorer. Copy it to your local disk, together with the WebService behavior (webservice.htc):

<HTML>
<BODY ID="webServiceCallerBody" onload="loadService()" 
      STYLE="behavior:url(webservice.htc);
             background-color:peachpuff;
             color:brown;
             font-size:18">
<SCRIPT LANGUAGE="JavaScript">
<!--
function loadService() {
   //Used for the synchronous call
   webServiceCallerBody.onserviceavailable = enableServiceCall;
   webServiceCallerBody.useService(
    "http://soap.bluestone.com:80/interop/EchoService/EchoService.wsdl",
    "echo");
}
function callAsynch() {
   iCallID = webServiceCallerBody.echo.callService(
             handleResult, "echoBase64", "ab");
}
function callSynch() {
   var co = webServiceCallerBody.createCallOptions();
   co.funcName = "echoBase64";
   co.async = false;
   var oResult = webServiceCallerBody.echo.callService(co, "ab");
   handleResult(oResult);
}

function enableServiceCall() {
   b2.disabled = false;
}

function handleResult(res) {
  if (!res.error) {
    alert("Successful call. Result is " + res.value);
  }
  else {
    alert("Unsuccessful call. Error is " + res.errorDetail.string);
  }
}
// -->
</SCRIPT>
<HR><H4>Calls to an echo service</H4><HR><BR><BR>

<BUTTON ID="b1" 
   onclick="callAsynch()">Call Asynchronously</BUTTON><BR><BR>
<BUTTON ID="b2" 
   onclick="callSynch()" disabled>Call Synchronously</BUTTON><BR><BR>
<BR><BR>

<A HREF="http://www.xmethods.net/ilab/">Interop Testing Site</A>

</BODY>
</HTML>

People who read this tip also read these tips:

Look for similar tips by subject:

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
DiVitas's Mobile UC Now Available on the Latest Devices · Review: FON Fonera 2.0n · Chip Market Recovering From '08 Collapse