Exforsys

Home arrow Reviews arrow SOA Governance Development

SOA Development - Explicit or Implicit Versioning

Author: Packt Publishing     Published on: 21st Dec 2008

When defining service versioning policies, one thing that must be considered is whether or not consumers are required to explicitly specify the version of a service that they will use or not. For example, when using a service that is accessed via HTTP, the service invocation must specify a URL.

Ads

This applies whether the service requires a SOAP envelope or if the service is using a resource model provided via REST URLs. For Advasco, a URL used internally for a service will look like this:

http://services.advasco.com/BooksRecords/Customer

In this example, there is no explicit version number associated with the URL. All we can infer is that the request is directed at the host named services.advasco.com for a service at the path of /BooksRecords/Customer. In the case of Advasco, a URL naming standard enforced at a design checkpoint requires that the first portion of the path expresses the domain of the service, in this example, BooksRecords, while the second portion of the path expresses the service desired within the domain, in this example, Customer. If there were multiple versions of this service available, the version required for the request must be determined according to the identity associated with the request. Identity is normally passed through transport headers associated with the HTTP transport, or as part of the message itself. In the case of SOAP-based services, the message can contain both header elements and the message body. The WS-Security specification defines a standard location in the SOAP header for security credentials. For example, a SOAP request for a Customer Information Service may look like this:

Sample Code
  1. <soap:envelope xmlns:tns="http://www.
  2. advasco.com/books-records/customer/nov-2008/" xmlns:s="http://www.w3.org/2001/XMLSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xmlns:soap="http://schemas.xmlsoap.org/soap/
  3. envelope/">
  4. <soap:body>
  5. <tns:getcustomer>
  6. <tns:customer-id>abc123</tns:customer-id>
  7. </tns:getcustomer>
  8. </soap:body>
  9. </soap:envelope>
Copyright exforsys.com


In this example, the namespace element of the message is http://schemas. advasco.com/books-records/customer/nov-2008/. At the end of the URI for the namespace, there is a month and date that can tell the recipient of the message that the schema used in this message corresponds to the November 2008 version of the Customer schema. It is entirely possible that even the namespace of the message may not contain an explicit version identifier; however, the version of the message can be determined by looking for the inclusion, or exclusion, of specific message elements.

Another example of a SOAP request could be the following:

Sample Code
  1. <soap:envelope xmlns:tns="http://www.advasco.com/ xmlns:s="http://
  2. "www.w3.org/2001/XMLSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  3. <soap:header>
  4. <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/
  5. oasis-200401-wss-wssecurity-secext-1.0.xsd">
  6. <wsu:timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/
  7. oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:id="Timestampaaddaaf5-
  8. 1207-44d7-a5ab-64b6bf5f678e">
  9. <wsu:created>2008-05-27T21:23:25Z</wsu:created>
  10. </wsu:timestamp>
  11. <wsse:usernametoken id="SecurityToken-53f28e17-d945-4966-aef1-3ab95e680721" xmlns:wsu="http://docs.oasis-open.org/
  12. wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  13. <wsse:username>jdoe</wsse:username>
  14. <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-
  15. 200401-wss-username-token-profile-1.0#PasswordDigest">2gy4KlZvottIW989
  16. aDMD6JTL/Mk=</wsse:password>
  17. <wsse:nonce>EqJ39Y6g6V+X9XgLIwx1Wg==</wsse:nonce>
  18. <wsu:created>2008-05-27T21:23:25Z</wsu:created>
  19. </wsse:usernametoken>
  20. </wsse:security>
  21. </soap:header>
  22. <soap:body>
  23. <tns:getcustomer>
  24. <tns:customer-id>abc123</tns:customer-id>
  25. </tns:getcustomer>
  26. </soap:body>
  27. </soap:envelope>
Copyright exforsys.com


In this example, neither the URL for the request nor the XML namespace gives any indication of the version of the service desired. The only thing this message has is the identity of the consumer. This example uses the WS-Security UsernameToken profile and specifies a username of jdoe. Through the use of a service contract, this consumer can now be associated with a particular version of the service via policies. An intermediary can receive the message, check the policies associated with the contract for this consumer, and then either route to the appropriate endpoint or apply transformations to preserve backward compatibility.



 
This tutorial is part of a SOA Governance Development tutorial series. Read it from the beginning and learn yourself.

SOA Governance Development

 

Comments