spacer
Yehuda Shiran November 15, 2001
Handling Different asmx File Locations
Tips: November 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

A Web service is identified by a URL. The following is an example for a valid Web service:

http://soap.bluestone.com:80/interop/EchoService/EchoService.wsdl
It is quite cumbersome to use this URL every time you need to reference the Web service. The useService() method establishes a friendly name for a Web service URL, which can be referenced later from within the code. Here is an example:

<BODY ID="webServiceCallerBody" STYLE="behavior:url(webservice.htc)>
<SCRIPT LANGUAGE="JavaScript">
<!--
 webServiceCallerBody.useService(
   "http://soap.bluestone.com:80/interop/EchoService/EchoService.wsdl","echo");
// -->
</SCRIPT>
The following line assigns a friendly name to a Web service file (.asmx):

webServiceCallerBody.useService("echoService.asmx","echo");
Notice that echoService.asmx must reside in the same folder as the Web page that calls the WebService behavior. Same rule applies when you call the WSDL file:

webServiceCallerBody.useService("echoService.wsdl","echo");
The following line assigns a friendly name to a local disk file:

webServiceCallerBody.useService("D:\legacy\yehuda\uyehuda\column97\echoService.asmx?WSDL","echo");
You have to add the ?WSDL query string also when you have a full HTTP path:

webServiceCallerBody.useService("http://www.webreference.com/js/column97/echoService.asmx?WSDL","echo");
Suppose now that the Web service .asmx file is two levels up from the Web page (relative path):

webServiceCallerBody.useService("../../echoService.asmx?WSDL","echo");
And finally, here is an example for an .asmx file residing in a subfolder beneath the Web page:

webServiceCallerBody.useService("./subfolder/echoService.asmx?WSDL","echo");

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
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint