Web Services

1,011 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,011
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
49
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Web Services

  1. 1. Web Services - I <ul><li>Objectives: </li></ul><ul><li>Background </li></ul><ul><li>Component Technologies of Web Services </li></ul><ul><li>Web services: Business view </li></ul><ul><li>Web Services architecture </li></ul><ul><li>Building blocks of a Web service application </li></ul>
  2. 2. Background <ul><li>In the 80s and 90s, client/server applications were primarily data-centric in nature </li></ul><ul><ul><li>focus was more on retrieval and display of data than on the business rules of the application </li></ul></ul><ul><li>Web application architectures changed all of this </li></ul><ul><ul><li>Web applications are based on a distributed architecture </li></ul></ul><ul><ul><li>Web applications tended more to a service-oriented architecture </li></ul></ul><ul><ul><li>Examples of inherently service-oriented distributed technologies are </li></ul></ul><ul><ul><ul><li>Remote Procedure Calls (RPC) </li></ul></ul></ul><ul><ul><ul><li>Remote Method Invocation (RMI) </li></ul></ul></ul><ul><ul><ul><li>Common Object Request Broker Architecture (CORBA) </li></ul></ul></ul>
  3. 3. Background <ul><li>Talking about service-oriented architecture, a few things come up </li></ul><ul><ul><li>Common communication language </li></ul></ul><ul><ul><li>A service providing application and a client application using the service need to locate each other before they start talking </li></ul></ul><ul><li>Hence, a basic service-oriented architecture for Web Services has: </li></ul><ul><ul><li>A standard way for communication </li></ul></ul><ul><ul><li>A uniform data representation and exchange mechanism </li></ul></ul><ul><ul><li>A standard meta language to describe the services offered </li></ul></ul><ul><ul><li>A mechanism to register and locate Web Services-based applications </li></ul></ul>
  4. 4. Background <ul><li>Today’s Web is designed for application to human interactions </li></ul><ul><ul><li>B2C e-commerce </li></ul></ul><ul><ul><li>Non-automated B2B interactions </li></ul></ul><ul><li>Since the Web is everywhere, we can do more </li></ul><ul><ul><li>E-marketplaces </li></ul></ul><ul><ul><li>Open and automated B2B e-commerce </li></ul></ul><ul><ul><li>Enhance resource sharing and distributed computing </li></ul></ul><ul><li>In a nutshell, </li></ul><ul><ul><li>Web services is an effort to build a distributed computing platform for the Web </li></ul></ul>
  5. 5. Component Technologies of Web Services <ul><li>Consider a scenario in which you need to locate a particular pharmacy store in your area </li></ul><ul><ul><li>You might refer the Web site of the pharmacy on the Internet </li></ul></ul><ul><ul><li>If you knew the pharmacy's Web site, you would look it up directly and find the location through the store locator link </li></ul></ul><ul><ul><li>If not, you would go to a search engine and type out the name of the pharmacy in the language that the search engine was meant to recognize </li></ul></ul><ul><ul><li>After getting the location, you would find the directions to the store, and then go to the store </li></ul></ul>
  6. 6. Component Technologies of Web Services <ul><li>Consider a scenario in which you need to locate a particular pharmacy store in your area </li></ul><ul><ul><li>You might refer the Web site of the pharmacy on the Internet </li></ul></ul><ul><ul><li>If you knew the pharmacy's Web site, you would look it up directly and find the location through the store locator link </li></ul></ul><ul><ul><li>If not, you would go to a search engine and type out the name of the pharmacy in the language that the search engine was meant to recognize </li></ul></ul><ul><ul><li>After getting the location, you would find the directions to the store, and then go to the store </li></ul></ul><ul><ul><li>Web Services provide for each of these above described activities </li></ul></ul>
  7. 7. Component Technologies of Web Services <ul><li>SOAP (Simple Object Access Protocol) is the method by which you can send messages across different modules </li></ul><ul><ul><li>This is similar to how you communicate with the search engine that contains an index with the Web sites registered in the index associated with the keywords </li></ul></ul><ul><li>UDDI (Universal Description, Discovery, and Integration) is the global look up base for locating the services </li></ul><ul><ul><li>In our example, this is analogous to the index service for the search engine, in which all the Web sites register themselves associated with their keywords. It maintains a record of all the pharmacy store locations throughout the country </li></ul></ul>
  8. 8. Component Technologies of Web Services <ul><li>WSDL (Web Services Definition Language) is the method through which different services are described in the UDDI </li></ul><ul><ul><li>This maps to the actual search engine in our example </li></ul></ul>
  9. 9. Technology Stack of Web Services The &quot;yellow pages&quot; of Web Services is the Universal Description Discovery and Integration (UDDI). Web Services application providers are listed in a registry of service providers using UDDI. Similarly, client applications locate Web Services application providers using UDDI. Like in the case of WSDL, UDDI also is based on XML. UDDI Registering and locating Web Services Web Services provider applications advertise the different services they provide using a standard meta language called the Web Services Description Language (WSDL). Interestingly, WSDL is based on XML and uses a special set of tags to describe a Web service, services provided, where to locate it, and so forth. Client applications obtain information about a Web service prior to accessing and using a Web service of a Web Service provider. WSDL Standard meta language to describe the services offered The Simple Object Access Protocol (SOAP) is the channel used for communication between a Web Services provider application and a client application. The simplicity of SOAP is that it does not define any new transport protocol; instead, it re-uses the Hyper Text Transfer Protocol (HTTP) for transporting data as messages. This use of HTTP as the underlying protocol ensures that Web Services provider applications and client applications can communicate using the Internet as the backbone. It is the use of SOAP that multiplies the capabilities of Web Services and make it all the more exciting! SOAP Standard communication channel Extended Markup Language (XML) is a meta language that has a well-defined syntax and semantics. The syntax and semantics &quot;self describing&quot; features of XML make it a simple, yet powerful, mechanism for capturing and exchanging data between different applications. XML is a tried and tested way for exchanging data and has been extensively used in B2B applications. Hence, XML is used in the Web Services architecture as the format for transferring information/data between a Web Services provider application and a Web Services client application. XML Uniform data representation and exchange Description Technology Layer
  10. 10. Building a Web Services application <ul><li>The basic building blocks in a Web services application are summarized in the following table </li></ul>Wait for processing client requests Receive the response from the service Publish the Web services with a directory service Send the request to the service Deploy the service provider application Locate the Web service by querying a directory service Implement the functionality behind the services Identify the services that will be required Define the services that will be provided Service User Service Provider
  11. 11. Web Services: Business view <ul><li>In the business world, Web services provide a mechanism of communication between two remote systems, connected through the network of the Web Services </li></ul><ul><ul><li>In case of a merger or an acquisition, companies don't have to invest large sums of money developing software to bring the systems of the different companies together </li></ul></ul><ul><ul><li>By extending the business applications as Web Services, the information systems of different companies can be linked </li></ul></ul>
  12. 12. Web Services: Business view
  13. 13. Architecture of Web Services These steps will be the same irrespective of which major technology/programming language that you use to implement the Web service
  14. 14. Underlying standards <ul><li>The basic standards for web services are: </li></ul><ul><ul><li>XML (Extensible Markup Language) </li></ul></ul><ul><ul><li>SOAP (simple object access protocol) </li></ul></ul><ul><ul><li>WSDL (web services description language) </li></ul></ul><ul><ul><li>UDDI (universal description, discovery and integration) </li></ul></ul>
  15. 15. Web Services Architecture <ul><li>Web Services involve three major roles </li></ul><ul><ul><li>Service Provider </li></ul></ul><ul><ul><li>Service Registry </li></ul></ul><ul><ul><li>Service Consumer </li></ul></ul><ul><li>Three major operations surround web services </li></ul><ul><ul><li>Publishing – making a service available </li></ul></ul><ul><ul><li>Finding – locating web services </li></ul></ul><ul><ul><li>Binding – using web services </li></ul></ul>
  16. 16. Web Service Model
  17. 17. Towards a Service-Oriented Architecture (SOA)
  18. 18. SOA and Web services <ul><li>Businesses that successfully implement an SOA using Web services have the following advantages: </li></ul><ul><ul><li>Services aligned with strategic IT business goals can react more quickly to changing business requirements than those who have IT systems aligned to a particular execution environment </li></ul></ul><ul><ul><li>It's easier to combine Web services, easier to change Web services compositions, and cheaper to change the Web services and XML data than it is to change execution environments </li></ul></ul><ul><ul><li>The advantages and benefits of SOA with Web services include </li></ul></ul><ul><ul><ul><li>A better return on investment for IT spending on projects </li></ul></ul></ul><ul><ul><ul><li>A faster time to results for the projects </li></ul></ul></ul><ul><ul><ul><li>The ability to more quickly respond to changing business and government requirements </li></ul></ul></ul><ul><ul><li>Any business that can implement an IT infrastructure that allows it to change more rapidly has an advantage over a business that cannot do the same </li></ul></ul>
  19. 19. Making a service available (1) <ul><li>In order for someone to use your service they have to know about it </li></ul><ul><li>To allow users to discover a service it is published to a registry (UDDI) </li></ul><ul><li>To allow users to interact with a service you must publish a description of it’s interface (methods & arguments) </li></ul><ul><ul><li>This is done using WSDL </li></ul></ul>
  20. 20. Making a service available (2) <ul><li>Once you have published a description of your service you must have a host set up to serve it </li></ul><ul><li>A web server is often used to deliver services </li></ul><ul><li>This is functionality which has to be added to the web server. In the case of the apache web server a ‘container’ application (Tomcat) can be used to make the application (servlet) available to apache (deploying) </li></ul>
  21. 21. The old transfer protocols are still there. <ul><li>Like the grid architecture web services is layered on top of existing, mature transfer protocols </li></ul><ul><li>HTTP, SMTP are still used over TCP/IP to pass the messages </li></ul><ul><li>Web services, like grids, can be seen as a functionality enhancement to the existing technologies </li></ul>
  22. 22. XML <ul><li>All Web Services documents are written in XML </li></ul><SOAP-ENV:Body> <s: Search Request xmlns:s=&quot;http://www.xmlbus.com/SearchService&quot;> <p1> Skate </p1> <p2> boots </p2> <p3> size 7.5 </p3> </s:SearchRequest> </SOAP-ENV:Body> </SOAP-ENV:Body>
  23. 23. XML NAMESPACES <ul><li>The XML namespaces recommendation defines a way to distinguish between duplicate element type and attribute names </li></ul><ul><li>An XML namespace is a collection of element type and attribute names. The namespace is identified by a unique name, which is a URI </li></ul><ul><li>Thus, any element type or attribute name in an XML namespace can be uniquely identified by a two-part name: the name of its XML namespace and its local name </li></ul><ul><li>This two-part naming system is the only thing defined by the XML namespaces recommendation </li></ul><ul><li>XML namespaces are declared with an xmlns attribute, which can associate a prefix with the namespace </li></ul>
  24. 24. Purpose of XML namespaces <ul><li>XML namespaces are designed to provide universally unique names for elements and attributes. This allows for the followings: </li></ul><ul><ul><li>Combine fragments from different documents without any naming conflicts </li></ul></ul><ul><ul><li>Write reusable code modules that can be invoked for specific elements and attributes </li></ul></ul><ul><ul><li>Universally unique names guarantee that such modules are invoked only for the correct elements and attributes </li></ul></ul><ul><ul><li>Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions </li></ul></ul>
  25. 25. Purpose of XML namespaces: Example <ul><li><?xml version=&quot;1.0&quot; ?> </li></ul><ul><li><Address> </li></ul><ul><li><Street>Wilhelminenstr. 7</Street> </li></ul><ul><li><City>Darmstadt</City> </li></ul><ul><li><State>Hessen</State> </li></ul><ul><li><Country>Germany</Country> </li></ul><ul><li><PostalCode>D-64285</PostalCode> </li></ul><?xml version=&quot;1.0&quot; ?> <Server> <Name>OurWebServer</Name> <Address>123.45.67.8</Address> </Server>
  26. 26. SOAP <ul><li>Defines the format of messages on the 'wire' </li></ul><ul><li>Actually used to communicate with the Web Service </li></ul><ul><li>Both the request and the response are SOAP messages </li></ul><ul><li>The body of the message (whose grammar is defined by the WSDL) is contained within a SOAP “envelope” </li></ul><ul><li>“ Binds” the client to the web service </li></ul>
  27. 27. SOAP <ul><li>Today's applications communicate using Remote Procedure Calls (RPC) between objects like DCOM and CORBA </li></ul><ul><li>RPC represents a compatibility and security problem </li></ul><ul><ul><li>firewalls and proxy servers will normally block this kind of traffic </li></ul></ul><ul><li>A better way to communicate between applications is over HTTP </li></ul><ul><ul><li>HTTP is supported by all Internet browsers and servers </li></ul></ul><ul><li>SOAP was created to accomplish this </li></ul><ul><li>SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages </li></ul>
  28. 28. SOAP <ul><li>A SOAP message is an ordinary XML document containing the following elements: </li></ul><ul><ul><li>A required Envelope element that identifies the XML document as a SOAP message </li></ul></ul><ul><ul><li>An optional Header element that contains header information </li></ul></ul><ul><ul><li>A required Body element that contains call and response information </li></ul></ul><ul><ul><li>An optional Fault element that provides information about errors that occurred while processing the message </li></ul></ul><ul><ul><li>All the elements above are declared in the default namespace for the SOAP envelope </li></ul></ul>
  29. 29. SOAP Attachment <ul><li>Large quantities or binary data may not fit well into a XML SOAP message. </li></ul><ul><li>In which case it can be sent ‘out of band’ by attaching it to a SOAP message </li></ul><ul><li>Analogy : email attachments </li></ul>SOAP BODY SOAP ENVELOPE FAULT SOAP HEADER Transport protocol MIME header Attachment
  30. 30. Skeleton SOAP Message <?xml version=&quot;1.0&quot;?> <soap:Envelope xmlns:soap=&quot;http://www.w3.org/2001/12/soap-envelope&quot; soap:encodingStyle=&quot;http://www.w3.org/2001/12/soap-encoding&quot;> <soap:Header> ... ... </soap:Header> <soap:Body> ... ... <soap:Fault> ... ... </soap:Fault> </soap:Body> </soap:Envelope>
  31. 31. Attaching a file to a SOAP message <ul><li>To add a file to a SOAP message a tag is added within the body of the message </li></ul><?xml version=‘1.0’ encoding=‘UTF-8’?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi=“http://www.w3c.org/1999/XMLSchema-instance” xmlns:xsd=“http://www.w3c.org/1999/XMLSchema”> <SOAP-ENV:Body> <attachment href=“{URL}”/> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
  32. 32. What is WSDL <ul><li>WSDL stands for Web Services Description Language </li></ul><ul><li>WSDL is written in XML </li></ul><ul><li>WSDL is an XML document </li></ul><ul><li>WSDL is used to describe Web services </li></ul><ul><li>WSDL is also used to locate Web services </li></ul><ul><li>WSDL is not yet a W3C standard </li></ul><ul><li>Describes the Web Service and defines the functions that are exposed in the Web Service </li></ul>
  33. 33. What is WSDL <ul><li>WSDL is a document written in XML </li></ul><ul><li>The document describes a Web service </li></ul><ul><li>The document specifies the location of the service and the operations (or methods) the service exposes </li></ul>
  34. 34. UDDI <ul><li>UDDI is used to register and look up services with a central registry </li></ul><ul><li>Service Providers can publish information about their business and the services that they offer </li></ul><ul><li>Service consumers can look up services that are available by </li></ul><ul><ul><ul><li>Business </li></ul></ul></ul><ul><ul><ul><li>Service category </li></ul></ul></ul><ul><ul><ul><li>Specific service </li></ul></ul></ul>
  35. 35. UDDI

×