Microservices Expo Authors: Dalibor Siroky, Liz McMillan, John Worthington, Automic Blog, Don MacVittie

Related Topics: Microservices Expo

Microservices Expo: Article

JAXM: Interoperable SOAP Communications for the Java Platform

JAXM: Interoperable SOAP Communications for the Java Platform

The Java API for XML Messaging (JAXM) is a new Java application programming interface (API) that provides a standard way for Java applications to send and receive Simple Object Access Protocol (SOAP) messages. The basic idea is to allow developers to spend more time building, sending, receiving, and deconstructing messages for their applications and less time programming low-level XML communications routines. Developed through the Java Community Process, JAXM provides a simple yet flexible standard API for developing and deploying SOAP-based applications that can be truly interoperable with applications developed on other platforms. JAXM will be available as an optional package for the Java 2 platform, Standard Edition and may also be included in future releases of J2SE and Java 2, Enterprise Edition (J2EE).

JAXM is intended to be a messaging API for the development of XML-based business applications that occur primarily, although not exclusively, at the edge of organizations. The need for generating such messages is growing rapidly as corporations begin to do more business over the Internet. What's needed is the ability to communicate not only with a single hub or exchange that is driving the company's move towards e-commerce but with a wide range of business partners. While some hubs such as Wal-Mart and Home Depot have created their own e-commerce standards, the industry as a whole seems to be moving toward the development of industry-wide standards that will expedite e-business interoperability.

SOAP, one of the most important of these new standards, addresses critical transport and packaging issues. SOAP can be thought of as a successor to the XML-RPC standard in that it provides an RPC transport mechanism for XML over HTTP. As stated in the W3C SOAP 1.1 draft: "SOAP is a lightweight protocol, for exchange of information in a decentralized, distributed environment." The SOAP protocol has three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing remote procedure calls and responses. SOAP has received considerable acceptance in the industry as the de facto way of exchanging data between applications in an interoperable fashion.

Lightweight but Adaptable to More Complex Protocols
The minimum requirement to support JAXM is to be able to use a simple set of APIs for sending, receiving, and parsing of SOAP messages. The on-the-wire protocol of a JAXM message is vanilla SOAP over HTTP. Hence a JAXM-enabled application may communicate with any other application that knows how to speak SOAP - including those built on platforms that have nothing to do with Java, such as Microsoft's BizTalk server.

In an all-Java environment the simplest deployment configuration would be to use the Sun reference implementation (RI) as the JAXM "provider." The sending client uses the JAXM APIs to send a SOAP message over HTTP. The receiving client is registered as a servlet, as illustrated in Figure 1.

While the base architecture of JAXM is very simple, it can be extended to work in a more complex messaging infrastructure such as ebXML through the notion of a base "profile." A JAXM profile is an extension to the JAXM specification that allows a JAXM implementation to take on a certain predefined personality. For example, an ebXML profile would cause a JAXM MessageFactory object to create an ebXML SOAPMessage object instead of a vanilla SOAPMessage object.

The SOAP Packaging
JAXM is based on the SOAP 1.1 and SOAP with Attachments specifications. JAXM offers two different packaging models for SOAP messages, one that includes attachments and one that does not. The SOAPMessage class is the root class for all SOAP messages. If the SOAP message includes AttachmentPart objects, then the message is encoded as a MIME message. A message that contains attachments must have a MIME envelope which contains both the SOAP part of the message and the MIME attachment. All JAXM clients must be capable of reading SOAP 1.1 messages with attachments.

Creating and Sending Messages
The example below shows how JAXM uses a ProviderConnectionFactory object to create a connection with a messaging provider. The same object can be used later to send the message. The first two lines use the JNDI API to retrieve the appropriate ProviderConnectionFactory object from the naming service where it was registered with MyExchange. This logical name is passed as an argument, then the method lookup returns the ProviderConnectionFactory object that the logical name was bound to. The returned value must be narrowed to a ProviderConnectionFactory object in order to use it to make the connection. A JAXM method is invoked to actually start the connection instance connect1 in the final line of the code.

Context ctx = getInitialContext ();
ProviderConnectionFactory cf =
ProviderConnection connect1 =cf.createConnection();
The MessageFactory class is used to create SOAPMessage objects. A JAXM client may create a new instance of the MessageFactory object for request response messaging using the SOAPConnection newInstance method. On the other hand, when one-way asynchronous messaging is required, the createMessageFactory method of the ProviderConnection object must be used. The following example shows how MessageFactory objects are used to create SOAPMessage objects.

MessageFactory MessageFactory1 =
connect1.createMessageFactory() SOAPMessage transact1 =
JAXM Profiles
It's important to note that SOAP specifies that messages will contain the necessary addressing information but does not define a standard way for this information to be represented within a message. For that reason, JAXM relies on industry-standard usages of SOAP, called profiles, for interoperable addressing conventions. For example, the profile may stipulate the specifications of the SOAP header, such as the sender, recipient, message ID and correlation information. The way in which this information is mapped onto a given message is defined by the Profile String. Profiles represent a usage of SOAP by a particular standards group or industry. The getSupportedProfiles()method retrieves a list of the messaging profiles that are supported by the messaging provider to which the ProviderConnection object is connected. For example, ebXML or BizTalk profiles can be built on top of SOAP messaging. ebXML is an emerging standard based on the vision of creating a single global electronic marketplace where companies of any size and geographical location can meet and conduct business through the exchange of XML messages. SOAP is integrated into the ebXML messaging specification in order to provide the underpinnings for its messaging requirements.

When profiles are being used, an application may not need to specify an address when it sends a message because destination information will be contained in the profile-specific header. If profiles are not used, destinations are specified with an Endpoint object that represents the mapping of a logical name, such as a URI, to a physical location, such as a URL. Typically, an Endpoint object represents a business entity but it may represent a destination of any sort. Conceptually, an Endpoint object is the mapping of a logical name, such as a URI, to a physical location, such as a URL.

In the example above, the method MessageFactory was given no argument so it returned the transact1 object that produces messages using the basic SOAP profile. The code example below shows how to create a MessageFactory object that supports a particular profile. Message objects produced by such a message factory are specific to the named profile. In order to assure interoperability, much scrutiny must be given to the development of profiles.

MessageFactory messagefactory2 =
connect1.createMessageFactory (<profile1>); SOAPMessage
transact2 = messagefactory2.createMessage();
Multipart Messages
The next step is adding content to the message. SOAP messages are designed to send XML documents in the body of the message. But if the message is to include anything that is not an XML document, then it must have an attachment part. The packaging model for a message without attachments is much simpler, consisting only of a message package with an envelope containing a header and body. A SOAP message with attachments adds the concept of a SOAP part that contains an envelope similar to the one described above. In addition, the message can contain multiple attachment parts that along with the SOAP part are contained in a MIME envelope. There may be any number of attachments and they can contain any type of file.

The following example demonstrates how to build the body of the message. The SOAPMessage contains the SOAPPart, which in turn is used to obtain the SOAPEnvelope. The SOAPEnvelope is then used to obtain the body of the message.

SOAPpart spart = transact2.getSOAPPart ();

SOAPEnvelope envelope = spart.getEnvelope ();
SOAPBody sbody = envelope.getBody();

Once the message body is obtained, the SOAPBody.addBodyElement() and SOAPBodyElement.addChildElement() methods are used to create any level of nested elements within the SOAP body, as illustrated in the following code:

SOAPBodyElement gltp
= sbody.addBodyElement (envelope.createName
("GetLastTradePrice", "ztrade", "http://wombat.ztrade.com"));

gltp.addChildElement (envelope.createName ("symbol",
"ztrade", "http://wombat.ztrade.com")).addTextNode ("PRGS");

The following code shows how to create an attachment part. In this example, the content is an image in a GIF file whose url is used to initialize the javax.activation.DataHandler object data handler1. The SOAPMessage object message1 creates the AttachmentPart object attachmentpar1t which is initialized with the data handler containing the url for the image. Finally, attachmentpar1t is added to the message.

URL url = new URL("http://main/picture.gif");
DataHandler datahandler1 = new DataHandler(url);
AttachmentPart attachmentpart1 =
The last step to be covered here is sending the message using a Provider Connection object which, as described earlier, is a connection to a messaging provider. If asynchronous messaging is being done in the context of a container, such as a servlet or J2EE container, the send method is used. The send method sends the given SOAPMessage object and returns immediately after handing the message over to the messaging provider. No assumptions are made regarding the ultimate success or failure of message delivery at the time this method returns. The ProviderConnection send method requires one parameter, the SOAPMessage object that's being sent.

SOAPMessage reply = connect1.send(transact1);
The call method on the SOAPConnection object is used to send a synchronous message. The call method will block until a SOAPMessage object is received. A JAXM application may use the call method to implement the client side of a simple point-to-point synchronous one-way message exchange. Two parameters are required for the call method, the SOAPMessage object that is being sent and the Endpoint object representing the destination. For point-to-point plain SOAP messaging, where no profile is used, an application must supply an Endpoint object to the call method to indicate the intended destination of the message. The default identification for an Endpoint object is a URI. At a minimum, this is what JAXM messaging providers are required to support to identify a destination. Endpoint objects can be created using the constructor, or they can be looked up in a naming scheme. The Endpoint subclass URLEndpoint can be used to send a message directly to a remote party without using a messaging provider.

The following code example creates an Endpoint object called endpoint1 from a URL for the intended recipient and passes it along with the SOAPMessage object message1 to the SOAPConnection call method, creating a synchronous transmission.

Endpoint endpoint1 = new Endpoint ("http://myexchange.com/transactions"); con.call(message1, endpoint1);
The JAXM 'Provider'
In lieu of actually supplying the more detailed profiles, the base API is very light on "Messaging" and heavy on SOAP content. The majority of the API is built around how to construct and deconstruct SOAP messages. However, there is much allusion to the JAXM "provider" woven throughout the specification.

In distributed application communications among enterprises and across business entities, the use of SOAP over vanilla HTTP just doesn't cut it. Parties are often unreachable, yet reliability of communications is crucial. This gap may be filled in the future by more powerful JAXM messaging providers based on protocols, such as JMS, that provide a simple, robust way of addressing these issues. The JMS specification offers a robust messaging model that supports a variety of asynchronous and synchronous communication mechanisms.

JMS comprises an API and semantics for a middleware messaging system that helps insulate the application from the issues posed by loosely coupled systems by providing services, such as persistence, verification, and transaction support. It has all the semantics of failure scenarios built in via a loosely coupled disconnected operation, persistent messaging, internal acknowledgment of message receipt and rules of engagement regarding transactional recovery and message redelivery. The very minimum required for the two technologies (JAXM and JMS) to work together is the ability for a JMS provider to be able to bridge to SOAP/ HTTP.

By providing a standard way to send messages over the Internet from the Java platform, JAXM is almost guaranteed a successful launch. This new standard will provide a major impetus to the creation of many-to-many B2B e-commerce applications using industry standard technology. Perhaps the most important feature of JAXM is its extensibility - its messaging provider and profile concepts will allow it to easily support new interoperability concepts in the future.

More Stories By Dave Chappell

David Chappell is vice president and chief technologist for SOA at Oracle Corporation, and is driving the vision for Oracle’s SOA on App Grid initiative.

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
The nature of test environments is inherently temporary—you set up an environment, run through an automated test suite, and then tear down the environment. If you can reduce the cycle time for this process down to hours or minutes, then you may be able to cut your test environment budgets considerably. The impact of cloud adoption on test environments is a valuable advancement in both cost savings and agility. The on-demand model takes advantage of public cloud APIs requiring only payment for t...
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...
identify the sources of event storms and performance anomalies will require automated, real-time root-cause analysis. I think Enterprise Management Associates said it well: “The data and metrics collected at instrumentation points across the application ecosystem are essential to performance monitoring and root cause analysis. However, analytics capable of transforming data and metrics into an application-focused report or dashboards are what separates actual application monitoring from relat...
The benefits of automation are well documented; it increases productivity, cuts cost and minimizes errors. It eliminates repetitive manual tasks, freeing us up to be more innovative. By that logic, surely, we should automate everything possible, right? So, is attempting to automate everything a sensible - even feasible - goal? In a word: no. Consider this your short guide as to what to automate and what not to automate.
We just came off of a review of a product that handles both containers and virtual machines in the same interface. Under the covers, implementation of containers defaults to LXC, though recently Docker support was added. When reading online, or searching for information, increasingly we see “Container Management” products listed as competitors to Docker, when in reality things like Rocket, LXC/LXD, and Virtualization are Dockers competitors. After doing some looking around, we have decided tha...
It’s “time to move on from DevOps and continuous delivery.” This was the provocative title of a recent article in ZDNet, in which Kelsey Hightower, staff developer advocate at Google Cloud Platform, suggested that “software shops should have put these concepts into action years ago.” Reading articles like this or listening to talks at most DevOps conferences might make you think that we’re entering a post-DevOps world. But vast numbers of organizations still struggle to start and drive transfo...
Enterprises are adopting Kubernetes to accelerate the development and the delivery of cloud-native applications. However, sharing a Kubernetes cluster between members of the same team can be challenging. And, sharing clusters across multiple teams is even harder. Kubernetes offers several constructs to help implement segmentation and isolation. However, these primitives can be complex to understand and apply. As a result, it’s becoming common for enterprises to end up with several clusters. Thi...
Many enterprise and government IT organizations are realizing the benefits of cloud computing by extending IT delivery and management processes across private and public cloud services. But they are often challenged with balancing the need for centralized cloud governance without stifling user-driven innovation. This strategy requires an approach that fundamentally reshapes how IT is delivered today, shifting the focus from infrastructure to services aggregation, and mixing and matching the bes...
Cavirin Systems has just announced C2, a SaaS offering designed to bring continuous security assessment and remediation to hybrid environments, containers, and data centers. Cavirin C2 is deployed within Amazon Web Services (AWS) and features a flexible licensing model for easy scalability and clear pay-as-you-go pricing. Although native to AWS, it also supports assessment and remediation of virtual or container instances within Microsoft Azure, Google Cloud Platform (GCP), or on-premise. By dr...
"Codigm is based on the cloud and we are here to explore marketing opportunities in America. Our mission is to make an ecosystem of the SW environment that anyone can understand, learn, teach, and develop the SW on the cloud," explained Sung Tae Ryu, CEO of Codigm, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
High-velocity engineering teams are applying not only continuous delivery processes, but also lessons in experimentation from established leaders like Amazon, Netflix, and Facebook. These companies have made experimentation a foundation for their release processes, allowing them to try out major feature releases and redesigns within smaller groups before making them broadly available. In his session at 21st Cloud Expo, Brian Lucas, Senior Staff Engineer at Optimizely, discussed how by using ne...
"CA has been doing a lot of things in the area of DevOps. Now we have a complete set of tool sets in order to enable customers to go all the way from planning to development to testing down to release into the operations," explained Aruna Ravichandran, Vice President of Global Marketing and Strategy at CA Technologies, in this SYS-CON.tv interview at DevOps Summit at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Let's do a visualization exercise. Imagine it's December 31, 2018, and you're ringing in the New Year with your friends and family. You think back on everything that you accomplished in the last year: your company's revenue is through the roof thanks to the success of your product, and you were promoted to Lead Developer. 2019 is poised to be an even bigger year for your company because you have the tools and insight to scale as quickly as demand requires. You're a happy human, and it's not just...
"Opsani helps the enterprise adopt containers, help them move their infrastructure into this modern world of DevOps, accelerate the delivery of new features into production, and really get them going on the container path," explained Ross Schibler, CEO of Opsani, and Peter Nickolov, CTO of Opsani, in this SYS-CON.tv interview at DevOps Summit at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, discussed how data centers of the future will be managed, how the p...
DevOps teams have more on their plate than ever. As infrastructure needs grow, so does the time required to ensure that everything's running smoothly. This makes automation crucial - especially in the server and network monitoring world. Server monitoring tools can save teams time by automating server management and providing real-time performance updates. As budgets reset for the New Year, there is no better time to implement a new server monitoring tool (or re-evaluate your current solution)....
While we understand Agile as a means to accelerate innovation, manage uncertainty and cope with ambiguity, many are inclined to think that it conflicts with the objectives of traditional engineering projects, such as building a highway, skyscraper or power plant. These are plan-driven and predictive projects that seek to avoid any uncertainty. This type of thinking, however, is short-sighted. Agile approaches are valuable in controlling uncertainty because they constrain the complexity that ste...
"This all sounds great. But it's just not realistic." This is what a group of five senior IT executives told me during a workshop I held not long ago. We were working through an exercise on the organizational characteristics necessary to successfully execute a digital transformation, and the group was doing their ‘readout.' The executives loved everything we discussed and agreed that if such an environment existed, it would make transformation much easier. They just didn't believe it was reali...
"We're developing a software that is based on the cloud environment and we are providing those services to corporations and the general public," explained Seungmin Kim, CEO/CTO of SM Systems Inc., in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
The cloud revolution in enterprises has very clearly crossed the phase of proof-of-concepts into a truly mainstream adoption. One of most popular enterprise-wide initiatives currently going on are “cloud migration” programs of some kind or another. Finding business value for these programs is not hard to fathom – they include hyperelasticity in infrastructure consumption, subscription based models, and agility derived from rapid speed of deployment of applications. These factors will continue to...