Web Services:
2-Contract First or
WSDL First Services (Top-Down Approach)
“Web services are set of standards that enable to
interoperable integration between disparate process and systems, running on variety
of platforms and frameworks”.
Simple term of web
services def
Web service is a
small unit of program which allows us to create client/server applications. It
is yet another distributed computing technology like Corba, RMI, and EJB etc.
It is used to
access distributed resources like
- Web Services access to shared data
- Web Services access to shared program
- Web Services connect system and devices (like CPU, Memory, printer, etc.)
- Web Services provide communication between different technology applications
Web Services are
·
Web Services platform independent.
·
Web Services language independent.
·
Web
Services implementation independent.
·
Web services make application component reusable.
Web Services Architecture:
Web Service Components:
WSDL (Web Service Description
Language): it is XML based description of web services.
it is used to locate and describe the web services.
SOAP (Simple Object Access
Protocol): It is a protocol
for accessing the web services and it is XML based structure used to send and receive
the request and response of services as XML message (SOAP Message).
UDDI (Universal Description,
Discovery and Integration): It is XML based registry to publish service and find the service from
registry.
Web services benefits:
- Language neutrality
- Interoperability
- Industry support
- Application component reusable.
How can create Web
Service:
We can
create web services in Java using different service engine like Apache axis2
and Apache CXF.
Apache Axis2: Axis2 is a Web
Services / SOAP / WSDL engine, the successor to the widely used Apache Axis
SOAP stack. There are two implementations of the Apache Axis2.
Apache CXF: Apache CXF is
an open source services framework. CXF helps you build and develop services
using frontend programming APIs, like JAX-WS and JAX-RS. These services can
speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and
work over a variety of transports such as HTTP, JMS or JBI.
Building Web Services:
We can implement the web
services two ways by using Apache Axis2 or Apache CXF in java.
1-Code First Services
(Bottom-UP Approach).
·
First write a normal java
code.
·
Expose Interface as web
services.
·
WSDL would available for
the client.
·
First write a schema, xsd
and wsdl file.
·
Create interface and other code using
service engine from wsdl.
·
Add business logic.
·
Expose interface with business logic as web
services.
·
Service would be available
for client.