Introduction:
Here I am creating a simple web service and using it in a windows application. Using a web service in a window form application is similar to using a WCF service. At first we create a web service and write the following code.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using System.Web;
using
System.Web.Services;
namespace
mywebservice1
{
///
<summary>
/// Summary
description for Service1
///
</summary>
[WebService(Namespace =
"http://tempuri.org/")]
[WebServiceBinding(ConformsTo =
WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from
script, using ASP.NET AJAX, uncomment the following line.
//
[System.Web.Script.Services.ScriptService]
public class
Service1 : System.Web.Services.WebService
{
[WebMethod]
public string
HelloMessage()
{
return
"Hello, Web Service";
}
}
}
Run this service.
Output:
Create a windows application and follow the given steps.





Join the conversation! Your thoughts help the community grow.