Sunday, September 19, 2010

The Role of XML and the Java Platform

Web services depend on the ability of parties to communicate with each other even if they are using different information systems. XML (Extensible Markup Language), a markup language that makes data portable, is a key technology in addressing this need. Enterprises have discovered the benefits of using XML for the integration of data both internally for sharing legacy data among departments and externally for sharing data with other enterprises. As a result, XML is increasingly being used for enterprise integration applications, both in tightly coupled and loosely coupled systems. Because of this data integration ability, XML has become the underpinning for Web-related computing.


Web services also depend on the ability of enterprises using different computing platforms to communicate with each other. This requirement makes the Java platform, which makes code portable, the natural choice for developing Web services. This choice is even more attractive as the new Java APIs for XML become available, making it easier and easier to use XML from the Java programming language. These APIs are summarized later in this introduction and explained in detail in the tutorials for each API. In addition to data portability and code portability, Web services need to be scalable,secure, and efficient, especially as they grow. The Java 2 Platform, Enterprise Edition (J2EE™) is specifically designed to fill just such needs. It
facilitates the really hard part of developing Web services, which is programming the infrastructure, or “plumbing.” This infrastructure includes features such as security, distributed transaction management, and connection pool management, all of which are essential for industrial strength Web services. And
because components are reusable, development time is substantially reduced.

Because XML and the Java platform work so well together, they have come to play a central role in Web services. In fact, the advantages offered by the Java APIs for XML and the J2EE platform make them the ideal combination for deploying Web services.
The APIs described in this tutorial complement and layer on top of the J2EE APIs. These APIs enable the Java community, developers, and tool and container vendors to start developing Web services applications and products using standard Java APIs that maintain the fundamental Write Once, Run Anywhere™ proposition of Java technology.

What Is XML?

The goal of this section is to give you a quick introduction to XML and how it makes data portable so that you have some background for reading the summaries of the Java APIs for XML that follow.
XML is an industry-standard, system-independent way of representing data. Like HTML (HyperText Markup Language), XML encloses data in tags, but there are significant differences between the two markup languages. First, XML tags relate to the meaning of the enclosed text, whereas HTML tags specify how
to display the enclosed text. The following XML example shows a price list with the name and price of two coffees.

<priceList>
<coffee>
<name>Mocha Java</name>
<price>11.95</price>
</coffee>>
<coffee>
<name>Sumatera</name>
<price>12.50</price>
</coffee>
</priceList>



The <coffee> and </coffee> tags tell a parser that the information between them
is about a coffee. The two other tags inside the <coffee> tags specify that the</coffee>
enclosed information is the coffee’s name and its price per pound. Because XML
tags indicate the content and structure of the data they enclose, they make it possible
to do things like archiving and searching.
A second major difference between XML and HTML is that XML is extensible.
With XML, you can write your own tags to describe the content in a particular
type of document. With HTML, you are limited to using only those tags that
have been predefined in the HTML specification. Another aspect of XML’s
extensibility is that you can create a file, called a schema, to describe the structure
of a particular type of XML document. For example, you can write a schema
for a price list that specifies which tags can be used and where they can occur.
Any XML document that follows the constraints established in a schema is said
to conform to that schema.

The <coffee> and </coffee< tags tell a parser that the information between them
is about a coffee. The two other tags inside the <coffee> tags specify that the</coffee>
enclosed information is the coffee’s name and its price per pound. Because XML
tags indicate the content and structure of the data they enclose, they make it possible
to do things like archiving and searching.
A second major difference between XML and HTML is that XML is extensible.
With XML, you can write your own tags to describe the content in a particular
type of document. With HTML, you are limited to using only those tags that
have been predefined in the HTML specification. Another aspect of XML’s
extensibility is that you can create a file, called a schema, to describe the structure
of a particular type of XML document. For example, you can write a schema
for a price list that specifies which tags can be used and where they can occur.
Any XML document that follows the constraints established in a schema is said
to conform to that schema.

Another popular schema language is XML Schema, which is being developed by
the World Wide Web (W3C) consortium. XML Schema is a significantly more
powerful language than DTD, and with its passage into aW3C Recommendation
in May of 2001, its use and implementations have increased. The community of
developers using the Java platform has recognized this, and the expert group for
the Java API for XML Processing (JAXP) has added support for XML Schema
to the JAXP 1.2 specification. This release of the Java Web Services Developer
Pack includes support for XML Schema.

No comments:

Post a Comment