Web Service Proxy Class DLL File for ASP.NET

The easiest way to use the Shanje Control Service is through ASP.NET using a Web Service Proxy Class DLL. A Web Service proxy class permits a script to access a Web Service stored on a remote server using a local representation of the methods of a remote Web Service class, allowing you to invoke the methods as if they were located on your local computer. All of the SOAP functions and TCP connections take place inside the web service proxy class, and all you have to do in your code is create an instance of the web service proxy class and then invoke methods.

Coding Example:
It is really easy to write ASP.NET code to interface the Shanje Control Service when you use a web service proxy class DLL. Here is an example. The first line create an object instance to the Shanje Control Service and the second line calls the function. In this example, it assumes you have a label control called lblCount that you want to display the number of websites in. This example also assumes you have three strings defined for the triple token login details (WCPLogin, WCPPassword, APIKey). If you don't know what the APIKey is, please refer to the APIKey article.

Dim objSCS as New ShanjeControlService
lblCount.Text = objSCS.GetWebsiteCount(WCPLogin,WCPPassword,APIKey)

How to get the DLL
There are three ways to get a web service proxy class DLL file. The first and easiest is to simply download it from this site. The second is to have Visual Studio generate one for you. The third is to generate the DLL file using some command line functions on your PC.

Download the DLL: (compiled on 02/26/2010)
Download DLL for ASP.NET 1.1
Download DLL for ASP.NET 2.0

Where to put the DLL
You will need to FTP upload the DLL file to the bin folder in your website. If you do not have a bin folder, then you will need to create one via FTP. Keep in mind, this bin folder must be in the root of your website (/bin).

Create your own Web Service Proxy Class DLL File

Generate the .VB file from the Command Line:
You can create a web service proxy class using any Windows computer that has the .NET Framework and FrameworkSDK installed. If your PC does not have all of the needed tools installed, then the WSDL and VBC commands will not work. Here is an example of the commands needed to create the ShanjeControlService.vb file which can be used to create a compiled DLL.

CD c:\
MD WebService
CD c:\WebService
CD C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin
WSDL /l:VB /o:c:\WebService\ShanjeControlService.vb http://webservice.shanje.net/ShanjeControlService.asmx?wsdl
CD c:\WebService

At this point, there should be a ShanjeControlService.vb file in the c:\WebService folder on your local PC. This is the Visual Basic source code that can be used to create a DLL file for your ASP.NET application. Now all you need to do is generate a DLL version of the web service proxy calss that is compatible with the ASP.NET version you are using for your website. If your website uses ASP.NET 1.1, then you must use the .NET Framework 1.1 version. If your website uses ASP.NET 2.0, then you will need to use the .NET Framework 2.0 version.

Generate the .DLL file from the Command Line:
The following steps will create a .NET Framework 1.1 DLL file.

CD c:\WebService
CD C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
vbc.exe /t:library /out:c:\WebService\ShanjeControlService.dll /r:System.dll,System.Web.Services.dll,System.XML.dll c:\WebService\ShanjeControlService.vb
CD c:\WebService

The following steps will create a .NET Framework 2.0 DLL file.

CD c:\WebService
CD C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
vbc.exe /t:library /out:c:\WebService\ShanjeControlService.dll /r:System.dll,System.Web.Services.dll,System.XML.dll c:\WebService\ShanjeControlService.vb
CD c:\WebService

Now you will have two files in your C:\WebService folder on your local PC. One is ShanjeControlService.vb and the other is ShanjeControlService.dll. If you are curious how it work, feel free to open the .VB file in Notepad or Visual Studio to see the source code for the proxy class. But the only one you actually need is the DLL file.