what is web services used for. How can we create it.


In this article we see something about the web service technology. How can we create a simple webservice and how we consume it in our web/console applications. We will also see what technology it uses to develop the service. What are the important features of web-services.

Web Services is a software system designed to support interoperable machine to machine interaction over a network.

Features:

Self Contained
Self Describing
Language Independent and Interoperable
Standard based
Dynamic


Technology Used



1.

Service Discovery(UDDI)


Universal Descripltion Discovery And Integration.
Focus on process of discovery in the service oriented architecture.

2.

Service Inspection(DISCO)


Technology for publishing and discovering webservices.

3.

Service Description(WSDL)


Web Service Description Language
Language for describing services and a platform for automatically integrating those services.

4.

Wire Format(SOAP)


Simple Object Access Protocol.
It is a network,transport and programming language- neutral protocol that allows a client to call a web service.

Creating a Web Service:

1. Create a new ASP.NET web service.

write the below code.

[WebMothod]
public int get_factorial(int a)
{
int fact=1;
for(int i=1;i<=a;i++)
{
fact = fact*i;
}
return fact;
}


2. Now webservice is created we have to consume it for that we require an application.
Goto solution Explorer -> Take a new website

Right click on website-> add web reference-> Choose webservice in this solution.

Now we get list of methods of the current webservice.
Choose The get_factorial method from it.
In the right side of window their is one textbox(web refrence name) enter factorial in it.

3. Now create a Default.aspx page and take 2 textbox(one to enter number and one to display result), 1 label and 1 button inside it.

Add Namespace(using factorial)

On button click write below code:

factorial.Service fact = new factorial.Service();
txt_result.Text = fact.get_factorial(int.Parse(txt_num.Text)).ToString();


4. Now set the website as the startup project and run the application.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: