Web services are web application components that allow different software applications to communicate with each other using open protocols. They use XML to code and to decode data, SOAP to transfer data, WSDL to describe services and UDDI to list the available services.
Web Service facts
- Web services are available over the internet or private networks
- Web services use a standardized XML messaging system and communicate using open protocols
- Web services are self-contained – not tied to any one operating system or programming language
- Web services are self-describing – via a common XML grammar
- Web services can be discovered using UDDI
- The basic web services platform is XML + HTTP
Web services can be organized in 2 categories based on the type of use:
- Reusable application-components
- Connect existing software
Some web service components are used by more than one application. Example: currency conversion, Weather reports etc.
Using web services we can solve the interoperability problem. There is no problem in exchanging data between different software applications across different platforms and/or frameworks.
Web services standard components
- SOAP (Simple Object Access Protocol)
This is an open-standard, XML-based messaging protocol for exchanging information among computers. A standard SOAP message will look like this:
<envelope/> <header/> <body/> <fault/>
Mandatory elements: envelope, body.
Optional elements: body, fault.
This is an XML grammar for specifying an interface for a web service. It specifies the location of web service, methods that are available by the web service and the data type information for all XML messages. This is the main structure of a WSDL document:
<definitions> <types> Data type definitions </types> <message> Definition of the data being communicated </message> <portType> Set of operations </portType> <binding> Protocol and data format specification </binding> </definitions>
This is a XML-based standard for describing, publishing, and finding web services. It represents the discovery layer in the protocol stack.
Web service architecture
Web service architecture has 3 major roles:
- Service Provider
- Service Requestor
- Service Registry
Represents a server on which it runs application server software such as Apache TomEE, IBM WebSphere, Oracle WebLogic, JBoss, GlassFish. This creates the web service and makes it available on the Internet.
Represents any consumer of the web service.
Represents a logically centralized directory of services.
A. The SERVICE PROVIDER sends a WSDL file to the SERVICE REGISTRY(UDDI).
B. The SERVICE REQUESTER contacts SERVICE REGISTRY(UDDI) to find out who is the provider for the data it needs.
C. The SERVICE REQUESTER contacts the SERVICE PROVIDER using SOAP.
D. The SERVICE PROVIDER validates the SERVICE REQUESTER and sends structured data in an XML file, using SOAP. This XML file would be validated again by the SERVICE REQUESTER using an XSD file.