Chapter 1 - Introduction to Web Services Objectives After completing this unit, you will be able to: Describe the basic design for Web service interaction. Explain how Web services can be applied to support various business models. Identify the core Web service technology standards. 1.1 A Conceptual Look at Services Sample copy standard interfaces (serial, monolithic/proprietary design Property of Web Age Solutions Inc. parallel, USB) expensive fixed architecture and capabilities competitive pricing technology locked component-based design vendor locked adaptable to technology innovation vendor-neutral A Conceptual Look at Services The evolution that has taken place in the computing industry is analogous to the evolution that service orientation represents for enterprise systems. It is about transitioning from closed, proprietary solutions to open, standards-based solutions. This carries with it a host of benefits with respect to flexibility and cost. Chapter 1 - Introduction to Web Services 1.2 Defining Services The ‘S’ in SOA is embodied as the configurable enterprise assets that comprise the various layers. Abstractly, services can be described as follows: ◊ Performs one or more well-defined functions. ◊ Is loosely coupled and self contained. ◊ Is almost always stateless. Various enterprise elements can function as services: ◊ CICS/IMS mainframe systems ◊ Distributed computing components (CORBA, EJB, DCOM, etc.) ◊ Messaging systems (MSMQ, IBM MQ, etc.) ◊ Packaged applications (ERP, CRM, etc.) ◊ Home-grown applications ◊ Web services (most popular) Sample copy 1.3 Service Communication Analogy Analogy: Calling an automated system to get flight information or the status of a bank transaction. What? Sequence of prompts, keystrokes, and voice responses Inc. Property of Web Age Solutions necessary to achieve the desired goal ◊ ◊ How? Communication mechanism selection (landline, cellular, or VOIP) ◊ Where? Phone number dialed to initiate call Parallel: Sending electronic messages to a remote system in order to achieve a desired goal. ◊ What? Typically an XML-based interface format. ◊ How? Typically XML messages sent via HTTP. ◊ Where? Some network address (IP, Web, etc.). 2 Chapter 1 - Introduction to Web Services 1.4 Three Key Service Questions What? ◊ What capabilities does this service provide? ◊ What requirements does this service have for potential consumers? ◊ What data, if any, will this service return? How? ◊ How should messages be formatted for this service? ◊ How should messages be submitted to this service (i.e. the transport protocol)? Where? ◊ Where is the service located (IP address or endpoint URL)? Sample copy 1.5 Connecting the Dots What? ◊ How? ◊ Service interface Service binding Where? Property of/ endpoint Web Age Solutions Inc. Service address ◊ Interface Service Binding Service Provider Service Consumer 3 Chapter 1 - Introduction to Web Services 1.6 SOA: Runtime Implementation Interface ◊ Describes the generic interface. ◊ Consist of generic operations and messages that describe a service. ◊ Contains no information on how to invoke the service. Binding ◊ Contains information on how to bind a service to a specific implementation. ◊ Binds operations to actual methods. Address/Endpoint ◊ Describes binding of communication information for calling a service. ◊ Binds service name to implementation details. Sample copy SOA: Runtime Implementation At runtime, only the Binding and Service information is used. The Interface, Binding and Service definitions exist as Web Services Definition Language (WSDL) files. WSDL is discussed in the next few slides. 1.7 Web What Is aAge Web Service? Property of Solutions Inc. “Loosely coupled software components that encapsulate discrete functionality and that are accessible over standard Internet protocols.” – The Stencil Group “Web Services are a new breed of Web application. They are selfcontained, self-describing, modular applications that can be published, located, and invoked across the Web.” – IBM’s Tutorial on Web Services 4 Chapter 1 - Introduction to Web Services Any Anyapplication applicationthat thataccepts acceptsXML-formatted XML-formattedrequests requestsfrom fromother other systems systemsacross acrossaanetwork network(Internet (InternetororIntranet) Intranet)via vialightweight, lightweight, vendor-neutral vendor-neutralcommunications communicationsprotocols. protocols. 1.8 Enterprise Assets as Services Typically, a Web service is used as a mechanism to expose functionality made available by another application. As such, a Web service operates as a standards-based façade or wrapper for accessing non-standardized middleware components. Web Server Web Service middleware XML Response Sample copy Listener XML Request Enterprise Asset Enterprise Assets as Services Property of Web Age Solutions Inc. Listener: Intercepts the client request and routes Web service requests to the appropriate service. Web Service: Unmarshalls the XML sent by the client, parses the parameters and method call, and invokes the client request via the underlying middleware. Then the Web service retrieves the result from the middleware layer, encodes it in XML, marshalls the XML document, and sends the response back to the client. Middleware: (This layer is optional.) The middleware layer acts as an intermediary between the Web service and the business service that the client is ultimately interested in accessing. Enterprise Asset: The resource the client is ultimately trying to access. 5 Chapter 1 - Introduction to Web Services 1.9 Typical Development Workflow 1. A service provider will create an interface that captures the data format, operations, and input/output message structure. Service Provider design Interface Interface 2. Next, the business logic for the service is implemented and put into production. Service Provider develop Service Implementation Production Environment deploy Sample copy 3. The production service is then registered in a service registry. Service Provider register Interface Interface Service Registry Typical Development Workflow This development workflow represents a top-down approach to service development (WSDL is created first). A bottom-up approach (existing system is exposed as a service) is also possible. Property1.10ofTypical Web Age Solutions Inc. Development Workflow A client developer will locate the service in the registry, download the interface file, learn about the service, and then build the client application. 6 Chapter 1 - Introduction to Web Services Client Developer ver disco Interface Interface Interface Interface develop ins pe ct Service Registry Client Application At runtime, the client application invokes the service by sending an appropriately formatted message to the designated endpoint. Client Application XML S S Production Environment Sample copy Typical Development Workflow The URL where the service request should be posted may be supplied to the consumer in one of several ways: • Hard coded in the client • Obtained from the registry • Obtained from within the service interface file Property1.11 of Advantages Web Age Solutions Inc. of Web Services Deliver new IT solutions faster and at a lower cost by focusing code development on core business and using Web services applications for non-core business programming. Protect investment in IT legacy systems by using Web services to wrap legacy software systems for integration with modern IT systems. Integrate business processes with customers and partners at lower cost. Web services makes this integration feasible by allowing businesses to share processes without sharing technology. With lower costs, even small 7 Chapter 1 - Introduction to Web Services business will be able to participate in B2B integration. Enter new markets and widen customer base. Web services listed in registries can be “discovered” and thus are “visible” to the entire Web community. 1.12 Web Service Business Models Web Services make it possible for businesses to externalize automated business processes. ◊ This is a step after Web-enabling business processes. In a more advanced scenario, buyers and sellers can discover each other and connect dynamically to execute transactions. The following business models can be easily implemented using Web services: Sample copy ◊ Business Information ◊ Internal System Integration ◊ Business Process Externalization ◊ Business Aggregation Web Service Business Models Web enabling business processes allowed customers to directly take part in such processes. For example, customers could directly manage their orders without having to fax it or place the order on the phone. The process was still inefficient. The customer may have to place that order first in an internal system. Once the order is approved, she needs to place that order again in the supplier's Web site. Property of Web Age Solutions Inc. If the supplier makes the order taking process available over Web services, the internal application can directly place the order once the order is approved internally. 1.13 Web Service Business Models Following models are presented in a progressive order of complexity. A business can implement simpler models first before considering a more complex one. 1. Business Information: Provide read-only information to consumers. 8 Chapter 1 - Introduction to Web Services Example: Corporate news, financial report, weather forecast. 2. Internal System Integration: A business may have automated sales process, order taking Web site and warehouse management system. But they may not be integrated. Diverse systems within the same business can communicate using Web services. 3. Business Process Externalization: Allow automated systems of partner or customer organizations to communicate with an application. 4. Business Aggregation: Multiple travel agent systems can adhere to the same Web service specification. This allows an automated system to look for the cheapest ticket. 1.14 Example: Internal System Integration Acme Inc. has these automated systems: Sample copy ◊ Sales: Allows sales agents to set prices and discounts for preferred buyer organizations. ◊ Order taking Web site: Allows customers to browse through products and place orders. ◊ Warehouse: Orders placed in the Web site are sent to the warehouse. Each system is sophisticated and mature in its own right. Significant problems remain. When a new product is entered in the Sales system, who enters it in the Property Web Age Solutions Inc. Web site andof the warehouse? ◊ ◊ When the price or description of an item is changed, who updates the Web site? Solution: Have each system offer a service called "AddProduct". When a product is added to the Sales system, it can invoke this service in the Web site and warehouse system. A standardized specification will allow additional systems to participate in the process. The Sales system does not need to contain external system specific business logic. ◊ Similarly, the Web system can offer a service called "UpdateProduct". 9 Chapter 1 - Introduction to Web Services 1.15 Example: Business Process Externalization Acme Inc. is a printing company. Currently, staff from the client organizations need to upload documents via Acme's Web site and place a print order. See things from a client organization's point of view. They are probably receiving orders for a book or course material over their own Web site. Each order requires a staff member to upload documents using Acme's Web site and place an order. ◊ The process is time consuming and error prone. Once in a while, a staff uploads the wrong documents. Acme can externalize the order taking process using a Web service. The order-taking application of the client can invoke this service as soon as a new order is placed. Proper documents are sent over as a part of the service invocation. Sample copy 1.16 Web Services Standards We will now take a brief look at some of the basic standards: ◊ SOAP ◊ WSDL ◊ UDDI WS-I Property of Web Age Solutions Inc. ◊ 1.17 Binding via SOAP The message format most often used for the binding portion of a Web service is SOAP (Simple Object Access Protocol). ◊ A simple, lightweight XML-based data format for exchanging information in a distributed environment. ◊ Messages exchanged in a request and response pattern. ◊ SOAP is managed by the W3C: http://www.w3.org/TR/soap/. SOAP can be used with multiple communication protocols: 10 Chapter 1 - Introduction to Web Services ◊ HTTP, SMTP, FTP, JMS, etc. (HTTP is most common). SOAP is language and platform neutral. XML Client Web Service Binding via SOAP SOAP specifies the XML request and response message format only. It does not describe any network communication protocol. A message constructed in SOAP format can be communicated over any protocol: HTTP, FTP, SMTP or JMS. 1.18 SOAP in Protocol Stack Sample copy SOAP HTTP/JMS/SMTP Data payload format Client server handshake, authentication, encryption TCP/IP protocol Property of Web AgeNetwork Solutions Inc. SOAP in Protocol Stack SOAP covers just the request and response data. We will learn shortly how a SOAP message contains the following key information: 1. The operation that needs to be invoked corresponding to the request. 2. The input or output data for the message. SOAP also covers more advanced issues such as: 1. Encryption of certain pieces of request or response data. Note: This is different from HTTPS, which encrypts the entire request/response data. 11 Chapter 1 - Introduction to Web Services 2. User identity and credentials (password). 1.19 SOAP Structure A SOAP message consists of three parts: 1. An envelope that contains a message and specifies processing instructions. 2. An optional header section for transmitting auxiliary information such as client preferences, security, or transaction semantics. 3. A mandatory body section that carries the message payload. The SOAP specification also defines the following: ◊ A set of encoding rules for expressing instances of application-defined data types. ◊ A convention for representing remote procedure calls and responses. Sample copy 1.20 SOAP Message Architecture Protocol Headers The complete SOAP Message Standard Protocol (HTTP, SMTP, etc.) SOAP Envelope <Envelope> encloses payload SOAP Message Property of Web Age Solutions Inc. <Header> encloses headers SOAP Header Headers SOAP Body Message Name & Data Individual headers <Body> contains SOAP Message Name & Data XML Encoded SOAP Message Name & Data 12 Chapter 1 - Introduction to Web Services SOAP Message Architecture There are three components to the SOAP spec: 1. The SOAP envelope. 2. A set of encoding rules. 3. A means of interaction between request and response. Think about a SOAP message as an actual letter: 1. The document is enclosed in an envelope. 2. The envelope is transmitted via mail system (the transport). 3. The HTTP header data acts as the address which provides routing information so that the message is delivered to the appropriate server resource. 4. The “last mile service” is provided by the XML encoding. Sample copy 1.21 Applying SOAP SOAP is an XML-based document that contains a message payload to be exchanged between parties. Although there are various alternatives (REST, XML-RPC, JSON, etc.), SOAP has emerged as the de facto standard for Web service exchanges. ◊ More ‘enterprise grade’ extensions and capabilities (security, transactions, reliable delivery, etc.). ◊ Strong vendor tool support. Property of Web Age Solutions Inc. Extensive literature on the subject, including best practice guidelines. ◊ 1.22 Interface via WSDL The message format most often used for the binding portion of a Web service is WSDL (Web Services Description Language) ◊ An XML-based language the defines a service interface. ◊ Describes how to locate and invoke a service. ◊ Managed by the W3C: http://www.w3.org/TR/wsdl. The WSDL document specifies the location of the service and the 13 Chapter 1 - Introduction to Web Services operations (or methods) the service exposes. ◊ For every operation, the input/output message format is also specified. WSDL is essentially the IDL of Web services. ◊ Makes a neutral declaration of one or more services. ◊ Describes how a client can interact with those services. Interface via WSDL Here, “location” means information about how a consumer can invoke the service. For example, for an implementation of a service that can be invoked by posting a SOAP message, the consumer needs to know the URL. 1.23 WSDL Structure Sample copy A WSDL file has two major sections: 1. An abstract description of operations and their input/output data. 2. A concrete definition of how to bind to the service on a given port. An abstract description contains programming language and protocolneutral description of operation names and message formats. Information about a concrete implementation includes enough detail for a consumer to actually invoke the service. Property of Web Age Solutions Inc. WSDL Structure A WSDL file can contain a purely abstract service description. A specific service implementation can provide its own WSDL that imports the abstract WSDL and supplies concrete details. 1.24 Applying WSDL WSDL is an XML-based document that describes the service being provided. ◊ The provider records this document with the registry. ◊ It provides information on what the service is about, where it resides, and how it can be invoked. 14 Chapter 1 - Introduction to Web Services ◊ It is extensible, allowing for services other than SOAP to be declared. In a Web services exchange, the WSDL serves as a contract between client and service. ◊ Changes made to the service implementation do not have to impact the client and vice-versa. Applying WSDL In the WSDL document, the following information is defined: • What are services? • What are the ports (network endpoints/address) in each service? • What is the protocol binding for each port? • What is the portType (operation/method) in each binding? • What is the operation type (one way, request-response, solicit-response, or notification)? • What are the messages (parameters) for the operation? • What is the data type of the parameter? Sample copy 1.25 Locating a Service How do you currently find businesses and/or services on the Web? ◊ Type in the address (URL) directly. Use a search engine. Property of Web Age Solutions Inc. Web Services work the same way. ◊ ◊ Type in the address (URL) directly. ◊ Query a registry (a search engine for services). 1.26 UDDI Overview UDDI (Universal Discovery Description Integration) is a specification for publishing and discovering service information. ◊ It represents a search engine for online businesses and services that are registered with the registry. 15 Chapter 1 - Introduction to Web Services The goal of the UDDI project is to accelerate the interoperability and adoption of Web Services through standards-based specifications for service description and discovery. ◊ Service providers publish the service description and the Service Requestors search for the required services and obtain binding information to connect to the actual service. ◊ UDDI is based on XML and SOAP. For the most part, public registries have died in favor of private registries within intranets and B2B extranets. ◊ Xmethods.com is one of the few remaining UDDI registries. 1.27 UDDI Terminology Sample copy UDDI terminology involves two main terms: 1. Business ◊ General term referring to an organization or operating concern. ◊ Defined in the UDDI registry. ◊ The business information is primarily used to answer “who, what, where, and how”. 2. Service ◊ Service refer to Web services. Property of Web Age Solutions Inc. Businesses act as a container for services. ◊ ◊ A business is first registered in the registry and the various services are then listed under that particular business. UDDI Terminology “Who” and “what” refer to general information about the products and services. “Where” involves registering information about the URL or email address (or other address) through which each type of service is accessed. “How” refers to registering references to information about interfaces and other properties of a given service. 16 Chapter 1 - Introduction to Web Services 1.28 UDDI Structure UDDI is often compared to a phone book that stores various classifications of information. ◊ White Pages • ◊ Yellow Pages • ◊ Allows searches for businesses by name or some other unique identifier such as a DUNS, Thomas Register, or other ID. UDDI also supports the categorization of businesses by industry, product/service offering, and location. Green Pages • Supports the registration and searching of businesses by the service types and capabilities they provide. Sample copy 1.29 Applying UDDI SOAP processor SOAP request Client application SOAP response Web server UDDI registry service Property of Web Age Solutions Inc. UDDI database UDDI registry node Applying UDDI The service invocation process is simple: 1. The client queries a UDDI registry node. 2. The server returns a list of records matching request. 17 Chapter 1 - Introduction to Web Services 3. The client identifies a specific service of interest. 4. The server provides the client with binding information so the client can invoke service methods. 1.30 WS-I Overview Early work with Web services ran into significant problems with service interoperability. ◊ Differences in SOAP messaging formats. ◊ Differences in data type encoding within SOAP. The Web Services Interoperability (WS-I) organization was created in 2002 by a vendor consortium to address this problem. ◊ Its goal is to promote Web service interoperability across platforms, operating systems, and programming languages. ◊ It delivers practical guidance, best practices, and resources for developing interoperable services solutions in the form of ‘profiles’. Sample copy With so many variables in a service-oriented exchange, risk mitigation through the adoption of WS-I basic profiles becomes essential. WS-I Overview The WS-I Web site can be accessed at http://www.ws-i.org/ Property of 1.31 Web Age Solutions Inc. WS-I Deliverables WS-I’s deliverables provide resources for Web services developers to create interoperable Web services and verify that their results are compliant with WS-I guidelines. They include: ◊ Profiles • ◊ Provide implementation guidelines for how related Web services specifications should be used together for best interoperability. Sample Applications • Demonstrate Web services applications that are compliant with WS-I 18 Chapter 1 - Introduction to Web Services guidelines. ◊ Testing Tools • Test whether the messages exchanged with a Web service conform to WS-I guidelines. WS-I Deliverables Profiles: To date, WS-I has finalized the Basic Profile, Attachments Profile, and Simple SOAP Binding Profile. More information can be found at http://www.ws-i.org/deliverables/. The WS-I Basic Profile is an outline of requirements to which WSDL and Web service protocol (SOAP/HTTP) traffic must comply in order to claim WS-I conformance. 1.32 Summary Sample copy The service aspect of SOA comes in many different forms: ◊ Packaged applications (COTS) ◊ Home-grown solutions ◊ Mainframe systems ◊ Web services Web services represent the most popular approach to service enabling an enterprise. ◊ Web services facilitate various business models: Property of Web Age Solutions Inc. Business Information ◊ ◊ Internal system integration ◊ Business Process Externalization ◊ Business Aggregation Technology standards play a big part in Web services, especially SOAP, WSDL, and UDDI. WS-I is a vendor-neutral organization dedicated to promoting service interoperability. 19
© Copyright 2024