WEBSERVICE (SOURCE WIKIPEDIA):
A Web service is a method of communication between two electronic devices over the Web (Internet).
The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network".
There are two major categories of web services:
- SOAP Web Service
- RESTful Web Service
SOAP Web Service:
Simple Object Access Protocol (SOAP) is a standard protocol specification for message exchange based on XML. Communication between the web service and client happens using XML messages. SOAP defines the rules for communication like what are all the tags that should be used in XML and their meaning.
Representational state transfer (REST):
REST attempts to describe architectures that use HTTP or similar protocols by constraining the interface to a set of well-known, standard operations (like GET, POST, PUT, DELETE for HTTP). Here, the focus is on interacting with stateless resources, rather than messages or operations. Clean URLs are tightly associated with the REST concept.
The information in this blog is only for the begginers to start-up with webservices.
Recommended to explore more on each of this concepts.
Lets continue with the SOAP web services
ARCHITECTURE:
Webservices follows
SOA architecture
Description:
- Service provider will implement a service and makes it ready to serve all the client requests.
- This service is well described by the WSDL.
- To make WSDL available to client, using UDDI it is placed in a logically centralized directory of services. The registry provides a central place where developers can publish new services or find existing ones.
(This part can be skipped by providing the wsdl file directly to the clients)
- By using this wsdl file, client will generate the artifacts and starts communicating with service using SOAP messages.
The Major Web Services Technologies:
- Simple Object Access Protocol (SOAP)
- Web Service Description Language (WSDL)
- Universal Description, Discovery, and Integration (UDDI)
UDDI:
UDDI is an XML-based standard for describing, publishing, and finding Web services.
UDDI stands for Universal Description, Discovery and Integration.
UDDI is a specification for a distributed registry of Web services.
UDDI is platform independent, open framework.
UDDI uses WSDL to describe interfaces to web services.
UDDI is seen with SOAP and WSDL as one of the three foundation standards of web services.
UDDI is an open industry initiative enabling businesses to discover each other and define how they interact over the Internet.
WSDL:
One major component of a web service is Web Services Description Language (WSDL).
WSDL is an xml file that describes the web service technically in a machine readable format.
That is, using this WSDL file we can understand things like,
Port / Endpoint – URL of the web service (using which we should access it)
Input message format
Output message format
Security protocol that needs to be followed (like https)
Which protocol the web service uses
WSDL is pronounced as 'wiz-dull' and spelled out as 'W-S-D-L'
The structure of WSDL looks as:
<definitions>
<types>
.... data type definitions ....
</types>
<messages>
.... definition of the data being communicated ....
</messages>
<portTypes>
.... set of operations ....
</portTypes>
<bindings>
.... protocol and data format specification ....
</bindings>
</definitions>
SOAP:
SOAP is an XML-based protocol for exchanging information between computers.
SOAP is a communication protocol
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP is designed to communicate via Internet
SOAP is platform independent
SOAP is language independent
SOAP is simple and extensible
SOAP allows you to get around firewalls
SOAP will be developed as a W3C standard
example soap message:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetStockPrice xmlns:m="http://www.example.org/stock">
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
Refer next post for
SOAP based Webservices example......