Web Service menjadi populer saat ini karena web service mampu mengintegrasikan aplikasi yang berbeda platform secara lebih sederhana dan mampu memperbaiki kelemahan dari teknologi sistem terdistribusi lainnya seperti RPC (Remote Procedure Call), Java RMI (Java Remote Method Invocation) maupun arsitektur CORBA (Common Object Request Broker Architecture). Kelemahan utama dari sistem terdistribusi tersebut adalah tidak mendukung heterogenoitas karena masing-masing teknologi mempunyai standar protokol sendiri-sendiri.
Web services sendiri merupakan komponen yang independen terhadap platform ataupun bahasa. Web services menggunakan protokol HTTP (HyperText Transfer Protocol) yang merupakan protokol yang sangat umum digunakan. Dimana protokol tersebut sangat mendukung heterogenoitas dan interoperabilitas serta memudahkan integrasi. Untuk lebih jelasnya bisa dilihat ilustrasi dari cara kerja web service seperti yang diilustrasikan pada gambar dibawah ini :
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Configuration;
using System.Collections.Generic;
using TesoLibrary;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
private GuideLineLogic guideLineLogic;
private ProjectMemberLogic projectMemberLogic;
private EmployeeLogic employeeLogic;
private EvaluationGroupLogic evaluationGroupLogic;
private EvaluationItemLogic evaluationItemLogic;
private ProjectLogic projectLogic;
public Service () {
Util.Instance.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
this.guideLineLogic = new GuideLineLogic();
this.projectMemberLogic = new ProjectMemberLogic();
this.employeeLogic = new EmployeeLogic();
this.evaluationGroupLogic = new EvaluationGroupLogic();
this.evaluationItemLogic = new EvaluationItemLogic();
this.projectLogic = new ProjectLogic();
}
[WebMethod]
public void InsertGuideLine(GuideLine item)
{
this.guideLineLogic.Insert(item);
}
[WebMethod]
public void UpdateGuideLine(GuideLine item)
{
this.guideLineLogic.Update(item);
}
[WebMethod]
public void DeleteGuideLine(GuideLine item)
{
this.guideLineLogic.Delete(item);
}
[WebMethod]
public GuideLine FetchGuideLine(string criteria)
{
return this.guideLineLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.guideLineLogic.GetObjects();
}
[WebMethod]
public void InsertProjectMember(ProjectMember item)
{
this.projectMemberLogic.Insert(item);
}
[WebMethod]
public void UpdateProjectMember(ProjectMember item)
{
this.projectMemberLogic.Update(item);
}
[WebMethod]
public void DeleteProjectMember(ProjectMember item)
{
this.projectMemberLogic.Delete(item);
}
[WebMethod]
public ProjectMember FetchProjectMember(string criteria)
{
return this.projectMemberLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.projectMemberLogic.GetObjects();
}
[WebMethod]
public void InsertEmployee(Employee item)
{
this.employeeLogic.Insert(item);
}
[WebMethod]
public void UpdateEmployee(Employee item)
{
this.employeeLogic.Update(item);
}
[WebMethod]
public void DeleteEmployee(Employee item)
{
this.employeeLogic.Delete(item);
}
[WebMethod]
public Employee FetchEmployee(string criteria)
{
return this.employeeLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.employeeLogic.GetObjects();
}
[WebMethod]
public void InsertEvaluationGroup(EvaluationGroup item)
{
this.evaluationGroupLogic.Insert(item);
}
[WebMethod]
public void UpdateEvaluationGroup(EvaluationGroup item)
{
this.evaluationGroupLogic.Update(item);
}
[WebMethod]
public void DeleteEvaluationGroup(EvaluationGroup item)
{
this.evaluationGroupLogic.Delete(item);
}
[WebMethod]
public EvaluationGroup FetchEvaluationGroup(string criteria)
{
return this.evaluationGroupLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.evaluationGroupLogic.GetObjects();
}
[WebMethod]
public void InsertEvaluationItem(EvaluationItem item)
{
this.evaluationItemLogic.Insert(item);
}
[WebMethod]
public void UpdateEvaluationItem(EvaluationItem item)
{
this.evaluationItemLogic.Update(item);
}
[WebMethod]
public void DeleteEvaluationItem(EvaluationItem item)
{
this.evaluationItemLogic.Delete(item);
}
[WebMethod]
public EvaluationItem FetchEvaluationItem(string criteria)
{
return this.evaluationItemLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.evaluationItemLogic.GetObjects();
}
[WebMethod]
public void InsertProject(Project item)
{
this.projectLogic.Insert(item);
}
[WebMethod]
public void UpdateProject(Project item)
{
this.projectLogic.Update(item);
}
[WebMethod]
public void DeleteProject(Project item)
{
this.projectLogic.Delete(item);
}
[WebMethod]
public Project FetchProject(string criteria)
{
return this.projectLogic.GetObject(criteria);
}
[WebMethod]
public List
{
return this.projectLogic.GetObjects();
}
[WebMethod]
public bool LoginUser(string name, string password)
{
List
foreach (Employee item in list)
{
if (item.UserName.Trim().Equals(name))
{
if (item.Password.Trim().Equals(password))
{
return true;
}
}
}
return false;
}
}