Home > SOA Tips > The Web Services Advisor > CAM: A Swiss Army knife for XML structures
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

THE WEB SERVICES ADVISOR

CAM: A Swiss Army knife for XML structures


Daniel Rubio
05.30.2007
Rating: --- (out of 5)


Enterprise IT tips and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Web services' bread and butter consists primarily of exchanging XML structures between applications in order to fulfill interoperability requirements. Prior to such exchanges taking place, most XML data undergoes a series of steps that include validation and transformation, many of which are solved using staple XML approaches like Schemas, DTD's, XPath and XSL. Up next we will explore yet another technique developed by OASIS which nicely complements many of the aforementioned procedures, its name: CAM (Content Assembly Mechanism) .

CAM's primary objective is to define, compose and validate XML content through the use of specialized templates which allow the application of contextual business rules to any XML structure. Before we dig into what actually constitutes these contextual business rules and why they are useful, the first thing you should realize about CAM is that its rooted in the same principles as many other validating and transformation techniques you may already be familiar with -- such as using XPath and structures similar to those of Schemas. So in this sense CAM is an easily digestible approach which doesn't require starting a fresh new learning curve.

So what is a contextual business rule for XML? Its an elaborate piece of logic which can be applied to raw XML data prior to being used in an actual Web service or application. Such business rules can in turn be used to enforce a particular XML structure (validate) or transform XML fragments to fit a predetermined form. With that said, let's take a closer look at some of these business rules, including their syntax, how they are declared in a CAM template and an actual XML structure using CAM. Listing 1.1 shows an XML document which makes use of CAM.

This last XML structure imports the CAM namespace immediately at the top of the document and makes various statements around it using the as: qualifier. Besides of the use of this special namespace, the only other thing worth men


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
XML and XML schema
SOA pattern of the week (#7): policy centralization
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
What's new at the W3C
Ganymede: Modeling tools target SOA, UML
Data services mashups emerge for SOA
Making sense of data services mashups
XML turns 10
SOA helps save 100-year-old business
Oracle maps heterogeneous data services strategy for SOA
Handling XML with Ajax

Service-oriented architecture (SOA) development
SOA products for June
Enterprise Architecture in the Agile age - Part 2, Architects and developers
Enterprise Architecture in the Agile age - Part 2, Architects and developers
EA modeling tools communicate across disciplines
Using atomicity to gain SOA granularity
Hurwitz on SOA governance, services management
Reporter's Notebook: Jack Vaughan on agile methodology
OSGi Mini Tutorial
SOA growth and change: TechTarget survey shows SaaS, BPM emerging
Java EE servers said giving way to lightweight application frameworks

The Web Services Advisor
Use SoaML to facilitate Model Driven Architecture
Enterprise mashup patterns act as API enablers
XQuery learns to write using XUF
Descriptive Languages for RESTful Services
Notable Python language update on view
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
Whatever happened to ''X''?
The technology of Web Service Security
Thrift: A pragmatic approach to service integration
What's new at the W3C

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
class diagram  (SearchSOA.com)
Fast Infoset (FI)  (SearchSOA.com)
GeoRSS  (SearchSOA.com)
Keyhole Markup Language  (SearchSOA.com)
RELAX NG  (SearchSOA.com)
state diagram  (SearchSOA.com)
Universal Business Language  (SearchSOA.com)
Vector Markup Language  (SearchSOA.com)
XML infoset  (SearchSOA.com)
XML pipeline  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


tioning are the % symbols used to delimit character data within certain XML tags, all of which are used by CAM to identify where content data occurs. Now take a look at Listing 1.2 which illustrates a partial CAM template used to enforce certain rules on the previous document. [End Listing 1.2]

The first thing to realize about these CAM rules is that there syntax is based on XPath -- such as the case of //Item/@pno, which is XPath lingo for saying the pno attribute for Item tags. More importantly, however, are the things these CAM rules achieve. There's the introduction of usage patterns for the XML document -- such as makeRepeatable, makeOptional and restrictValues -- to better elaborate conditionals for validating and pruning XML data. Specifically for this case, we find a rule that states if the //Item/@pno tag value coincides with 123-678. It also validate the tag //shipTo/state equals WA, and additionally we can also find another rule stating that if the $QuickBooks variable in the XML document equals true, CAM should suppress the XML tag //Item/comment.

In order to put the previous CAM template and XML document into actual use you will need to install a CAM Engine, which is the software infrastructure required to keep the validating and transformation process ticking. Additionally and in order to reduce the burden of creating CAM templates, an XML editor can also be of help in the development lifecycle of CAM projects. Fortunately, CAM has managed to grow a strong open source community around both these areas and makes available as a free download a Java CAM Engine and CAM editor.

Now, instead of exploring the deployment and usage details for these last two CAM pieces -- many of which are covered in the documentation – let's pose a higher-level question regarding the utility of CAM : is the actual introduction of yet another piece of software -- read CAM engine -- a convenient or even practical approach to the ever growing complexity of SOA initiatives? As it turns out, for those services having constantly changing XML validating or transformation requirements CAM provides a fresh outlook and one which reduces complexity.

The issue with the classical validating and transformation techniques for XML is that in one form or another they are heavily dependent on the underlying programming environment, coming in either the form of specifying processing instructions for applying an XSL stylesheet or simply using application logic to execute validating logic beyond what is supported in XML Schemas. In these scenarios, constant changes in XML validating or transformation requirements can quickly become a burden due to the inherent tight coupling, whereas using an approach like CAM a more loosely coupled architecture is achieved -- the latter of which is a highly coveted SOA characteristic.

Though CAM introduces an additional layer to the possible validation and transformation of XML structures, incorporating such a level of indirection into your Web services projects can be an excellent solution for those SOA initiatives requiring support for elaborate XML content rules Add to this that CAM is developed under the guidance of OASIS, which develops numerous other Web services standards, and you are insured CAM will continue its relevance in and around your Web services projects.

About the author: Daniel Rubio is a software consultant with over 10 years of experience in enterprise software development, having recently founded Mashup Soft, a startup specializing in the use Web services for Mashups. He is a technology enthusiast in all areas related to software platforms and maintains a blog on these topics.


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts