Introduction To Web Services: S.Sasirekha
Introduction To Web Services: S.Sasirekha
S.Sasirekha
History
Web services evolved from previous technologies that served the same purpose such as RPC, ORPC (DCOM, CORBA and JAVA RMI). Web Services were intended to solve three main problems: 1. Interoperability 2. Firewall traversal 3. Complexity
Interoperability
Earlier distributed systems suffered from interoperability issues because each vendor implemented its own on-wire format for distributed object messaging. Development of DCOM apps strictly bound to Windows Operating system. Development of RMI bound to Java programming language.
Firewall traversal
Collaboration across corporations was an issue because distributed systems such as CORBA and DCOM used non-standard ports. Web Services use HTTP as a transport protocol and most of the firewalls allow access though port 80 (HTTP), leading to easier and dynamic collaboration.
Complexity
Web Services is a developer-friendly service system. Most of the above-mentioned technologies such as RMI, COM, and CORBA involve a whole learning curve. New technologies and languages have to be learnt to implement these services.
1. publish
2. find
XML
XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe data. XML tags are not predefined. You must define your own tags. The prefect choice for enabling cross-platform data communication in Web Services.
XML vs HTML
An HTML example:
<html> <body> <h2>John Doe</h2> <p>2 Backroads Lane<br> New York<br> 045935435<br> [email protected]<br> </p> </body> </html>
XML vs HTML
This will be displayed as:
John Doe 2 Backroads Lane New York 045935435 [email protected]
HTML specifies how the document is to be displayed, and not what information is contained in the document. Hard for machine to extract the embedded information. Relatively easy for human.
XML vs HTML
Now look at the following:
<?xml version=1.0?> <contact> <name>John Doe</name> <address>2 Backroads Lane</address> <country>New York</country> <phone>045935435</phone> <email>[email protected]</email> </contact>
In this case: The information contained is being marked, but not for displaying. Readable by both human and machines.
SOAP
SOAP originally stood for "Simple Object Access Protocol" . Web Services expose useful functionality to Web users through a standard Web protocol called SOAP. Soap is an XML vocabulary standard to enable programs on separate computers to interact across any network. SOAP is a simple markup language for describing messages between applications. Soap uses mainly HTTP as a transport protocol. That is, HTTP message contains a SOAP message as its payload section.
SOAP Characteristics
SOAP has three major characteristics: Extensibility security and WS-routing are among the extensions under development. Neutrality - SOAP can be used over any transport protocol such as HTTP, SMTP or even TCP. Independent - SOAP allows for any programming model .
SOAP Request
POST /InStock HTTP/1.1 Host: www.stock.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 150 <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle=http://www.w3.org/2001/12/soap-encoding> <soap:Body xmlns:m="http://www.stock.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
SOAP Response
HTTP/1.1 200 OK Content-Type: application/soap; charset=utf-8 Content-Length: 126 <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.stock.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>
SOAP Security
SOAP uses HTTP as a transport protocol and hence can use HTTP security mainly HTTP over SSL. But, since SOAP can run over a number of application protocols (such as SMTP) security had to be considered. The WS-Security specification defines a complete encryption system.
WSDL
WSDL stands for Web Services Description Language. WSDL is an XML vocabulary for describing Web services. It allows developers to describe Web Services and their capabilities, in a standard manner. WSDL specifies what a request message must contain and what the response message will look like in unambiguous notation. In other words, it is a contract between the XML Web service and the client who wishes to use this service. In addition to describing message contents, WSDL defines where the service is available and what communications protocol is used to talk to the service.
WSDL Document
<message name="GetStockPriceRequest"> <part name="stock" type="xs:string"/> </message> <message name="GetStockPriceResponse"> <part name="value" type="xs:string"/> </message> <portType name=StocksRates"> <operation name=GetStockPrice"> <input message=GetStockPriceRequest"/> <output message=GetStockPriceResponse"/> </operation> </portType>
UDDI
UDDI stands for Universal Description, Discovery and Integration. UDDI is a directory for storing information about web services , like yellow pages. UDDI is a directory of web service interfaces described by WSDL.
Yes Yes