Metadata exchange

Table of contents:

When we first introduced the concept of loose coupling in Chapter 3, we explained that the sole requirement for a service requestor to interact with a service provider acting as the ultimate receiver is that the service requestor be in possession of the service provider's service description. The WSDL definition, along with any associated XSD schemas, provides the basic set of metadata required to send valid SOAP messages for consumption by the service provider.

Having just covered policies in the previous section, it is clear that, when used, policies add another important layer to the metadata stack. Using policies, our service requestor now can send SOAP messages that comply with both the WSDL interface requirements and the associated policy assertions.

Again, though, regardless of how much metadata a service makes available, the fact is that we still need to retrieve this information by either:

  • manually locating it by searching for published documents
  • manually requesting it by contacting the service provider entity (the service owner)
  • programmatically retrieving it via a public service registry
  • programmatically retrieving it by interacting with proprietary interfaces made available by the service provider entity

With the exception of using the public service registry, none of these options are particularly attractive or efficient. It would be ideal if we could simply send a standardized request such as, "give me all of the information I need to evaluate and interact with your service provider." This is exactly what metadata exchange accomplishes (Figure 7.22).

Figure 7.22. Metadata exchanges let service requestors ask what they want to know about service providers.

In Plain English

As the workload at our car wash increases, we get to the point where we are ready to hire a new worker on a full-time basis. Instead of posting an advertisement, we decide to approach a number of people we already know.

Our first request of interested candidates is that they provide us with a résumé. Because we want to check references, we always look through the résumé to see if references are attached. Sometimes they are, but most of the time it simply states that references are available upon a separate request. As a result, we contact the candidate again to request the references document.

This analogy demonstrates the simplicity of the metadata exchange concept. We first issue a request from a resource for (meta) information about that resource. If the information we receive is not sufficiently complete, we issue a second request for the remaining (meta) information.


7.5.1. The WS-MetadataExchange specification

This specification essentially allows for a service requestor to issue a standardized request message that asks for some or all of the meta information relating to a specific endpoint address.

In other words, if a service requestor knows where a service provider is located, it can use metadata exchange to request all service description documents that comprise the service contract by sending a metadata exchange request to the service provider.

Originally the WS-MetadataExchange specification specified the following three types of request messages:

  • Get WSDL
  • Get Schema
  • Get Policy

Even though these represent the three most common types of meta information currently attached to Web services, the specification authors realized that future metadata documents would likely emerge. A subsequent revision therefore resulted in a single type of request message:

  • Get Metadata

This message is further supplemented by the Get request message. Both are explained in the following sections.


To see examples of WS-MetadataExchange request and response messages, see the WS-MetadataExchange language basics section in Chapter 17.


7.5.2. Get Metadata request and response messages

As previously mentioned, a service requestor can use metadata exchange to programmatically request available metadata documents associated with a Web service. To do so, it must issue a Get Metadata request message. This kicks off a standardized request and response MEP resulting in the delivery of a Get Metadata response message.

Here's what happens for a metadata retrieval activity to successfully complete:

  1. A service requestor issues the Get Metadata request message. This message can request a specific type of service description document (WSDL, XSD schema, policy), or it can simply request that all available metadata be delivered.
  2. The Get Metadata request message is received at the endpoint to which it is delivered. The requested meta information is documented in a Get Metadata response message.
  3. The Get Metadata response message is delivered to the service requestor. The contents of this message can consist of the actual metadata documents, address references to the documents, or a combination of both.

Figure 7.23 illustrates these steps.

Figure 7.23. Contents of a sample Get Metadata response message.


7.5.3. Get request and response messages

In Step 3 of the preceding scenario, we explained how the Get Metadata response message does not need to actually contain all of the requested metadata. It can simply provide a list of URIs that point to the separate documents.

To allow the retrieval of all meta information to be fully automated, the WS-MetadataExchange specification provides a means for the service requestor to explicitly request the document content for any references that were provided as part of the original Get Metadata response message. It achieves this through the use of the Get request and Get response messages.

Here's a brief description of the steps involved in this sub-process:


Upon receiving the Get Metadata response message, the service requestor determines that it would like to receive the actual content of the metadata documents for which it only received references. As a result, the service requestor issues a Get request message indicating which metadata information it would like retrieved.


The Get request message is received at the endpoint to which it was delivered. The requested data is placed into a Get response message.


The Get response message is delivered to the service requestor.

Figure 7.24 shows the execution sequence of these steps, which should provide the service requestor with all the information it needs (and therefore concludes the metadata exchange process).

Figure 7.24. Contents of a sample Get response message.


7.5.4. Selective retrieval of metadata

Meta documents describing services with comprehensive interfaces and features can be large in size, especially when assembled into one mega-description. Use of the selective Get request message type therefore reduces the chances of unnecessary information being transported.

The Get Metadata response message first sends along what is considered the essential piece of service meta information. It is then up to the service requestor to determine what further metadata it requires. (Note that the endpoint to which a Get Metadata request message is sent can represent multiple WSDL, XSD schema, and policy documents.)

7.5.5. Metadata exchange and service description discovery

It also is important to note that metadata exchange does not really help service requestors discover service providers. Service registries, such as those implemented using the UDDI standard, can be used to discover service descriptions that meet certain search criteria. While service registries also provide location information for the actual WSDL definition of a service, they can be used in conjunction with metadata exchange messages.

Essentially, a service requestor could first query a public registry to retrieve the endpoint addresses of any Web service candidates that appear to provide the sought-after features. The same requestor could then employ metadata exchange to contact each candidate and request associated metadata documents. This would give the service requestor more information to better assess which service provider it should be working with. It also would provide the service requestor with all of the details it needs to begin interacting with the chosen service. So while it may not further the cause of attaining discoverable services, it does support discovery by rounding out the overall dynamic discovery process.

7.5.6. Metadata exchange and version control

So far we've focused on the ability of metadata exchange to enable service requestors to retrieve any necessary meta information for them to begin interacting with service providers. Another important aspect of this WS-* extension is its potential to automate the administration of service contracts.

As services evolve, the nature and scope of the functionality they deliver can undergo alterations. This can result in changes trickling down to the service meta layer, which, in turn, can lead to new versions of a service's WSDL, XSD schema, or policy documents.

This raises the age-old version control challenges. Service requestors already interacting with a service provider either need to be notified ahead of time of upcoming changes, or they need to be supported with an outdated service description.

Some services-based solutions have dealt with this problem by building custom operations that can be used to retrieve the latest service description (metadata) information. While the same functionality is essentially provided by metadata exchange, the main benefit of its use is that it implements this feature in a standardized manner. Now any service-oriented application that supports metadata exchange can allow service requestors to retrieve the latest service contract as often as they like.

When changes to meta information are expected to occur frequently, a service requestor could be programmed to periodically retrieve available metadata documents to compare them to the documents already in use. In fact, service requestors could even build metadata exchange features into their exception handling. If a standard SOAP request is rejected by the service provider as a result of an interface, schema, or policy incompatibility error, the service requestor's exception handling routine could respond by retrieving and checking the latest metadata documents.

7.5.7. Metadata exchange and SOA

The simple concepts behind metadata exchange support some key aspects of SOA (Figure 7.25). Its ability to automate the retrieval of meta information reinforces loose coupling between services, and increases the ability for service requestors to learn more about available service providers. By standardizing access to and retrieval of metadata, service requestors can programmatically query a multitude of candidate providers. Because enough service provider metadata can more easily be retrieved and evaluated, the overall discovery process is improved, and the likelihood for services to be reused is increased.

Figure 7.25. Metadata exchange relating to other parts of SOA.

By establishing a standardized means of service description exchange, this extension can vastly improve interoperability when broadly applied to volatile environments. By being able to query service providers prior to attempting access, requestors can verify that the correct metadata is in fact being used for their planned message exchanges. This can increase the QoS factor of SOA, as it tends to avoid a multitude of maintenance problems associated with service contract changes.

It is also worth mentioning that metadata exchange reduces the need for developers to attain meta information at design time and eliminates the need for custom-developed metadata retrieval extensions. Finally, the dynamic exchange of service descriptions can lead to the potential of automating version control and other metadata-related functions.

Case Study

As TLS continues to evolve its B2B solution, new features are added and some existing functionality is modified. This can, occasionally, result in changes to the WSDL interface definitions of TLS services, as well as revisions to service policies. Any of these changes can obviously affect the online partners that regularly connect to TLS.

Therefore, all public TLS services support the processing of WS-MetadataExchange requests. At the onset, partners who register for the TLS B2B solution are strongly encouraged to issue Get Metadata request messages frequently to receive the latest service contracts.

RailCo learned about this the hard way. To date they never bothered incorporating metadata exchange functionality within their services, as they were not required to do so. After a change to the TLS Accounts Payable Service WSDL, though, the RailCo Invoice Submission Service submitted an invoice message that was rejected by TLS.

The resulting error description was unclear, and exception handling logic within the RailCo service assumed this condition was the result of the TLS service being unavailable. It was therefore designed to periodically retry the message submission on a daily basis. Only after three days did someone at RailCo notice that an acknowledgement had not been received from TLS. A lengthy investigation led to the eventual discovery that the failed submissions were the result of a change to the TLS WSDL definition.

As a result of this experience, RailCo revised their Invoice Submission Service to interact with the metadata exchange functionality offered by TLS (Figure 7.26). The service now issues a periodic Get Metadata message to the TLS Accounts Payable Service.

Figure 7.26. The revised RailCo Invoice Submission Process now includes a periodic metadata exchange with TLS.


The Accounts Payable Service responds with a Get Metadata response message containing its current WSDL, XSD schema, and policy information. The RailCo Invoice Submission Service verifies that the service description documents used by RailCo match those currently published by the TLS service.

If the verification succeeds, it's business as usual, and RailCo proceeds to issue invoice submission messages. If the metadata does not match, a special error condition is raised at RailCo's end, and no further invoices are sent until it is addressed by an administrator.


  • Metadata exchange allows service requestors to issue request messages to retrieve metadata for service providers.
  • The WS-MetadataExchange specification standardizes two types of request messages: the Get Metadata request (which returns metadata content and/or references) and the Get request (which returns the content of a previously returned reference).
  • Metadata exchange assists in improving the service description discovery process and in alleviating version control issues related to service meta information.
  • Automated metadata retrieval leads to several standardized improvements within SOA and reinforces the loosely coupled nature of autonomous services.


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

Service-Oriented Architecture. Concepts, Technology, and Design
Service-Oriented Architecture (SOA): Concepts, Technology, and Design
ISBN: 0131858580
EAN: 2147483647
Year: 2004
Pages: 150
Authors: Thomas Erl © 2008-2020.
If you may any questions please contact us: