Introduction:
Here I will explain what webservice is, uses of webservice and how to create webservice and how to consume webservice in asp.net.
Description:
Web Service is an application that is designed to interact directly with other applications over the internet. In simple sense, Web Services are means for interacting with objects over the Internet. The Web serivce consumers are able to invoke method calls on remote objects by using SOAP and HTTP over the Web. WebService is language independent and Web Services communicate by using standard web protocols and data formats, such as
Web Service messages are formatted as XML, a standard way for communication between two incompatible system. And this message is sent via HTTP, so that they can reach to any machine on the internet without being blocked by firewall.
Here I will explain what webservice is, uses of webservice and how to create webservice and how to consume webservice in asp.net.
Description:
Today I am writing article to explain about webservices. First we will see what is webservice is and uses of webservice and then we will see how to use webservice in our applications.
What is Web Service?
Web Service is an application that is designed to interact directly with other applications over the internet. In simple sense, Web Services are means for interacting with objects over the Internet. The Web serivce consumers are able to invoke method calls on remote objects by using SOAP and HTTP over the Web. WebService is language independent and Web Services communicate by using standard web protocols and data formats, such as
- HTTP
- XML
- SOAP
Advantages of Web Service
Web Service messages are formatted as XML, a standard way for communication between two incompatible system. And this message is sent via HTTP, so that they can reach to any machine on the internet without being blocked by firewall.
Examples for Web Service
Weather Reporting: You can use Weather Reporting web service to display weather information in your personal website.
Stock Quote: You can display latest update of Share market with Stock Quote on your web site.
News Headline: You can display latest news update by using News Headline Web Service in your website.
In summary you can any use any web service which is available to use. You can make your own web service and let others use it. Example you can make Free SMS Sending Service with footer with your advertisement, so whosoever use this service indirectly advertise your company... You can apply your ideas in N no. of ways to take advantage of it.
Frequently used word with web services
What is SOAP?
SOAP (simple object access protocol) is a remote function calls that invokes method and execute them on Remote machine and translate the object communication into XML format. In short, SOAP are way by which method calls are translate into XML format and sent via HTTP.
What is WSDL?
WSDL stands for Web Service Description Language, a standard by which a web service can tell clients what messages it accepts and which results it will return.
WSDL stands for Web Service Description Language, a standard by which a web service can tell clients what messages it accepts and which results it will return.
WSDL contains every detail regarding using web service and Method and Properties provided by web service and URLs from which those methods can be accessed and Data Types used.
What is UDDI?
UDDI allows you to find web services by connecting to a directory.
So lets start create web service.
Step 1: create a new website in asp.net .
Step 2:create two text box like-
textbox 1
textbox 2
and insert a submit button .
Step 3:for show addition of both insert a label in asp.net.
Step 4:now in root of asp.net website add webservice by right click in root of asp.net.
Step 5:add webservice page and write code for web service
[WebMethod]
public int add(int num1,int num2)
{
return(num1+num2);
}
Step 6:on button click at aspx page write a code-
protected void Button1_Click(object sender, EventArgs e)
{
WebService ws = new WebService();
Label1.Text= ws.add(Convert.ToInt32(TextBox1.Text),Convert.ToInt32(TextBox2.Text)).ToString();
}
Step 7:run the code and insert value in both text box and click submit button and result will appear at label.
for any query please write comment -
With Regards
Avinash Sharma
No comments:
Post a Comment