| Author: Vinay Tripathi 11 Oct 2008 | Member Level: Bronze | Rating:  Points: 6 |
I've been recently looking for a way to expose web services without IIS (directly from my windows service). I found two ways of doing that:
Windows Communication Foundation Web Service Enhancements 3.0 The first one (WCF) requires change of my application architecture so I decided to try the WSE 3.0; It can be downloaded from here: Web Services Enhancements (WSE) 3.0 for Microsoft .NET.
I followed those steps:
Step 1. I created an ordinary Web Service that looks like this:
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class CustomerWebService : System.Web.Services.WebService { [WebMethod] public string Register(long id, string data1) { return "ID.CUSTOMER"; } }Step 2. I published the web service to my local ASP.NET development server
Step 3. I generated Web Service Proxy to my web service
Step 4. I changed the base class of my Web Service Proxy from System.Web.Services.Protocols.SoapHttpClientProtocol to Microsoft.Web.Services3.WebServicesClientProtocol (I did it manually as I do not know yet how to enforce the VS to do it for me).
Step 5. I added following lines to my windows service application startup:
Uri address = new Uri("soap.tcp://localhost/CustomerWebService"); SoapReceivers.Add(new EndpointReference(address), typeof(CustomerWebService));Step 6. I changed my client-side proxy url to the one: soap.tcp://localhost/CustomerWebService
Step 7. I run the client application
Everything worked smothly. I will just have to check if the web service is callable from a Web Sphere environment.
|