|
November 15, 2001 Handling Different asmx File Locations Tips: November 2001
Yehuda Shiran, Ph.D.
|
|
A Web service is identified by a URL. The following is an example for a valid Web service:
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:
The following line assigns a friendly name to a Web service file (.asmx):
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:
The following line assigns a friendly name to a local disk file:
You have to add the ?WSDL query string also when you have a full HTTP path:
Suppose now that the Web service .asmx file is two levels up from the Web page (relative path):
And finally, here is an example for an .asmx file residing in a subfolder beneath the Web page:
People who read this tip also read these tips: Look for similar tips by subject: |