Lec 3 V 1
Lec 3 V 1
CS 237
Web Services - Definition
1.A Web service is a software system identified by a URI.
2. Web service public interfaces and its bindings are defined and
described using XML.
3.Web service definition can be discovered by other software
systems.
4.The software systems may then interact with the Web service in a
manner prescribed by its definition, using XML based messages
conveyed by internet protocols.
Service Oriented Architectures
One-way, Component
conversational, many-
to-many
My slide explain the previous slide
The Service: It refers to the actual implementation of a web service. It is a software
designed to allow communication and data exchange over the network
The service description contains detailed information about the web service. It includes
the interface and implementation details, such as data types, operations (functions or
methods
Service description contains detailed information about the service
Publish: To make a web service accessible to potential requestors, it needs to publish its
service description. Publishing means making the service description available in a location
where requestors can find it
Find: The find operation is performed by a service requestor to locate and retrieve the
service description of a desired web service. The requestor can either directly access the
service description or query a registry or discovery mechanism that maintains a collection
of available web services
Interact: Once the service requestor has obtained the service description, it can initiate an
interaction with the web service.
Windows Communication Foundation(WCF)
1.WCF is one of the latest technologies that is used to build service-oriented
applications.
2.WCF builds service-oriented applications based on the concept of message-based
communication, in which an HTTP request is represented uniformly.
3. WCF makes it possible to have a unified API irrespective of diverse transport
mechanisms.
5. A WCF application consists of three components :
WCF service,
WCF service host
WCF service client.
6.7.WCF Client
•This can be hosted by any application, even the one that does service hosting.
6.8.Channel
•Channel is a medium through which a client communicates with a service.
6.9. Simple Object Access Protocol (SOAP)
•SOAP is not a transport protocol; instead it is an XML document comprising of a
header and body section.
Creating WCF Service
1.Launch Visual Studio.
2.Click on new project.
3.Select WCF option.
4. A WCF service is created that performs basic arithmetic operations like
addition, subtraction, multiplication, and division.
5.The main code is in two different files :
•interface
•class.
6.A WCF contains one or more interfaces and its implemented classes.
Example
[ServiceContract]
Public interface IService1
{
[OperationContract]
int sum(int num1, int num2);
[OperationContract]
int Subtract(int num1, int num2);
[OperationContract]
int Multiply(int num1, int num2);
[OperationContract]
int Divide(int num1, int num2);
}
Example
publicclassService1 :IService1
{ public int sum(int num1, int num2) {
return num1 + num2;
}
publicint Subtract(int num1, int num2) {
if (num1 > num2) {
return num1 - num2;
}
else {
return 0;
}
}
}
Example
publicint Multiply(int num1, int num2) {
return num1 * num2;
}
<inspection>
<abstract>Acme Industries Public Web Services</abstract>
<service>
<name>Store Finder Service</name>
<abstract>
A service to perform a geographical search of Acme stores.
</abstract>
<description
location="http://example.org/services/storefinder.wsdl"/>
</service>
<link location="http://example.org/services/ecommerce.wsil"/>
</inspection>
Service name
Link to an other WSIL page
Service location and description