Web Service Ali Kamandi kamandi@ce.sharif.edu Sharif University of Technology Internet Engineering (CE317) Spring 2007
Service Oriented Architecture (SOA) There is an increase trend for sharing resource/data both � within companies and among companies In a SOA, the complete value chain within the company is � divided into small services. Focus on how services are described and organized to support � the dynamic, automated discovery and use. Companies should be able to easily provide services. Others � can use these services. 2
Requirements of SOA � Interoperability between different systems and programming languages. (Use standards; platform independent) � Clear and unambiguous description language � Retrieval of the service 3
Service-Oriented Architecture Consists of three basic components 4
What is Web Services (1) � A Web Service is a software component � platform-independent, � language-independent � Web Services can be used to realize service oriented architecture. � Web services are modular applications that can be described, published, located, and invoked over a network 5
What is Web Services (2) � The Web technologies used: � XML (Extensible Markup Language) � SOAP (Simple Object Access Protocol) allow client to call remote service. The msg format is XML. � WSDL (Web Services Description Language) � UDDI (Universal Description, Discovery, and Integration) a standard used for publishing/query web services 6
Short History of Web Services (1) � HTTP protocol facilitates Human-to- Application (H2A) communications. � There is an increasing demand for Application-to-Application communication using existing techniques. � HTTP is not adequate for more complex operations. E.g., remote operation 7
Short History of Web Services (2) � Late 1999, Microsoft published SOAP an XML- based protocol. � IBM supports SOAP early 2000. � May 2000 W3C Note: SOAP 1.1. � The term Web services was coined several months later, when WSDL was published. � March 2001 W3C Note: WSDL1.1 � 2002, UDDI 1.0 were also introduced 8
A Brief History … 9
HTTP Vs. Web Service 10
More About Web Services � Your Web service will sit behind a Web server, typically Internet Information Server (IIS). � Support loosely coupled connections between systems. � Works through existing proxies and firewalls. � Can take advantage of HTTP authentication. � Web services only receive and return XML. � Provide a stateless model. 11
Advantages Advantages of Web services over previous � distributed component architectures (OMG's CORBA, Microsoft's DCOM, or Java RMI): � near-universal agreement on standards really running across multiple platforms � � loosely specified and coupled � build on top of existing infrastructure like HTTP and XML. 12
Web Service URI � Every Web service has its home, where it lives. � Its address is defined by a URI (URL). � This address is often called an endpoint � For exampe: http://localhost:6060/ChatService/ 13
Components � Web services are based on 3 main underlying technologies � SOAP � WSDL (Web Services Description Language) � UDDI (Universal Discovery, Description, and Integration) 14
Components 15
Components 16
When to Use Web Services? 1. Where applications need to communicate across platform boundaries and over the Internet: 2. Business to Business Integration 3. Application Integration 17
Software Reuse � Software reuse has always been limited by one key factor: you can reuse the code but not the data behind the code. � Web services let you reuse code along with the data it needs. � Example: validating email address, city, zip code. � Building an application that aggregates the functionality of several other applications 18
When Not to Use Web Services Single Machine Applications Applications that need to communicate with others running on the same machine. In this case, it is almost always better to use a native API rather than a Web service because they require relatively little overhead. Homogeneous Applications on a LAN Homogenous applications running on the same machine or on different machines that need to communicate on the same LAN. 19
Web Service Review Service Side •Write the service code –Expects SOAP as input •Define the externally visible methods •Create the WSDL description of those methods •Publish the WSDL •Run the service Client Side •Locate the WSDL •Load the WSDL •Convert to a client proxy •Write the client code, calling proxy –Generates and sends SOAP 20
How does it work? � With Web services, you have a server and a client. � It's comparable to the ordinary HTML-based Internet, where you have an HTTP-based Web server that responds to Web browser requests by sending HTML pages. � By contrast, with Web services there's an HTTP- based SOAP server that listens for SOAP requests from client applications. � The SOAP server interprets the requests and then replies to the client. 21
How does it work? � The reply might consist of � a description of the server's available Web services, presented in WSDL; � data encapsulated in a well-formed XML document � … 22
How does it work? � SOAP requests could launch applications and pass data to an application � server trigger a database operation � 23
Exchange Scenarios � You can have different exchange scenarios � One-way message scenarios � Request-response scenarios (when a request document must be followed with the response document) � … 24
SOAP � What is SOAP? � SOAP stands for Simple Object Access Protocol simple (to use, not necessarily to write) � � to let applications exchange information over HTTP ( via Internet) . SOAP is XML based communication protocol � � SOAP is for communication between applications 25
SOAP � What is SOAP? SOAP is a format for sending messages � � SOAP is platform independent � SOAP is language independent SOAP is based on XML � SOAP allows you to get around firewalls � 26
The Envelope � The SOAP envelope is analogous to the envelope of an actual letter. � It supplies information about the message: � data relating to the recipient and sender � details about the message itself. 27
SOAP Request Example POST /InStock HTTP/1.1 Host: www.stock.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?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> 28
SOAP Response Example HTTP/1.1 200 OK Content-Type: application/soap; charset=utf-8 Content-Length: nnn <?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> 29
SOAP Benefits � Language/Platform Independence � Easy to use � Is sent over HTTP � Which allows you to get around tricky issues like firewalls � … 30
Disadvantages of SOAP Based on HTTP, and is therefore � Stateless � Based on a request/response architecture – Implies no callback � functionality Performance is slightly degraded for the following reasons: � An XML processor needs to be loaded each time to parse a SOAP � request/response Currently supports only parameter serialization by value � 31
Web Services Standards Stack: Key Elements Discovery ���� Composition ������� (Individual) Service ���� Description XML ���� Messaging Network ��������������������� 32
What is UDDI? Universal Description, Discovery, and Integration � UDDI deals with registering and discovery of Web services. � 33
UDDI Overview � UDDI defines the operation of a service registry: � Data structures for registering � SOAP Access API � Global/Private registry 34
UDDI continued The data captured within UDDI is divided into three main categories: White Pages: This includes general information about a specific � company. For example, business name, business description, and address. Yellow Pages: This includes general classification data for either the � company or the service offered. For example, this data may include industry, product, or geographic codes based on standard taxonomies. Green Pages: This includes technical information about a Web � service. Generally, this includes a pointer to an external specification, and an address for invoking the Web service. 35
How are Web Services Described? � Web Services are described using WSDL (Web Services Description language). � WSDL is an XML-based grammar for describing Web services, their functions, parameters, and return values. 36
Recommend
More recommend