Astronomical Data Query Language >> Creating a new .Net Web service
Creating a new .Net Web Service
Let us now look at how we create a new C# web service in few easy steps. You can either start by generating code on your machine or you can use the already generated code provided in the Download Code section.
Requirements
For code generation, the Microsoft .Net framework SDK.
For deployment, Microsoft Visual Studio.Net IDE and the IIS web server.
Next Run wsdl.exe /n:edu.jhu.adql.ws /server Archive.wsdl /o:ArchiveServer.cs on the command line.
This generates the abstract Archive class inside ArchiveServer.cs.
Now we need to implement a web service based on the Archive class.
So, Let us go ahead and create a new web service file called ArchiveService.asmx.cs and include that as a code behind in the corresponding web service file ArchiveService.asmx.
Add the edu.jhu.adql.ws.Archive class as the base class of the new ArchiveService class.
Implement the abstract methods of the Archive class in the ArchiveService class.
Now, for the webservice to be compliant with the ADQL format, we need to add [WebService(Namespace="http://voql.ivoa.net/")] above the ArchiveService class.
Download Code
You can download the entire source code in a zip format over here. This includes the WSDL file, the generated ArchiveServer.cs file, the ArchiveService.asmx web service page and the code behind for the the web service is in ArchiveService.asmx.cs. Once you have tested the deployment of this code, feel free to change the implementation of the ArchiveService based on your needs.
Deployment
In Microsoft Visual Studio.Net IDE, create a new C# ASP.NET web service project.
Add the ArchiveService.asmx, ArchiveService.asmx.cs and the ArchiveServer.cs files as exisiting items into the project.
Compile.
Now, using IIS admininstrator create a new virtual directory for your web service folder.
You are ready to go, open a browser and check whether you can access the ArchiveService.asmx file.
You should be able to see all the supported methods.
Vivek Haridas
Last Modified :Friday, July 25, 2003 at 3:34:45 PM
, $Revision 1.1 $