Advanced Web Design: Why Java And Xml Mesh

Java and XML are two platform-independent technologies in software development that work well together creating portable software components that can be used in many application programming interfaces (api's).

Two of the hottest technologies in software development and web programming are Java and XML. Together, they are two of the critical elements in developing a component software architecture. A component model allows developers to build individual pieces of an application that can easily be meshed with other pieces to build more complicated software. It also allows for the development of Web Services applications.

Web services are software components hosted on a web page that fill a specific need.

Java is a programming language originally developed by Sun Microsystems. Java has gained tremendous popularity because it is generally platform independent. In other words, you can write a Java program and it will run on any type of computer from a cell phone to a Windows Desktop machine to a UNIX server.

XML is not a programming language. It is a universal syntax for structuring data independent from application logic. Basically, that means that you can format any type of data imaginable in XML. The XML specification is managed by the World Wide Web Consortium. The benefit of XML is that it creates a standard way to specify data. It is also application and platform independent. The same XML data file can be used by a web page, a relational database, or a custom application. It's very versatile.

When used together, Java and XML can provide a way to bring a variety of applications, information and services together despite what operating system or software end-users have.

Java code can be seen as "portable" code with XML data as "portable" data. When the two are meshed together, you have a portable software component that can be used in a number of different applications.

One of the benefits of using Java to process XML or using XML as a data store for a Java application is that a number of Java-XML APIs (application programming interfaces) have already been developed to allow you to more quickly develop your own code.

Some of the APIs currently available for XML in Java include:

* JAXP (Java API for XML Parsing) - This API is used to parse XML documents in Java. Parsing is a critical element of dealing with XML because it scans the document and logically breaks it up into discrete pieces so that the application can find the data it needs to find. JAXP is considered a flexible API because it allows the programmer to use different parsers in the application.

* Xerces API - The Xerces API is a precursor to JAXP. It is an open source API that is available in Java or C++ to parse XML documents. The Xerces API allows for two different parsing methods.



* JDOM (Java DOM) - The Java DOM (Document Object Model) is another way of structuring XML data so that it can used by a Java program. Unlike JAXP, it only has one parsing mechanism - the DOM structure - which is a tree-style structure. However, it can also be easier to work with JDOM for simpler applications.

* JAXB(Java Architecture for XML Binding) - JAXB treats XML differently, rather than parsing the file and allowing the application to search in the file, JAXB converts the XML data into Java Objects by binding the XML with the XML data structure (called an XML schema). Once the Java Objects are created, they can be accessed directly in the Java application.

* JAXM (Java API for XML Messaging) - JAXM is a standard that describes how to package and unpackage data in XML format so that it can be transferred between two applications. This is a critical element for web services applications.

* JAXR (Java API for XML Registries) - When Web Services applications are created, they are published or made available on the Internet by including them in a registry. JAXR is an API that allows the Java programmer to query the web service registry to confirm that the web service is still available or find another suitable web service.

* JAX-RPC (Java API for XML-based RPC) - JAX-RPC is a methodology for making Web Service calls appear local. RPC (remote procedure call) is a standard way of calling another piece of code that is located on a separate computer. Rather than use the web services model of sending data and receiving a response back, JAX-RPC allows the programmer to treat the web service as an RPC call which is much easier to program.

Web Services make great use of Java and XML as demonstrated by a review of the Java-XML APIs, many of which are designed specifically for Web Services. Web services use XML to communicate. The standard communication mechanism is called SOAP (Simple Object Access Protocol). A SOAP message contains all of the information needed to access the Web Service. SOAP messages must be formatted as an XML document. Most Web Services are now written in Java. The web service receives the SOAP message, extracts the necessary data and then performs the operation requested and sends back the results. The results might be a web page or another SOAP message.

For example, a programmer might want to be able to allow a user to purchase an item from a web site without sending the user to that site. Using web services, the developer can use Java and XML together to send the site all of the information it might need to complete the transaction and make the sale.

As you can see, Java and XML work well together. They create options for web services and design that are platform and software-independent. In essence, they bridge the gap between different operating systems and much more.

Trending Now

© High Speed Ventures 2011