Welcome!

Microservices Expo Authors: Pat Romanski, Liz McMillan, Elizabeth White, Mehdi Daoudi, Flint Brenton

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 the rise of DevOps, containers are at the brink of becoming a pervasive technology in Enterprise IT to accelerate application delivery for the business. When it comes to adopting containers in the enterprise, security is the highest adoption barrier. Is your organization ready to address the security risks with containers for your DevOps environment? In his session at @DevOpsSummit at 21st Cloud Expo, Chris Van Tuin, Chief Technologist, NA West at Red Hat, will discuss: The top security r...
DevOps at Cloud Expo – being held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real r...
The “Digital Era” is forcing us to engage with new methods to build, operate and maintain applications. This transformation also implies an evolution to more and more intelligent applications to better engage with the customers, while creating significant market differentiators. In both cases, the cloud has become a key enabler to embrace this digital revolution. So, moving to the cloud is no longer the question; the new questions are HOW and WHEN. To make this equation even more complex, most ...
The last two years has seen discussions about cloud computing evolve from the public / private / hybrid split to the reality that most enterprises will be creating a complex, multi-cloud strategy. Companies are wary of committing all of their resources to a single cloud, and instead are choosing to spread the risk – and the benefits – of cloud computing across multiple providers and internal infrastructures, as they follow their business needs. Will this approach be successful? How large is the ...
21st International Cloud Expo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Me...
Many organizations adopt DevOps to reduce cycle times and deliver software faster; some take on DevOps to drive higher quality and better end-user experience; others look to DevOps for a clearer line-of-sight to customers to drive better business impacts. In truth, these three foundations go together. In this power panel at @DevOpsSummit 21st Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, industry experts will discuss how leading organizations build application success from all...
You know you need the cloud, but you’re hesitant to simply dump everything at Amazon since you know that not all workloads are suitable for cloud. You know that you want the kind of ease of use and scalability that you get with public cloud, but your applications are architected in a way that makes the public cloud a non-starter. You’re looking at private cloud solutions based on hyperconverged infrastructure, but you’re concerned with the limits inherent in those technologies.
‘Trend’ is a pretty common business term, but its definition tends to vary by industry. In performance monitoring, trend, or trend shift, is a key metric that is used to indicate change. Change is inevitable. Today’s websites must frequently update and change to keep up with competition and attract new users, but such changes can have a negative impact on the user experience if not managed properly. The dynamic nature of the Internet makes it necessary to constantly monitor different metrics. O...
Today companies are looking to achieve cloud-first digital agility to reduce time-to-market, optimize utilization of resources, and rapidly deliver disruptive business solutions. However, leveraging the benefits of cloud deployments can be complicated for companies with extensive legacy computing environments. In his session at 21st Cloud Expo, Craig Sproule, founder and CEO of Metavine, will outline the challenges enterprises face in migrating legacy solutions to the cloud. He will also prese...
Enterprises are moving to the cloud faster than most of us in security expected. CIOs are going from 0 to 100 in cloud adoption and leaving security teams in the dust. Once cloud is part of an enterprise stack, it’s unclear who has responsibility for the protection of applications, services, and data. When cloud breaches occur, whether active compromise or a publicly accessible database, the blame must fall on both service providers and users. In his session at 21st Cloud Expo, Ben Johnson, C...
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
As DevOps methodologies expand their reach across the enterprise, organizations face the daunting challenge of adapting related cloud strategies to ensure optimal alignment, from managing complexity to ensuring proper governance. How can culture, automation, legacy apps and even budget be reexamined to enable this ongoing shift within the modern software factory?
The nature of the technology business is forward-thinking. It focuses on the future and what’s coming next. Innovations and creativity in our world of software development strive to improve the status quo and increase customer satisfaction through speed and increased connectivity. Yet, while it's exciting to see enterprises embrace new ways of thinking and advance their processes with cutting edge technology, it rarely happens rapidly or even simultaneously across all industries.
These days, APIs have become an integral part of the digital transformation journey for all enterprises. Every digital innovation story is connected to APIs . But have you ever pondered over to know what are the source of these APIs? Let me explain - APIs sources can be varied, internal or external, solving different purposes, but mostly categorized into the following two categories. Data lakes is a term used to represent disconnected but relevant data that are used by various business units wit...
"When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"NetApp's vision is how we help organizations manage data - delivering the right data in the right place, in the right time, to the people who need it, and doing it agnostic to what the platform is," explained Josh Atwell, Developer Advocate for NetApp, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
One of the biggest challenges with adopting a DevOps mentality is: new applications are easily adapted to cloud-native, microservice-based, or containerized architectures - they can be built for them - but old applications need complex refactoring. On the other hand, these new technologies can require relearning or adapting new, oftentimes more complex, methodologies and tools to be ready for production. In his general session at @DevOpsSummit at 20th Cloud Expo, Chris Brown, Solutions Marketi...
Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
Most of the time there is a lot of work involved to move to the cloud, and most of that isn't really related to AWS or Azure or Google Cloud. Before we talk about public cloud vendors and DevOps tools, there are usually several technical and non-technical challenges that are connected to it and that every company needs to solve to move to the cloud. In his session at 21st Cloud Expo, Stefano Bellasio, CEO and founder of Cloud Academy Inc., will discuss what the tools, disciplines, and cultural...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm. In their Day 3 Keynote at 20th Cloud Expo, Chris Brown, a Solutions Marketing Manager at Nutanix, and Mark Lav...