posts - 50, comments - 127, trackbacks - 6

My Links

News



View Marcin Celej's profile on LinkedIn

Archives

Post Categories

Exposing Web Service without IIS

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.

Print | posted on Monday, April 02, 2007 7:16 PM |

Feedback

Gravatar

# re: Exposing Web Service without IIS

You might be ahead of the game already. I just have a question, exposing the ASMX outside of the server itself.

Scenario:

ASMX ---> called from UNIX BOX, regardless. I think ASMX can be consumed by Java program.

I'm on R&D to expose a simple web svc call for now in 2.0 framework.

Any ideas would be appreciated. I know there's the famous article of Aaron and I have tried it but haven't had a success from calling outside the server.

Thanks,
jeff
11/27/2007 3:53 PM | Jeff
Gravatar

# re: Exposing Web Service without IIS

Hi,

I did connect the ASMX from an external system. It was IBM WebSomething (my friend tested it). The consumer was written in Java and it worked fine for me. The service and client were separated but in local network. We had some problems though first - caused by the WSDL details, but it was quick to fix it.

I am not sure if it helps you (except the information it can be done).

Regards,
Marcin
11/27/2007 10:28 PM | Marcin Celej
Gravatar

# re: Exposing Web Service without IIS

Thanks Marcin...

I'm running to a couple of issue using the sample from WSE 3.0 - HOSTING - Console. It runs fine when I use http://localhost:1965/StockService/StockService.asmx but when I tried the REAL IP ADDRESS it does not work.

From your project, I assume that you have to create a LISTENER whether it is Console based or Windows Service? I went via console based since I don't want to do Marshalling/DeMarshalling due to performance.

Do you mind if I see your project? My goal is exactly like yours but it hinders be in regards to messing with the appConfig assigning "localhost" to "IPADDRESS".

Thanks,
Jeff

11/28/2007 5:33 AM | Jeff
Gravatar

# re: Exposing Web Service without IIS

Hi Marcin

I think I'm getting there.... I just need your help.

I followed this example: http://www.pluralsight.com/blogs/aaron/archive/2005/10/14/15571.aspx?Pending=true

but I'm getting:
-----------------------------------------
System.Web.Services.Protocols.SoapHeaderException: Destination Unreachable
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClie
ntMessage message, WebResponse response, Stream responseStream, Boolean asyncCal
l)

My SvcHost.exe as Console can listen. But when I run my Client it gives me the above error.

Hope you can point me to the right path.

* I hope I can access this outside of my side. WHICH is the next step. I've been doing http://localhost:1033/Services/MathService.asmx


Thanks a lot.
11/28/2007 10:56 AM | Jeff
Gravatar

# re: Exposing Web Service without IIS

Hi Marcin,
I am new to WSE, sorry for the trivial question.

How do I perform step 3 and 4 of your instructions above?

Thanks
1/7/2009 9:53 AM | Eugene
Gravatar

# re: Exposing Web Service without IIS

3 - in VS right click on References in a new project. Then click 'Add new web reference' (or something like that). Then place there your WS url. Remember: The service must be running.

4 - The web service proxy generated by step 3 is a class that you need to find in your project. It is hidden by default so you need to press 'Show all files' button in your solution explorer. Then go inside the file. I believe it is usually named Reference.cs and change the base class.

I hope it helps you though I write it from memory.
1/7/2009 10:17 AM | Marcin Celej
Gravatar

# re: Exposing Web Service without IIS

Marcin,

I am still having difficult time following the instructions. Is it possible to get the sample VS solution source code?

Thanks in advance
1/7/2009 1:58 PM | Eugene
Gravatar

# re: Exposing Web Service without IIS

i am using visual stdio 2.0,now i want to run the projectweb services without using iis.
1/24/2009 1:47 AM | baby
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: