December 9, 2001 - Calling the EchoStringArray Web Service | WebReference

December 9, 2001 - Calling the EchoStringArray Web Service

Yehuda Shiran December 9, 2001
Calling the EchoStringArray Web Service
Tips: December 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

You can use the echoStringArray method to echo a string array. Place the array elements inside a pair of square brackets, delimited by commas:

iCallID = webServiceCallerBody.echo.callService(
  handleResult, "echoStringArray", ["a","bc","defg"]);
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. Copy it to your local disk, together with the WebService behavior (

<BODY ID="webServiceCallerBody" onload="loadService()" 
function loadService() {
	webServiceCallerBody.onserviceavailable = enableServiceCall;  //Used for the synchronous call.
function callAsynch() {
	iCallID = webServiceCallerBody.echo.callService(
	  handleResult, "echoStringArray", ["a","bc","defg"]);
function callSynch() {
	var co = webServiceCallerBody.createCallOptions();
	co.funcName = "echoStringArray";
	co.async = false;
	var oResult = webServiceCallerBody.echo.callService(co, ["a","bc","defg"]);
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);
// -->
<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="">Interop Testing Site</A>