Welcome!

Microservices Expo Authors: Automic Blog, Elizabeth White, Pat Romanski, Jason Bloomberg, Matt Brickey

Related Topics: Microservices Expo

Microservices Expo: Article

The Sun Rises on Web Services

The Sun Rises on Web Services

With Microsoft's .NET marketing campaign in full swing, Sun announced its Sun ONE (Open Net Environment) initiative in October of 2001. While J2EE provides a robust, scalable, and portable enterprise platform, until then it had been sorely lacking in the area of standardized support for Web services. As a part of the Sun ONE initiative, Sun has since released the Java XML Pack, a suite of Java APIs for working with XML.

Java XML Pack Basics
So what exactly is the Java XML Pack? From a Web services perspective, the Java XML Pack facilitates the development, publishing, locating, and invocation of XML services via the Java 2 Platform.

The Java XML Pack provides a truly extensible and flexible interface for deploying enterprise-services architectures and is designed to provide a core set of standardized Java APIs for building, deploying, and accessing XML applications - and, specifically, dynamic XML-enabled Web services. The Java XML Pack APIs constitute a standard set of abstract APIs that aren't tied to a particular implementation technology. Thus, as is true with the rest of the Java 2 Platform, developers can code their application to an API, and easily adapt to changes in the industry without the need to rework or recompile their application code. Developers are free to use any JAXP-compliant XML parser, JAXB-compliant schema mechanism, JAXM-compliant messaging provider, JAXR-compliant registry service, or JAX-RPC-compliant invocation mechanism.

Additionally, although SOAP, WSDL, and UDDI are the current technologies du jour, the industry landscape may very well shift to other technologies such as XP (the W3C spec) and ebXML. When this happens, a Java XML Pack-compliant implementation can be plugged into an existing Java XML Packenabled architecture, and your applications will instantly leverage the new technologies to accomplish the same business services as before. Let's see your .NET technology do that!

Architecture Overview
The JAX Pack technologies can be divided into two broad categories: those that deal with an XML document holistically, and those that deal with it from a procedural perspective.

Document-centric

  • Java API for XML Processing (JAXP) - processes XML documents using a JAXP-compliant XML parser
  • Java Architecture for XML Binding (JAXB) - provides a mapping between XML document elements and Java classes, allowing XML documents to be treated as native Java objects

Procedure-centric

  • Java API for XML Messaging (JAXM) - facilitates XML-based messaging via the Java programming language
  • Java API for XML Registries (JAXR) - offers a uniform mechanism for accessing business registries through Java
  • Java API for XML-based RPC (JAX-RPC) - facilitates XML-based RPC over the Internet, allowing XML-formatted parameters to be passed to remote services, and XML-formatted values returned

This combination of APIs capable of dealing with an XML document as a whole, and providing support for invoking procedures with XML, constitutes a powerful services framework for the Java platform.

Drilling Down
Now let's look at each of these five APIs in a little more detail:

1. JAXP - Processing XML
The Java API for XML Processing (JAXP) predates the rest of the Java XML Pack. It provides basic XML capabilities for the Java platform through a flexible, standards-based API. JAXP is namespace aware and provides support for parsing XML documents, as well as transforming them into other formats. From an architectural perspective, JAXP is designed from the ground up to provide optimum flexibility. It employs a pluggability layer allowing compliant XML parsers and XML processors to be substituted at runtime, as well as supporting multiple parsing paradigms.

When parsing an XML document, developers can use the JAXP API in conjunction with any JAXP-compliant parser to consume XML documents and extract the data inside them. Both SAX-based (event model) parsing, as well as DOM-based (tree model) parsing are supported. This allows developers to utilize whichever parsing paradigm best suits a particular application's requirements. The Simple API for XML (SAX) defines an event-based API that navigates element by element through an XML document, signaling events as particular XML constructs are identified. The Document Object Model (DOM) defines a set of interfaces for constructing an object representation of the parsed XML document, based on a tree data structure. With DOM, the entire document is parsed and the tree structure is stored in memory, allowing repeated, random access to the XML document data. With SAX, the XML data is only accessible when the parser reaches a given element; once it moves on to another element, knowledge of the previous element is lost. These differing parsing styles allow developers to select whichever method best meets the application's requirements. Should the application need to evolve and support a different style, such a change is streamlined via JAXP.

When transforming an XML document, developers can use the JAXP API in conjunction with any JAXP-compliant processor to consume the XML document and transform the data into the desired format (HTML, WML, XSL, or some other flavor of XML). Currently, the only transformation technology supported by JAXP is the eXtensible Stylesheet Language Transformations (XSLT). XSLT allows the definition of XSL stylesheets capable of transforming an XML document into any other textual format, markup language, or even foreign language, based upon template definitions.

The JAXP 1.2 reference implementation ships with two open-source components. The Crimson XML parser (which supports SAX and DOM) and the Xalan XSLT processor, both jointly developed by Sun and the Apache Software Foundation.

2. JAXB - XML Object Binding
The Java Architecture for XML Binding (JAXB) defines an XML-to-Java mapping architecture. It's a fast, efficient means of creating a two-way mapping between the elements in an XML document and Java classes. Given a DTD that defines the schema for the XML document, and a binding schema that defines how to bind the schema to classes, the JAXB compiler will generate a set of Java classes containing all the necessary code to parse XML documents based on the schema. These classes can be used to build a Java object tree representing an XML document that's valid for the schema. This object tree can be constructed by parsing an XML document, or by directly instantiating objects from the generated classes. JAXB can also be used to dynamically modify the element contents of the object tree, and it can marshal the object representation into an XML document based on the mapping defined within the binding schema. In this way, JAXB defines an architecture that provides a convenient, two-way mapping between Java and XML.

At first glance, it would appear that with the JAXB architecture there's no need for the JAXP API. Although there are some areas in which they overlap, they each have distinct features that make them more or less useful for certain tasks.

Table 1 summarizes the differences between the two technologies. For starters, JAXP provides a one-stop shop for parsing, processing, and transforming XML documents. You can select SAX for high-performance, one-time processing, or when you only want a portion of a very large document. You can select DOM when you need to maintain an in-memory representation of an XML document. The DOM API will even allow you to modify the structure and content of an object tree. JAXP also provides a transformer API to convert a document from one format to another. From a validation perspective, JAXP can use a previously known schema, or accept a new one dynamically at runtime. This validation paradigm, although a bit costly, is incredibly flexible.

JAXP provides all these features from the convenience of a single API. JAXB provides some similar features and some unique features. JAXB uses a custom parsing mechanism that builds an in-memory object representation like DOM, but is about as fast as SAX parsing. This is because the generated classes contain all the necessary DTD logic, whereas SAX parsers must accommodate a dynamic validation check against a schema. Additionally, the in-memory object tree created and maintained by a JAXB application has a considerably smaller footprint, because, unlike JAXP, it doesn't contain tree manipulation logic. Developers can certainly modify the object properties (which correspond to element values in XML), but JAXB doesn't facilitate the manipulation of the structure of the object tree (adding and removing elements). One additional aspect of JAXB is that a schema is required and only valid XML will be processed by the application. Whether this is a restriction or a feature depends entirely on your application's requirements.

JAXB provides a bridge between the language-neutral world of XML and the platform-neutral world of Java. In the same way that an XML document is an instance of aschema, a Java object is an instance of a class. As Sun's whitepaper, Web Services Made Easier explains it: "Thus, JAXB allows you to create Java objects at the same conceptual level as the XML data." Java developers are comfortable with object-based relationships, encapsulation, and the level of granularity that objects provide. JAXB provides a fast, convenient mechanism to access XML in this same manner.

3. JAXM - XML Messaging
The Java API for XML Messaging (JAXM), is a full-featured asynchronous messaging technology, representing a standard way to send messages across a network from the Java platform. It's decoupled from the underlying protocol(s) being used, affording developers a standardized messaging API that won't have to be changed to accommodate a different underlying protocol. JAXM is currently based on the SOAP 1.1 and SOAP with Attachments specifications, but it can be extended to work with higher level protocols such as ebXML or bizTalk, or any other protocol that the industry - or a particular business partner - chooses to embrace at a later time.

JAXM messaging requires the use of a messaging provider service, which handles the transportation, routing, marshalling and unmarshalling work that goes on under the hood. The JAXM API shields developers from such details, and provides a clean and simple interface for sending messages, receiving messages, or simply taking part in the processing of a portion of a message (serving as a message intermediate). The messaging provider can offer additional functionality, such as guaranteed messaging, event logging and auditing, message threading, and even security. All such activity is shielded from the sender, receiver, or any participant in a messaging exchange. All that's required is that the JAXM client make method calls against the API. This decoupling allows messaging providers to offer value-added features and allows application developers the freedom to select the provider that best meets their needs. It may be helpful to think of JAXM in the messaging space as being equivalent to what JDBC provides in the database access space. In this analogy, a messaging provider serves a similar purpose as a JDBC driver. Developers write their application code to the API, and vendors develop software components that provide concrete implementations of the API. The primary difference here is that, while JDBC requires that you use a driver that is compatible with the database being used, the messages sent from a JAXM messaging provider conform to industry standards, and can be consumed by any recipient that understands those standards. The JAXM reference implementation uses SOAP 1.1, thus any SOAP-enabled recipient would be able to unmarshal a message sent from it

JAXM is a robust messaging technology supporting a wide-variety of messaging paradigms, including point-to-point messaging, publish-subscribe messaging, intermediate point-to-point, request-response, and even a process-workflow messaging model. (That's not a comprehensive list by any means.) Which specific messaging paradigms are available is entirely dependent on the messaging provider used, but JAXM provides a standard means of defining how a message should be sent and what auxiliary information may need to be passed in order to process the message properly.

In many ways, JAXM is very similar to the Java Messaging Service (JMS). They both provide an abstract messaging API that's decoupled from the back end implementation, and they both require a messaging provider to implement the API. In fact, the current JMS-compliant messaging providers are likely to be the first vendors to incorporate support for JAXM into their tools. The difference, then, between JAXM and JMS, is that JMS ultimately produces a Java-centric message. Whereas JAXM messages comply with industry-standard formats such as SOAP and ebXML.

4. JAXR - Registering/Locating XML Services
The Java API for XML Registries (JAXR) provides a registry independent API for accessing XML-based registries. A registry is very much like the yellow pages, or the listings maintained by a search engine. It provides a convenient means to browse available services, gather information regarding those services and then select the desired service. Like search engines, registries support the ability to return a list of search results based upon specified criteria. Like the yellow pages, registries categorize their contents and allow clients to browse by category. In addition to providing the ability to search such registries and retrieve details about available XML services, JAXR enables developers to publish new services to the registry and even to manage the registry data itself (assuming that proper authentication is provided first).

Although the majority of the literature talking about service registries discuss as the concept of global public registries like Xmethods.com, UDDI.org, and the registries of IBM, Microsoft, and HP a far more immediate use for service registries can be found in intranet and extranet registries. It's unlikely, any time in the near future, that consumers will query public registries trying to find the best deal on their auto insurance, or that businesses will start browsing public registries looking for a service to fill a mission critical need. A much more likely scenario is that businesses may set up private registries to serve as a single point of reference for their various enterprise services. Rather than an application developer combing through outdated documentation, or waiting for a response to a request they sent to management regarding a particular service they need to access, they can simply browse the company's internal registry looking for the service. If they can't find one, the developer can be reasonably sure that one doesn't exist. This tremendously increases the productivity of that developer and of everyone else that might have occasion to locate and/or access the available enterprise services. A similar need can be met with registries in a B2B extranet scenario. A business can expose a private registry to its business partners, providing them with a comprehensive, standards-based mechanism for searching, locating, inquiring about, and binding to whatever services the business has made available. The business could even allow the partner to register new services that would now become available for the business to access.

There are currently two primary specifications for XML registries:

  • The ebXML Registry and Repository standard being jointly developed by OASIS and the UN
  • The Universal Description, Discovery, and Integration (UDDI) specification being developed by a consortium of over 100 companies.

As is the case with the other Java XML Pack technologies, JAXR represents a flexible mechanism that's not tied to any particular implementation. Thus the same application code can be used for accessing first a UDDI registry, then an ebXML registry. The JAXR 1.0 Early Access Reference Implementation supports both the ebXML registry and the UDDI Registry v2.0 specification. Sun intends to incorporate support for ebXML as that standard is finalized.

5. JAX-RPC - XML-based RPC
The Java API for XML-based RPC (JAX-RPC) gives Java developers a simple, convenient mechanism for invoking remote procedures in a neutral, standards-based way. JAX-RPC is a synchronous, pure Java, RPC-invocation mechanism that leverages standard XML protocols such as SOAP. It's pure Java in that it doesn't require the existence of an XML schema or a messaging provider in order to make a remote call.

JAX-RPC provides a simple, object-oriented mechanism for specifying the service location, parameter types and values for a service. As with other RPC mechanisms, a JAX-RPC client simply creates a local object, propagates it with the necessary information, then invokes methods directly on the local object. When the call is made, JAX-RPC marshals the call across the network (as a SOAP message), and unmarshals the response (converts the SOAP response to a Java object). The details of the mapping and reverse mapping of data types and other XML element constructs are abstracted away from the JAX-RPC application developer. Thus, it provides a simple, straightforward mechanism for accessing RPC-style Web services from the Java platform.

As with any RPC mechanism, an interface for the remote procedure needs to be generated, along with stubs and ties. The JAX-RPC reference implementation accordingly ships with a stub and tie generation tool, xrpcc. Given an appropriate interface, the xrpcc tool generates stubs, ties, and a server configuration file. The tool supports both standard Java RMI interfaces and WSDL documents. In addition to generating the appropriate files to set up the RPC-runtime, the tool can also convert a set of Java RMI interfaces into a WSDL document and vice versa.

Like JAXM, JAX-RPC is a tremendous client technology for accessing Web services. Not only does it leverage Java's platform independency, allowing the client to be run on any Java 2 platform, but the ac-cess mechanism used by JAX-RPC is SOAP, an inherently language and plat-form neutral communication protocol. This provides the optimum in RPC-flexibility and portability.

Conclusion
The Java APIs and architectures for XML provide a comprehensive suite of XML APIs for the Java platform. JAXP allows developers a flexible means to parse, process and transform XML documents; JAXB defines a two-way mapping architecture between XML and Java; JAXM is a robust asynchronous messaging technology; JAXR provides standardized access to XML registries, and JAX-RPC enables RPC-style invocation of XML Web services.

Just as JDBC has become an expected acronym to see on a Java developer's resumé, the JAX technologies are sure to become a required part of any Web or enterprise developer's toolkit.

Exploring Further
You can download the pack from Sun's Web site at http://java.sun.com/xml/javaxmlpack.html and take it for a spin. Sun recently released the Java XML Pack as a part of the Java Web Services Developer Pack (Java WSDP) which is available for download at http://java.sun.com/webservices/webservicespack.html A tutorial for the WSDP is available at http://java.sun.com/webservices/docs/ea1/tutorial/index.html

More Stories By Kyle Gabhart

Kyle Gabhart is a subject matter expert specializing in strategic planning and tactical delivery of enterprise technology solutions, blending EA, BPM, SOA, Cloud Computing, and other emerging technologies. Kyle currently serves as a director for Web Age Solutions, a premier provider of technology education and mentoring. Since 2001 he has contributed extensively to the IT community as an author, speaker, consultant, and open source contributor.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@MicroservicesExpo Stories
With continuous delivery (CD) almost always in the spotlight, continuous integration (CI) is often left out in the cold. Indeed, it's been in use for so long and so widely, we often take the model for granted. So what is CI and how can you make the most of it? This blog is intended to answer those questions. Before we step into examining CI, we need to look back. Software developers often work in small teams and modularity, and need to integrate their changes with the rest of the project code b...
There is a huge demand for responsive, real-time mobile and web experiences, but current architectural patterns do not easily accommodate applications that respond to events in real time. Common solutions using message queues or HTTP long-polling quickly lead to resiliency, scalability and development velocity challenges. In his session at 21st Cloud Expo, Ryland Degnan, a Senior Software Engineer on the Netflix Edge Platform team, will discuss how by leveraging a reactive stream-based protocol,...
In his session at 20th Cloud Expo, Mike Johnston, an infrastructure engineer at Supergiant.io, discussed how to use Kubernetes to set up a SaaS infrastructure for your business. Mike Johnston is an infrastructure engineer at Supergiant.io with over 12 years of experience designing, deploying, and maintaining server and workstation infrastructure at all scales. He has experience with brick and mortar data centers as well as cloud providers like Digital Ocean, Amazon Web Services, and Rackspace. H...
SYS-CON Events announced today that Calligo has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Calligo is an innovative cloud service provider offering mid-sized companies the highest levels of data privacy. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalized support service from its globally located cloud platfor...
Many organizations are now looking to DevOps maturity models to gauge their DevOps adoption and compare their maturity to their peers. However, as enterprise organizations rush to adopt DevOps, moving past experimentation to embrace it at scale, they are in danger of falling into the trap that they have fallen into time and time again. Unfortunately, we've seen this movie before, and we know how it ends: badly.
"Outscale was founded in 2010, is based in France, is a strategic partner to Dassault Systémes and has done quite a bit of work with divisions of Dassault," explained Jackie Funk, Digital Marketing exec at Outscale, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
From personal care products to groceries and movies on demand, cloud-based subscriptions are fulfilling the needs of consumers across an array of market sectors. Nowhere is this shift to subscription services more evident than in the technology sector. By adopting an Everything-as-a-Service (XaaS) delivery model, companies are able to tailor their computing environments to shape the experiences they want for customers as well as their workforce.
If you read a lot of business and technology publications, you might think public clouds are universally preferred over all other cloud options. To be sure, the numbers posted by Amazon Web Services (AWS) and Microsoft’s Azure platform are nothing short of impressive. Statistics reveal that public clouds are growing faster than private clouds and analysts at IDC predict that public cloud growth will be 3 times that of private clouds by 2019.
"DivvyCloud as a company set out to help customers automate solutions to the most common cloud problems," noted Jeremy Snyder, VP of Business Development at DivvyCloud, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We focus on SAP workloads because they are among the most powerful but somewhat challenging workloads out there to take into public cloud," explained Swen Conrad, CEO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"As we've gone out into the public cloud we've seen that over time we may have lost a few things - we've lost control, we've given up cost to a certain extent, and then security, flexibility," explained Steve Conner, VP of Sales at Cloudistics,in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"Peak 10 is a hybrid infrastructure provider across the nation. We are in the thick of things when it comes to hybrid IT," explained , Chief Technology Officer at Peak 10, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"I think DevOps is now a rambunctious teenager – it’s starting to get a mind of its own, wanting to get its own things but it still needs some adult supervision," explained Thomas Hooker, VP of marketing at CollabNet, in this SYS-CON.tv interview at DevOps Summit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"I will be talking about ChatOps and ChatOps as a way to solve some problems in the DevOps space," explained Himanshu Chhetri, CTO of Addteq, in this SYS-CON.tv interview at @DevOpsSummit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
Your homes and cars can be automated and self-serviced. Why can't your storage? From simply asking questions to analyze and troubleshoot your infrastructure, to provisioning storage with snapshots, recovery and replication, your wildest sci-fi dream has come true. In his session at @DevOpsSummit at 20th Cloud Expo, Dan Florea, Director of Product Management at Tintri, provided a ChatOps demo where you can talk to your storage and manage it from anywhere, through Slack and similar services with...
If you are thinking about moving applications off a mainframe and over to open systems and the cloud, consider these guidelines to prioritize what to move and what to eliminate. On the surface, mainframe architecture seems relatively simple: A centrally located computer processes data through an input/output subsystem and stores its computations in memory. At the other end of the mainframe are printers and terminals that communicate with the mainframe through protocols. For all of its apparen...
DevOps at Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to w...
"At the keynote this morning we spoke about the value proposition of Nutanix, of having a DevOps culture and a mindset, and the business outcomes of achieving agility and scale, which everybody here is trying to accomplish," noted Mark Lavi, DevOps Solution Architect at Nutanix, in this SYS-CON.tv interview at @DevOpsSummit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
For over a decade, Application Programming Interface or APIs have been used to exchange data between multiple platforms. From social media to news and media sites, most websites depend on APIs to provide a dynamic and real-time digital experience. APIs have made its way into almost every device and service available today and it continues to spur innovations in every field of technology. There are multiple programming languages used to build and run applications in the online world. And just li...
Data reduction delivers compelling cost reduction that substantially improves the business case in every cloud deployment model. No matter which cloud approach you choose, the cost savings benefits from data reduction should not be ignored and must be a component of your cloud strategy. IT professionals are finding that the future of IT infrastructure lies in the cloud. Data reduction technologies enable clouds — public, private, and hybrid — to deliver business agility and elasticity at the lo...