When we covered loose coupling in Chapter 3 as part of our primitive SOA discussion, we introduced the essential need for service descriptions. This part of SOA provides the key ingredient to establishing a consistently loosely coupled form of communication between services implemented as Web services.
For this purpose, description documents are required to accompany any service wanting to act as an ultimate receiver. The primary service description document is the WSDL definition (Figure 5.14).
Figure 5.14. WSDL definitions enable loose coupling between services.
Note
Only WSDL concepts are discussed in this section. For WSDL language examples, see the WSDL language basics section in Chapter 13.
5.3.1. Service endpoints and service descriptions
A WSDL describes the point of contact for a service provider, also known as the service endpoint or just endpoint. It provides a formal definition of the endpoint interface (so that requestors wishing to communicate with the service provider know exactly how to structure request messages) and also establishes the physical location (address) of the service.
Let's dig a bit deeper into how the service description document itself is organized. A WSDL service description (also known as WSDL service definition or just WSDL definition) can be separated into two categories:
Figure 5.16 shows how these individual descriptions comprise a WSDL definition. Note the logical hierarchy established within the parts of the abstract definition. We will explain each of these parts shortly.
Figure 5.16. WSDL document consisting of abstract and concrete parts that collectively describe a service endpoint.
5.3.2. Abstract description
An abstract description establishes the interface characteristics of the Web service without any reference to the technology used to host or enable a Web service to transmit messages. By separating this information, the integrity of the service description can be preserved regardless of what changes might occur to the underlying technology platform.
Below is a description of the three main parts that comprise an abstract description.
portType, operation, and message
The parent portType section of an abstract description provides a high-level view of the service interface by sorting the messages a service can process into groups of functions known as operations.
Each operation represents a specific action performed by the service. A service operation is comparable to a public method used by components in traditional distributed applications. Much like component methods, operations also have input and output parameters. Because Web services rely exclusively on messaging-based communication, parameters are represented as messages. Therefore, an operation consists of a set of input and output messages.
Note that the transmission sequence of these messages can be governed by a predetermined message exchange pattern that also is associated with the operation. (Message exchange patterns are discussed in Chapter 6.)
Note
The term "portType" is being renamed to "interface" in version 2.0 of the WSDL specification.
5.3.3. Concrete description
For a Web service to be able to execute any of its logic, it needs for its abstract interface definition to be connected to some real, implemented technology. Because the execution of service application logic always involves communication, the abstract Web service interface needs to be connected to a physical transport protocol. This connection is defined in the concrete description portion of the WSDL file, which consists of three related parts:
binding, port, and service
A WSDL description's binding describes the requirements for a service to establish physical connections or for connections to be established with the service. In other words, a binding represents one possible transport technology the service can use to communicate. SOAP is the most common form of binding, but others also are supported. A binding can apply to an entire interface or just a specific operation.
Related to the binding is the port, which represents the physical address at which a service can be accessed with a specific protocol. This piece of physical implementation data exists separately to allow location information to be maintained independently from other aspects of the concrete description. Within the WSDL language, the term service is used to refer to a group of related endpoints.
Note
The term "port" is being renamed "endpoint" in version 2.0 of the WSDL specification. The WSDL endpoint should not be confused with the general term "endpoint" used to reference the point of contact for a Web service. Though related, the term "endpoint" is used in a much broader sense than the WSDL endpoint, which refers to a language element that only represents the physical address of the service.
5.3.4. Metadata and service contracts
So far we've established that the abstract and concrete descriptions provided by a WSDL definition express technical information as to how a service can be interfaced with and what type of data exchange it supports.
WSDL definitions frequently rely on XSD schemas to formalize the structure of incoming and outgoing messages. Another common supplemental service description document is a policy. Policies can provide rules, preferences, and processing details above and beyond what is expressed through the WSDL and XSD schema documents. (Policies are explained in Chapter 7.)
So now we have up to three separate documents that each describe an aspect of a service:
Each of these three service description documents can be classified as service metadata, as each provides information about the service. Service description documents can be collectively viewed as establishing a service contracta set of conditions that must be met and accepted by a potential service requestor to enable successful communication.
Note that a service contract can refer to additional documents or agreements not expressed by service descriptions. For example, a Service Level Agreement (SLA) agreed upon by the respective owners of a service provider and its requestor can be considered part of an overall service contract (Figure 5.17).
Figure 5.17. A service contract comprised of a collection of service descriptions and possibly additional documents.
5.3.5. Semantic descriptions
Most of the metadata currently provided by services focuses on expressing technical information related to data representation and processing requirements. However, these service description documents generally do not prove useful in explaining details about a service's behavioral characteristics. In fact, the most challenging part of providing a complete description of a Web service is in communicating its semantic qualities.
Examples of service semantics include:
Most of the time service semantics are assessed by humans, either verbally by discussing the qualities of a service with its owner, or by reading supplementary documentation published alongside service descriptions. The ultimate goal is to provide sufficient semantic information in a structured manner so that, in some cases, service requestors can go as far as to evaluate and choose suitable service providers independently.
Semantic information is usually of greater importance when dealing with external service providers, where your knowledge of another party's service is limited to the information the service owner decides to publish. But even within organizational boundaries, semantic characteristics tend to take on greater relevance as the amount of internal Web services grows.
Although service policies can be designed to express preferences and assertions that communicate aspects of service behavior, efforts are currently underway (primarily by the W3C) to continually extend the semantic information provided by service description documents. For the time being, we must focus on the service description capabilities offered to us through WSDL definitions, XSD schemas, and policies.
5.3.6. Service description advertisement and discovery
As we've established, the sole requirement for one service to contact another is access to the other service's description. As the amount of services increases within and outside of organizations, mechanisms for advertising and discovering service descriptions may become necessary. For example, central directories and registries become an option to keep track of the many service descriptions that become available. These repositories allow humans (and even service requestors) to:
When the initial set of Web services standards emerged, this eventuality was taken into account. This is why UDDI formed part of the first generation of Web services standards. Though not yet commonly implemented, UDDI provides us with a registry model worth describing.
Private and public registries
UDDI specifies a relatively accepted standard for structuring registries that keep track of service descriptions (Figure 5.18). These registries can be searched manually and accessed programmatically via a standardized API.
Figure 5.18. Service description locations centralized in a registry.
Public registries accept registrations from any organizations, regardless of whether they have Web services to offer. Once signed up, organizations acting as service provider entities can register their services.
Private registries can be implemented within organization boundaries to provide a central repository for descriptions of all services the organization develops, leases, or purchases.
Following are descriptions of the primary parts that comprise UDDI registry records.
Business entities and business services
Each public registry record consists of a business entity containing basic profile information about the organization (or service provider entity). Included in this record are one or more business service areas, each of which provides a description of the services offered by the business entity. Business services may or may not be related to the use of Web services.
Binding templates and tModels
You might recall that WSDL definitions stored implementation information separately from the actual interface design. This resulted in an interface definition that existed independently from the transport protocols to which it was eventually bound. Registry records follow the same logic in that they store binding information in a separate area, called the binding template.
Each business service can reference one or more binding templates. The information contained in a binding template may or may not relate to an actual service. For example, a binding template may simply point to the address of a Web site. However, if a Web service is being represented, then the binding template references a tModel. The tModel section of a UDDI record provides pointers to actual service descriptions (Figure 5.19).
Figure 5.19. The basic structure of a UDDI business entity record.
Note
UDDI language syntax is not covered in this book. For your reference, an introductory UDDI tutorial has been published at www.ws-standards.com/uddi.asp. Additional recommended reading is provided at www.serviceoriented.ws.
SUMMARY OF KEY POINTS |
---|
|
Introduction
Case Studies
Part I: SOA and Web Services Fundamentals
Introducing SOA
The Evolution of SOA
Web Services and Primitive SOA
Part II: SOA and WS-* Extensions
Web Services and Contemporary SOA (Part I: Activity Management and Composition)
Web Services and Contemporary SOA (Part II: Advanced Messaging, Metadata, and Security)
Part III: SOA and Service-Orientation
Principles of Service-Orientation
Service Layers
Part IV: Building SOA (Planning and Analysis)
SOA Delivery Strategies
Service-Oriented Analysis (Part I: Introduction)
Service-Oriented Analysis (Part II: Service Modeling)
Part V: Building SOA (Technology and Design)
Service-Oriented Design (Part I: Introduction)
Service-Oriented Design (Part II: SOA Composition Guidelines)
Service-Oriented Design (Part III: Service Design)
Service-Oriented Design (Part IV: Business Process Design)
Fundamental WS-* Extensions
SOA Platforms
Appendix A. Case Studies: Conclusion