Jump to content

Java API for XML Messaging

From Alfawiki
Java API for XML Messaging (JAXM)
Company typeAPI
IndustrySoftware, Web services
Area served
Distributed software systems
ProductsXML messaging, SOAP messaging

Java API for XML Messaging (JAXM) facilitates communication between distributed software systems using XML and SOAP, supporting both synchronous and asynchronous message exchanges.

Overview

JAXM enables developers to construct and transmit XML messages over the internet leveraging the Java platform. It provides several benefits compared to Remote Procedure Call (RPC), such as support for one-way (asynchronous) messaging, the ability to route messages to multiple recipients, and assured message delivery.

The JAXM framework is composed of two primary packages:

  • javax.xml.soap: used for creating and assembling SOAP messages.
  • javax.xml.messaging: designed for dispatching one-way messages through a messaging provider.

Messages

Messages in JAXM adhere to XML format following SOAP protocols and may include attachments. Attachments—like images—are handled via the AttachmentPart class provided by the SAAJ API.

Connections

To send or receive SOAP messages, a connection is necessary, which can be established either directly with the recipient or through a messaging provider. JAXM offers:

  • javax.xml.soap.SOAPConnection: a direct sender-to-recipient communication channel.
  • javax.xml.messaging.ProviderConnection: a link to a messaging provider.

SOAP Connection

The SOAPConnection represents a direct point-to-point link for transmitting messages straight to another party. It is straightforward to instantiate and operate, requiring no deployment within servlet containers or J2EE servers. This makes it unique as the only client-side connection method that functions without involving a service provider.

Provider Connection

A ProviderConnection signifies a connection established with a messaging provider. When sending messages via this connection, the messaging provider takes responsibility for routing the message to the recipient’s messaging provider, which then ensures final delivery.

Messaging Providers

Messaging providers oversee message routing and tracking, guaranteeing that messages reach their intended endpoints. They act as intermediaries managing message transmission paths.

When to use a Messaging Provider

Employing a messaging provider in JAXM clients is optional. Without it, clients are restricted to request-response interactions and can only function as clients. However, foregoing a messaging provider offers several advantages:

  • Development can occur on the J2SE platform
  • No requirement for deployment within servlet or J2EE environments
  • Eliminates configuration needs

These factors make it ideal for straightforward Web service consumers.

See also