M G Vinod Kumar\’s Technology Blog

April 25, 2006

HelloWorld WebService in Visual Express Editions

Filed under: .NET, Web Services — mgvinod @ 4:52 pm

Implementing and consuming a webservices using Visual Express editions is quite easy to do. You will need both Visual Web Developer Express edition and Visual C# edition installed. I won't delve into the details of the WebServices, just a quick start to get you going.

Creating a HelloWorld WebService

1. Using Visual Web Developer Express, create a new ASP.NET Web Service by File -> New Web Site…. Let us give a name of HelloWorldWebService and click OK.

2. By default, it should have created all files that are required including HelloWorld Method already implemented in Service.cs file. Open the file Service.asmx and you will see just one line of code.

3. Select the solution in the Solution Explorer and in the Properties window, set Use dynamic ports to False. If you wish to change the Port number, you may change it now. For me, it is showing 3697.

4. Press Ctrl+F5. This should build the solution and deploy the webservice using local development IIS that comes along with the express edition.

If you select the HelloWorld link, it should allow you to test the web service by click the Invoke button. It should open a web browser window with result as given below.

<?xml version="1.0" encoding="utf-8" ?>

<string xmlns="http://tempuri.org/">Hello World</string>

Leave the IIS running. You should be having a small icon in your system tray indicating that. Now, let us look at how to write a client to use this Web Service.

Consuming the HelloWorld WebService

1. Start Visual C# Express Edition. Create a new Console Application. (You may use window application also as your client application.) Let us name it as HelloWorldWebServiceClient.

2. Now Add Web Reference… by right clicking on the References in Solution Explorer. Enter the url


It should display the available opertions, in our case, it is HelloWorld. Click Add Reference. This should add localhost under the Web References folder in Solution Explorer.

Note: Ensure that the right Port number is mentioned.

3. Open the Program.cs and add the following code in the Main method.

localhost.Service service = new localhost.Service();

Console.WriteLine("Message Received: {0}", service.HelloWorld());

4. Press Ctrl+F5. This should build the solution and a message like this should be displayed in your console.

Message Received: Hello World

That's it.


1 Comment »

  1. Beautifully put the service and client side utilization under one roof. Thanks Buddy. Keep it up.

    Comment by Sunil Dutt — November 29, 2006 @ 10:20 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: