Web Service Introduction Tutorial
Web service is a system that
enables applications to communicate with an API. Web service helps to expose
business logic through an API interface where different systems communicate
over network. At higher level there are two parties involved, party providing
the service is web service provider and the one utilizing it is web service
consumer. In a previous hello world
tutorial for web service we
discussed about creating a service based on soap using Netbeans. This micro
tutorial will help understand some important jargon related to web services. In
near future we will see tutorials based on Eclipse to create web services.
Generally,
- Application
to application communication.
- Interoperability
between disparate systems.
- Communication
over network.
- Exposed
interface is platform independent and internal implementation is
abstracted.
- Enables
loosely coupled design.
- Open protocol
is used for establishing communication.
- Web services
are self contained.
Components
of a Web Service
This is to highlight some of
the important jargons related to web services.
wsdl
Web Services Description
Language (WSDL) is used to describe a web service in an XML file. It covers all
the aspects of a web service like what is the message format, communication
protocol, endpoint, security etc. This is a standard provided by W3C consortium
and widely accepted for web services description.
A wsdl xml file for a web
service is generally expected to be published publicly so that parties seeking
to utilize its services can understand the nature of service and consume it
accordingly.
Ads by Google
Types
Types is an important element
in WSDL. It is used to describe the message attributes and respective types.
XSD is the preferred format to describe the types. Type definition can be given
in a separate XSD file and imported in WSDL.
<definitions .... >
<types>
<xsd:schema .... />*
</types>
</definitions>
UDDI
Universal Description,
Discovery and Integration (UDDI) is a directory service. Web services can
register with a UDDI and make themselves available through it for discovery. It
is like a marriage broker :-) People ready to get married will describe themselves
in a standard format (WSDL) and register with this directory. People seeking
pair will approach this directory and discover based on the information
provided and approach.
Stub and Skeleton
Stub and skeleton are
counterparts in a web service setup. Skeleton belongs to service provider side
and stub belongs to receiver side. At lower level stub and skeleton communicate
with each other. From client side the business objects communicates with stub
objects and stub takes the responsibility form the message and invoke the web
service. Once the invoking is done, at service provider side, skeleton is the
parallel object for stub and it receives the request message and understands it
and passes on the information to service side business objects.
Endpoint
An endpoint is a particular
network location with associated protocol which includes message format mapping
using which we can access that instance of web service. This is described in
WSDL file. Consider this as a handle using which we will access the web
service.
Binding
Associating an interface with
a protocol and message format is binding. It is used in endpoint definition.
Binding is described in WSDL.
Operation
A single logical grouping of a
meaningful action which comprises a request and response is an operation. Group
of operations forms a web service.
SOAP
Simple Object Access Protocol
is a XML based specification for web services message format and communication
over network. That is it helps to describe the transport method and message
format in a web service.
Message
Data that is used to
communicate to and fro with a web service is a message. It is a standalone
entity which comprises of complete information for a request or a response.
Web
Service Design
As given in diagram a web
service has logic and an interface. Logic is the actual service provided and
interface is used to communicate with the web service. Interface definition is
given in WSDL. There are two approaches in implementing a web service and they
are bottom-up and top-down.
Bottom Up Approach
Bottom up approach is where we
first define the logic of a web service and then using that we will build the
interface. Service code is written first and then the WSDL is created using the
service code. There are tools available to generate the wsdl file automatically
based on it.
Top Down Approach
Top down is the reverse of
bottom up approach. First the service definition is written up. WSDL is created
first. The complete service definition, message format, transport protocol,
security and everything is described in WSDL. Then service is written after the
WSDL. Using that wsdl the skeleton code is generated automatically and after
that the service code is filled up.
This Web Service tutorial was
added on 06/10/2012.
No comments:
Post a Comment