Friday, April 1, 2011

Creating Web services

As we all know, it's time to move on Web services. It provides a way of communication over network using two electronic devices.
Well, I had a chance in my project where I was consuming .NET Web services. At that time I was not aware of, how can I prepare my own Web services? Now I come to know the required steps for preparing .NET Web services and I am sharing the same to this post.

Steps to create Web services
As I am going to create .NET Web services for which I need to use a .NET tool which is Microsoft Visual Studio 2005.

In order to create a new web service in VS 2005, please follow the steps below,
  • The figure below shows you the starting page of VS 2005.














  • Go to File >> New >> Web Site as,














  • Select ASP.NET Web Services and click OK.













  •  You will get Services.cs file which you can see in VS 2005. Here you can add your web methods which is similar as public method of your Java classes. Here I have created one 'HelloWorld' web method which you can see in Web service.














  • You need to debug this code. Click the green arrow button in upper middle portion of VS screen. You will get the below pop up message .










  •  You can see your service in browser with supported operations. As I have prepared this service for HelloWorld operation, you can see the same in figure below.














  •  You can now check your operation by clicking the same and check the used soap messages which is interacting with Web service.














  • As you can see in above figure, there is an invoke button. Once you click on this button, the web method will execute and give the result which you have passed in 'HelloWorld' web method in Services.cs file.














  • These are the steps for checking your operations which you have applied on Web services. Now you need to check your Web service which you can find in browser when you append '?WSDL' at the end of service URL which is,  http://localhost:TestWebSite/Service.asmx?WSDL.














  • This is what I am trying to explain you. Now you need to save this file in form .wsdl.















In this way, you can prepare your own services. Also you can go through one of my post Exchange Web services Java Stub to know about Java stub (Client) creation using Axis tool and Eclipse IDE.









    No comments: