Java Reference
In-Depth Information
XML is rich enough to handle changes in the interface. For example,
adding optional fields has no impact on a client, and the client can take
advantage of the added functionality at its discretion. In addition, some
required fields could be satisfied with default values, which allows the
client to use those fields only when needed.
XML has a number of technologies that can quickly and efficiently trans-
late one XML schema (or type) to another. This ability makes XML
extremely flexible and efficient.
Not every interface has to be so loosely coupled. Within our applications, we'll
doubtlessly have many object-to-object method calls, and we may even have
distributed communications through EJB s or other interfaces. For those major
interfaces between major systems that demand a looser coupling, XML is a
good alternative to hardwiring an interface to a static communication area.
Listing 7.5 features an XML message that we might use instead of the com-
munications area described in figure 7.6. Notice that we are sending a
communications block but that the format is an XML document, instead of a
tightly managed collection of fields.
Listing 7.5
XML message for credit card transactions
<creditCardTransaction>
<customer>
<firstName>Bruce</lastName>
<middleInitial>A</middleInitial>
<lastName>Tate</lastName>
<address1>1234 McMerican Trail</address1>
<city>Austin</city>
<state>Tx</state>
<zip>78732</zip>
<country>USA</country>
</customer>
<creditCard>
<creditCardNumber>0u812</creditCardNumber>
<expirationDate>03/03</expirationDate>
<amount>3.35</amount>
</creditCard>
</creditCardTransaction>
The service requester can generate the XML message using a variety of tech-
niques, including custom applications, exports from existing applications, or
translations from existing XML documents. Then, the service provider can
use one of several approaches to process the XML message; for example, the
Search WWH ::




Custom Search