Wednesday, August 04, 2004

Including Web Services as a DLL in your project

Its always not required to register (web reference) your Web Service in the consuming project.
You can create a DLL (proxy class) out of the Web Service you have written and simply add it as a reference (component) to your project.
You can easily do it in the command prompt itself, as follows:

1. Create the Web Service in Visual Studio
and browse it to test the webservice..
path eg:-
http://localhost/webserviceproj1/wsinfo.asmx?WSDL


2. Generate a Proxy for the Web Service (Output = C#/CS)

wsdl /l:CS /protocol:SOAP
http://localhost/webserviceproj1/wsinfo.asmx?WSDL

then it will write the wsinfo.cs file in the same path.


3. Compile the Proxy as a DLL library

csc /t:library /r:System.Web.Services.dll /r:System.Xml.dll
wsinfo.cs

3. Include it in the project that calls the webservice (as a DLL reference)
Copy the DLL into the folder and then include it in the project that calls the webservice
(as a DLL reference)

More info available at:
http://archive.devx.com/dotnet/articles/cp0901/cp0901-2/cpwso.asp
http://my.execpc.com/~gopalan/dotnet/webservices/webservice_csharp_client.html


0 Comments:

Post a Comment

<< Home