Write a Web service. NET using VS. NET is easy. SDK However, it is possible to write Web Services using the plain. NET. I had many problems to write Web services without VS. NET and tried to find help online. There are many examples available for writing Web Services using VS.NET, but rarely are some examples of writing Web Services using only the SDK. NET. This article is exactly for this purpose. It examines the development of Web services using the SDK. NET only.
We will write and publish a simple web service. We will also write two consumer Web services: one based on consumer Web (ASP.NET application) and other Windows-based application for consumers. Let's start writing our first Web Service.
Why do we need Web Services?
After buying something online, you may have wondered about the delivery status. Call the delivery company consumes his time, nor is it an activity of value to the delivery company. To eliminate this scenario the delivery company must give delivery information without compromising its security. Security architecture of the enterprise may be very sophisticated. What we can use port 80 (Web server port) and presenting information through the web server? However, we have to create a whole new web application to extract data from business applications. This will cost money to the delivery company. All that business wants is to expose the delivery status and focus on their core business. This is where Web services come
FirstService.asmx
<%@ WebService language="C" class="FirstService" %>
using System;
using System.Web.Services;
using System.Xml.Serialization;
[WebService(Namespace="http://localhost/MyWebServices/")]
public class FirstService : WebService
{
[WebMethod]
public int Add(int a, int b)
{
return a + b;
}
[WebMethod]
public String SayHello()
{
return "Hello World";
}
}
0 comments:
Post a Comment