Download presentation
Presentation is loading. Please wait.
1
Distributed Computing 9 Sep,2008
Web Services Distributed Computing 9 Sep,2008 Shahid Mahmood
2
Service A service is a function that is well-defined, self-contained, and does not depend on the context or state of other services
3
What’s Web Service? “Software application identified by a URI, whose interfaces and bindings are capable of being defined, described, and discovered as XML artifacts” – W3C Web Services Architecture Requirements, Oct. 2002 “Programmable application logic accessible using Standard Internet Protocols…” – Microsoft “An interface that describes a collection of operations that are network accessible through standardized XML messaging …” – IBM “Software components that can be spontaneously discovered, combined, and recombined to provide a solution to the user’s problem/request … “ - SUN
4
Web Services: The Next Horizon for e-business
Allow companies to reduce the cost of doing e-business, to deploy solutions faster Need a common program-to-program communications model Allow heterogeneous applications to be integrated more rapidly, easily and less expensively Facilitate deploying and providing access to business functions over the Web
5
Web Service Interface A web service interface generally consists of a collection of operations that can be used by the client over the internet. A web service may either be managed by a web server along with the web pages or it may be totally separate service. Web Servers such as Google, Amazon, Yahoo, eBay provides web service interfaces to manipulate their resources
6
Web services communication pattern
Web services can process XML- formatted SOAP messages. An alternative is the REST(representational state transfer) approach. Web services communication can be Synchronous/Asynchronous Event Based
7
Combination of web services
The ‘travel agent service’ combines other web services hotel booking Travel Agent flight booking hire car booking Service Client
8
Underlying Technologies XML Is the Glue
Program the Web XML Browse the Web HTML TCP/IP Connect the Web Technology Innovation Connectivity Presentation Connecting Applications FTP, , Gopher Web Pages Web Services
9
What is XML? XML is a “use everywhere” data specification
Application X XML Documents Configuration XML XML Repository Database
10
Web services infrastructure and components
Security Service descriptions (in WSDL) Applications Directory service Web Services XML Choreography SOAP URIs (URLs or URNs) HTTP, SMTP or other transport
11
Web Service Stack
12
SOAP: Simple Object Access Protocol
What is SOAP? 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 based on XML SOAP is simple and extensible SOAP will be developed as a W3C standard
13
SOAP: Simple Object Access Protocol
SOAP 1.0: Microsoft, Userland, DevelopMentor Specific to COM and HTTP SOAP 1.1: includes contributions from IBM and Lotus Substitutable transport binding (not just HTTP) Substitutable language binding (e.g. Java) Substitutable data encoding Completely vendor-neutral Independent of: programming language, object model, operating system, or platform SOAP 1.2: current working draft from w3.org “XML Protocol” working group
14
SOAP Message Structure
Request and Response messages Request invokes a method on a remote object Response returns result of running the method SOAP specification defines an “envelop” “envelop” wraps the message itself Message is a different vocabulary Namespace prefix is used to distinguish the two parts Application-specific message vocabulary SOAP Envelop vocabulary
15
SOAP message in an envelope
header body header element body element
16
SOAP Example of a simple request without headers
m:exchange env:envelope xmlns:env =namespace URI for SOAP envelopes m:arg1 env:body xmlns:m = namespace URI of the service description Hello m:arg2 World In this figure and the next, each XML element is represented by a shaded box with its name in italic followed by any attributes and its content
17
Example of a reply to the request
env:envelope xmlns:env = namespace URI for SOAP envelope m:res1 env:body xmlns:m = namespace URI for the service description m:res2 World m:exchangeResponse Hello
18
HTTP POST Request in SOAP client-server communication
endpoint address action POST /examples/stringer Host: Content-Type: application/soap+xml Action: <env:envelope xmlns:env= namespace URI for SOAP envelope > <env:header> </env:header> <env:body> </env:body> </env:Envelope> message Soap header HTTP
19
SOAP Request Message <?xml version="1.0"?> <soap:Envelope
Namespace <?xml version="1.0"?> <soap:Envelope xmlns:soap=" soap:encodingStyle=" <soap:Body xmlns:m=" </soap:Body> </soap:Envelope> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> Message SOAP Envelope Message Namespace
20
SOAP Response Message <?xml version="1.0"?> <soap:Envelope
xmlns:soap=" soap:encodingStyle=" <soap:Body xmlns:m=" </soap:Body> </soap:Envelope> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> Message Result returned in Body SOAP Envelope
21
Why SOAP? Other distributed technologies failed on the Internet
Unix RPC – requires binary-compatible Unix implementations at each endpoint CORBA – requires compatible ORBs RMI – requires Java at each endpoint DCOM – requires Windows at each endpoint SOAP is the platform-neutral choice Simply an XML wire format Places no restrictions on the endpoint implementation technology choices
22
SOAP Usage Models RPC-like message exchange
Request message bundles up method name and parameters Response message contains method return values However, it isn’t required by SOAP SOAP specification allows any kind of body content Can be XML documents of any type Example: Send a purchase order document to the inbox of B2B partner Expect to receive shipping and exceptions report as response
23
Web Services Description Language
What is WSDL? WSDL is an XML document WSDL is used to describe Web services WSDL is also used to locate Web services WSDL is a W3C standard Operational information about the service Location of the service Service interface Implementation details for the service interface
24
Web Services Description Language (WSDL)
is a format for describing a Web Services interface. It is a way to describe services and how they should be bound to specific network addresses. WSDL has three parts: Definitions Operations Service bindings
25
WSDL 2.0 Interface definition for Stock Quote Service
<?xml version="1.0"?> <definitions name="StockQuote“ targetNamespace=" xmlns:tns=" xmlns:xsd1=" xmlns:soap=" xmlns=" <import namespace=" location=" <types> <schema targetNamespace=" <element name="GetLastTradePriceInput" type="xsd1:TradePriceRequest"/> <element name="GetLastTradePriceOutput" type="xsd1:TradePrice"/> </schema> </types> <interface name="StockQuoteInterface"> <operation name="GetLastTradePrice" pattern=" <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation> </interface> </definitions>
26
WSDL 2.0 Implementation definition for Stock Quote Service
<definitions name="StockQuote“ targetNamespace=" xmlns:tns=" xmlns:wsoap=" xmlns:defs=" xmlns=" <import namespace=" location=" <binding name="StockQuoteSoapBinding" interface="defs:StockQuoteInterface"> <wsoap:binding protocol=" <operation name="GetLastTradePrice"> <wsoap:operation soapAction=" <input> <wsoap:body/> </input> <output> <wsoap:body/> </output> </operation> </binding> <service name="StockQuoteService"> <documentation>My stock quote service</documentation> <endpoint name="StockQuoteEndPoint" binding="tns:StockQuoteSoapBinding"> <wsoap:address location=" </endpoint> </service> </definitions>
27
WSDL – DEFINITION Are generally expressed in XML, include both data type definitions and message definitions that use the data type definitions. These definitions are usually based upon some agreed upon XML vocabulary agreement. within an organization or between organizations. industry-wide vocabulary. If data type and message definitions need to be used between organizations, then most likely an industry-wide vocabulary will be used BussinessXML, AccoutingXML, PhysicsXML, LegalXML, MathXML
28
WSDL - OPERATION Operations describe actions for the messages supported by a Web service. There are four types of operations: One-way: Messages sent without a reply required Request/response: The sender sends a message and the received a reply. Solicit response: A request for a response. (The specific definition for this action is pending.) Notification: Messages sent to multiple receivers. (The specific definition for this action is pending.)
29
WSDL – SERIVCE BINDING Service bindings connect port types to a port.
A port is defined by associating a network address with a port type. A collection of ports defines a service. This binding is commonly created using SOAP, but other forms may be used. These other forms could include CORBA Internet Inter-ORB Protocol (IIOP), DCOM, .NET, Java Message Service (JMS), o WebSphere MQ to name a few.
30
Basic Parts of WSDL
31
WSDL 2.0 Conceptual Model
32
WSDL 2.0 Skeleton <definitions targetNamespace="xs:anyURI"> <documentation /> ? [<import /> | <include /> ] * <types /> ? [<interface /> | <binding /> | <service /> ] * </definitions>
33
WSDL 2.0 Skeleton - Definitions
root element of any WSDL document. serves as a container which holds all the necessary information about the service and its attributes. targetNamespace attribute of the definitions element is a required attribute of type anyURI. The namespace can directly or indirectly define the semantics of the WSDL. Also, the definitions element can have other optional attributes which correspond to various namespaces that may be used with in the WSDL document.
34
WSDL 2.0 Skeleton – Include & Import
element helps to modularize the web service descriptions. The location attribute is mandatory and specifies the location of these WSDL documents. The actual value of the target namespace of the included WSDL must match the target namespace of the definitions element in the including WSDL Import The concept behind the import element is very similar to that of include element, except that the imported WSDL can be in different target namespaces. The namespace attribute for the import element is mandatory while the location attribute is optional.
35
WSDL 2.0 Skeleton – Types Types
element defines the data types used by the exchanged messages. WSDL uses W3C XML Schema as its preferred schema language. Schemas may be used by importing or embedding within the types element of the WSDL document. Importing can be done using the construct xs:import while embedding uses the construct xs:schema.
36
WSDL 2.0 Skeleton – Interface
element encloses a named set of abstract operations and the abstract messages. can optionally extend one or more other interfaces. interface operation element has name and pattern as required attributes, while style is an optional attribute. Features defines functionalities associated with the message exchanges between communicating parties, which might include reliability, security, correlation, and routing. Property is used to control the behavior of a feature. It has a set of possible and permissible values specified by references to a schema description.
37
WSDL 2.0 Skeleton – Binding
element defines the underlying transport and wire format for messages. Each binding in the WSDL references to an interface. All operations defined within the interface must be bound in the binding. An endpoint in the service component references a binding. Both endpoints and bindings are modeled to support flexibility and location transparency. Multiple endpoints with different network address can still share the same protocol binding. WSDL 2.0 Bindings specification defines binding extensions for protocols and message formats such as SOAP, HTTP and MIME.
38
WSDL 2.0 Skeleton – Service
element describes a set of endpoints which refer to a single network address for a binding. All other protocol specific information is contained in the binding. Service can be referred by QName. service element has a name and interface which are required attributes.
39
Universal Description, Discovery and Integration (UDDI)
What is UDDI? Directory service where businesses can register and search for Web services Directory for storing information about web services Directory of web service interfaces described by WSDL UDDI communicates via SOAP What is UDDI Based On? Uses W3C Internet standards such as XML, HTTP, and DNS protocols UDDI uses WSDL to describe interfaces to web services
40
WSDL 2.0 Infoset, Schema and Component Model
41
UDDI Roles and Operations
Service Registry Provides support for publishing and locating services Like telephone yellow pages Service Provider Provides e-business services Publishes these services through a registry Service requestor Finds required services via the Service Broker Binds to services via Service Provider
42
UDDI Registries and Protocol
UDDI The Vision Advanced Discovery via Portals and Marketplaces Marketplace UDDI Registries and Protocol Marketplace Marketplace The Universal Description, Discovery and Integration (UDDI) specifications define a means for publishing and discovering Web Services. In the light of DISCO it may seem redundant, but UDDI provides more features than DISCO, and arguably in a more efficient manner. UDDI is based upon a directory service or Business Registry. Businesses can register themselves, their type of business, and technical descriptions of any Web Services they publish in the registry. Other business can query the registry, searching for partners using compatible software or offering Web Services that they could interact with. The aim is to promote faster B2B integration. There are several UDDI registries available, including one at and a test registry at Naturally, all interactions with a UDDI registry are performed using a defined XML schema, and SOAP. Search Portal Search Portal Business Users Technical Users
43
How can UDDI be Used?
44
UDDI Benefits Making it possible to discover the right business from the millions currently online Defining how to enable commerce once the preferred business is discovered Reaching new customers and increasing access to current customers Expanding offerings and extending market reach
45
Thank U
46
Lecture has prepared from Sir Atif Kamal slides with some modifications and enhancement
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.