|
July 3, 2002 Extending a Class to a Web Service Tips: July 2002
Yehuda Shiran, Ph.D.
|
|
Here is what you need to do to convert a class to a Web service:
Let's apply the main steps from above to our PrimeNumbers class. The directive line is the first line of the file and looks like this:
You derive the class from the WebService class by extending it. The WebService class includes a lot of methods that are needed for deploying a Web service. Basing your class on the WebService class provides you with these methods for free. You need focus only on your unique value-adding business logic. Here is how you extend WebService to PrimeNumbers:
The location of your Web service is on your Web server. If your Web server is IIS and your file is checkIsPrime.asmx for example, you can save it in a directory under c:\inetpub\wwwroot. For example:
From now on, you can refer to this Web service as:
To learn more about JScript .NET, go to Column 112, JScript .NET, Part VI: Creating IE Web Services.
People who read this tip also read these tips: Look for similar tips by subject: |