Dependent APIs

When it comes to business-centric APIs, the tables turn a bit. Instead of a data binding package relying on these APIs, higher-level APIs often rely on data binding. This makes sense, as all programming is simply a layering of code that moves from the very specific (shifting bits) to the very general (buying a DVD). I won’t spend too much time in this section, as these APIs can change their use of data binding as quickly as I can write about them. I’ll touch on only a few items and then move on to XML constraints

SOAP

SOAP is a perfect example of an API that can use data binding very naturally. Consider that the entire purpose of SOAP is to transfer information between systems. This data can be very complex though, and even user-defined.

For example, here’s a fairly basic SOAP response:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
           SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  <SOAP-ENV:Body>
    <resp:stockQuoteResponse xmlns:resp="http://www.stockQuotes.com">
      <quote symbol="ALGX" name="Allegiance Telecom">
        <volume>2,964,600</volume>
        <averageVolume>924,318</averageVolume>
        <marketCap>411,700,000</marketCap>
      </quote>
    </resp:stockQuoteResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Don’t get hung up in the envelope and header information; it’s the body of the message that is interesting in relation to data binding. Because data has to be transferred via XML, data binding can offer a means of converting that data into ...

Get Java & XML Data Binding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.