JScript .NET, Part VIII: Consuming IsPrime from ASP.NET: Creating a Proxy - Doc JavaScript | WebReference

JScript .NET, Part VIII: Consuming IsPrime from ASP.NET: Creating a Proxy - Doc JavaScript


JScript .NET, Part VIII: Consuming IsPrime from ASP.NET

Creating a Proxy

Let's create a proxy for the IsPrime Web service from Column 112. We put all files in d:\aspDemo, including the Web service definition, checkIsPrime.asmx. Now you need to open the IIS control window. In Windows XP, click start -> Control Panel -> Performance and Maintenance -> Administrative Tools -> Internet Information Services. Expand the menu by clicking the + button, until you get the Default Web Sites entry:

Let's create a virtual directory now under Default Web Sites. Right-click the Default Web Sites entry, and pick New Virtual Directory. A wizard will guide you through two entries and a set of options. The first entry is the alias of this Web site. Since our filenames will all be different from Column 113's, we'll continue to use the Column113 alias that we created in our previous tutorial. Then it will ask you for the path of the directory where the content is. Browse to your directory and press Next. We chose d:\aspDemo. Leave the last page as is and click Finish. You will now see all your files from d:\aspDemo reflected in the right window of the IIS control panel. You can check now that indeed you can see the IsPrime Web service via https://localhost/Column113/checkIsPrime.asmx (assuming you put checkIsPrime.asmx in d:\aspDemo).

Now you can start creating the proxy to the IsPrime Web service. It's a two-step process. The first step creates the proxy code in JScript .NET and adds your class to the specified namespace. The executable that does this is wsdl.exe. Your .NET Framework should support this executable by including its directory in your path. Open a Command Prompt window and cd (change directory) to d:\aspDemo. Type wsdl and verify you get the help for this executable. Type the full command now (in one line):

wsdl /l:js /namespace:primeProxy /out:sampleProxy.js 
  https://localhost/Column113/checkIsPrime.asmx

The last entry on this line is the input to the wsdl command:

https://localhost/Column113/checkIsPrime.asmx

which is the full path to the Web service definition. The other switches are:

The following Command Prompt window shows the content of checkIsPrime.asmx and the echo of the wsdl command:


Next: How to create a .dll file


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: July 15, 2002
Revised: July 15, 2002

URL: https://www.webreference.com/js/column114/2.html