In this tutorial we are going to see brief overview of web service and important jargons used in web service.
Web Service
Web service is the way of communication, which enables application to communicate with an API.Web Service used to expose business logic through an API interface where different applications communicate over the network.Web service enables interoperability between different applications running on different platforms.For example a Dot Net based application which is runs on Windows operating system can communicate with Java based application which is runs on Linux operating system.This communication can be done through set of XML (SOAP) messages over HTTP protocols.
Web service is developed based on XML,HTTP,SOAP,WSDL,UDDI,etc.
Web service used for
1. SOAP – Simple Object Access Protocol
SOAP is based specification for web service message format to communicate over network. It is used to define transport method and message format in web service.
2. WSDL – Web Service Description Language
WSDL used to describe the details of web service such as how to implement web service, URI, port, method names, arguments, and data types. WSDL is XML so is both human readable and machine consumable.WSDL used to call and bind the service.
WSDL for web service is published publicly so client can understand the nature of service and consume it accordingly.
Component of WSDL
1. Description
Its is the root element of WSDL file which contains set of name space declarations which are used WSDL file
2. Types
Types used to describe the message attribute and data types attributes. Data types are usually specified by XML schema.
3. Binding
It is used to describe how the web service is bound to protocol (how the web service is accessible ). The web service must be accessible using some network protocols.This is called binding web service to protocol.
4. Interface
It is used to describe the operations supported by web service.
5. Service
It describe the end point of web service (The address where the web service can be accessible).
6. End point
It describes the address where the web service can be accessible . The endpoint binding describes the protocol with which you will access the web service. The address attribute describes the URI at which you can access the web service.
7. Message
The message describe the data being exchanged between the web service provider and consumers.
8. Operation
Logical grouping of meaningful action into single group which comprises a request and response operation.
Sample WSDL
3. UDDI – Universal Description, Discovery and Integration
UDDI is directory service.Web service can register with UDDI and make themselves available through it for discovery.
Stub and Skeleton
Stub and Skeleton are important component of web service. The Stub is created at client side and the Skeleton created at service provider side. In web service stub and skeleton communicate with each other.The client side object communicate with stub object, stub takes the responsibility of form message and invoke web service
Types Web Service Design
1. Bottom Up Approach
In this approach we first write service code and by using service code we will create WSDL. There is various tools available to generate WSDL.
2. Top Down Approach
In this approach we first WSDL then using WSDL we will create service code.
Web Service
Web service is the way of communication, which enables application to communicate with an API.Web Service used to expose business logic through an API interface where different applications communicate over the network.Web service enables interoperability between different applications running on different platforms.For example a Dot Net based application which is runs on Windows operating system can communicate with Java based application which is runs on Linux operating system.This communication can be done through set of XML (SOAP) messages over HTTP protocols.
Web service is developed based on XML,HTTP,SOAP,WSDL,UDDI,etc.
Web service used for
- Interoperability between different system.
- Application to application communication.
- Communication over network (Internet or LAN) .
- Loosely coupled design.
- Self contained.
- Open protocols used to establish communication
1. SOAP – Simple Object Access Protocol
SOAP is based specification for web service message format to communicate over network. It is used to define transport method and message format in web service.
2. WSDL – Web Service Description Language
WSDL used to describe the details of web service such as how to implement web service, URI, port, method names, arguments, and data types. WSDL is XML so is both human readable and machine consumable.WSDL used to call and bind the service.
WSDL for web service is published publicly so client can understand the nature of service and consume it accordingly.
Component of WSDL
1. Description
Its is the root element of WSDL file which contains set of name space declarations which are used WSDL file
2. Types
Types used to describe the message attribute and data types attributes. Data types are usually specified by XML schema.
3. Binding
It is used to describe how the web service is bound to protocol (how the web service is accessible ). The web service must be accessible using some network protocols.This is called binding web service to protocol.
4. Interface
It is used to describe the operations supported by web service.
5. Service
It describe the end point of web service (The address where the web service can be accessible).
6. End point
It describes the address where the web service can be accessible . The endpoint binding describes the protocol with which you will access the web service. The address attribute describes the URI at which you can access the web service.
7. Message
The message describe the data being exchanged between the web service provider and consumers.
8. Operation
Logical grouping of meaningful action into single group which comprises a request and response operation.
Sample WSDL
This WSDL file taken from official web site of Axis2
<wsdl:definitions xmlns:axis2="http://quickstart.samples/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns="http://quickstart.samples/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://quickstart.samples/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://quickstart.samples/xsd">
<xs:element name="getPrice">
<xs:complexType>
<xs:sequence>
<xs:element name="symbol" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPriceResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="update">
<xs:complexType>
<xs:sequence>
<xs:element name="symbol" nillable="true" type="xs:string" />
<xs:element name="price" nillable="true" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPriceMessage">
<wsdl:part name="part1" element="ns:getPrice" />
</wsdl:message>
<wsdl:message name="getPriceResponseMessage">
<wsdl:part name="part1" element="ns:getPriceResponse" />
</wsdl:message>
<wsdl:message name="updateMessage">
<wsdl:part name="part1" element="ns:update" />
</wsdl:message>
<wsdl:portType name="StockQuoteServicePortType">
<wsdl:operation name="getPrice">
<wsdl:input message="axis2:getPriceMessage" />
<wsdl:output message="axis2:getPriceResponseMessage" />
</wsdl:operation>
<wsdl:operation name="update">
<wsdl:input message="axis2:updateMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StockQuoteServiceSOAP11Binding" type="axis2:StockQuoteServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="getPrice">
<soap:operation soapAction="urn:getPrice" style="document" />
<wsdl:input>
<soap:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="update">
<soap:operation soapAction="urn:update" style="document" />
<wsdl:input>
<soap:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="StockQuoteServiceSOAP12Binding" type="axis2:StockQuoteServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="getPrice">
<soap12:operation soapAction="urn:getPrice" style="document" />
<wsdl:input>
<soap12:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="update">
<soap12:operation soapAction="urn:update" style="document" />
<wsdl:input>
<soap12:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="StockQuoteService">
<wsdl:port name="StockQuoteServiceSOAP11port" binding="axis2:StockQuoteServiceSOAP11Binding">
<soap:address location="http://localhost:8080/axis2/services/StockQuoteService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
3. UDDI – Universal Description, Discovery and Integration
UDDI is directory service.Web service can register with UDDI and make themselves available through it for discovery.
Stub and Skeleton
Stub and Skeleton are important component of web service. The Stub is created at client side and the Skeleton created at service provider side. In web service stub and skeleton communicate with each other.The client side object communicate with stub object, stub takes the responsibility of form message and invoke web service
Types Web Service Design
1. Bottom Up Approach
In this approach we first write service code and by using service code we will create WSDL. There is various tools available to generate WSDL.
2. Top Down Approach
In this approach we first WSDL then using WSDL we will create service code.
0 comments:
Post a Comment