XML messaging, Part 2 - JavaWorld June
2001
Tutorial Details:
XML messaging, Part 2
XML messaging, Part 2
By: By Dirk Reinshagen
XML messaging the SOAP way
ore widely used each day, developers are turning to the SOAP standard for XML messaging. SOAP (Simple Object Access Protocol) was originally proposed by Microsoft but has been subsequently adopted by IBM and many other companies, including, more recently, Sun Microsystems.
Read the whole "XML Messaging" series:
Part 1: Write a simple XML message broker for custom XML messages
Part 2: XML messaging the SOAP way
Part 3: JAXM and ebXML set the new standard for XML messaging
SOAP is an XML messaging/RPC (Remote Procedure Call) standard to enable the exchange of a variety of information. As one benefit, it provides a framework for XML messaging without excessive complexity. The SOAP specification is fairly concise compared with many other messaging standards, with much of the text dedicated to encoding. Because of its widespread industry support, simple design, and the use of SOAP in other XML standards, SOAP appears to be the XML messaging standard to watch.
In this article, the second of three, I'll begin by describing SOAP's fundamentals and capabilities. Next, I'll introduce the standards that use SOAP in some fashion, including UDDI (Universal Description, Discovery, and Integration), Web services, and BizTalk. I'll then briefly discuss the future of SOAP, wrapping up by developing the same simple messaging application covered in Part 1 .
SOAP features
SOAP comprises three major components: a messaging framework, an encoding standard, and an RPC mechanism. When using SOAP, you can choose to use just the messaging framework, the messaging framework with the encoding standard, or all three together. Let's look at each in more detail.
SOAP's messaging framework
SOAP's messaging framework says that SOAP messages will be composed of an outer envelope that can contain a header and a body. The following is a skeleton example of a SOAP message with no information in it. Make note of the outer most element called the SOAP envelope, as everything in a SOAP message falls inside it. The other two important tags are the SOAP header and the SOAP body. The header portion of the message carries meta data about the message, while the body contains the message's payload:
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
In SOAP, you'll notice the heavy use of XML namespaces. For instance, the SOAP-ENV namespace in the example above denotes elements related to the SOAP envelope, header, and body. A SOAP document, consequently, can prove slightly more difficult to read than other XML documents, necessary for the flexibility SOAP requires to be extensible.
Header elements in a SOAP document can be labeled as mustUnderstand , meaning that the server that processes the SOAP message must understand that type of header element or it must reject the message.
Messages are rejected by generating SOAP faults. Faults happen when an error occurs when processing a message. Errors can have many causes, but the most likely culprits include an unrecognizable header field, a message that cannot be authenticated, or errors that occur when invoking a method to process the message.
Encoding/serialization standard for objects
In one feature differentiating it from other XML messaging standards, the SOAP specification's encoding/serialization portion speaks to how objects are encoded or serialized when sent over SOAP. Having an encoding standard for SOAP messages means that objects can be encoded in SOAP messages in a standard way, and then decoded by the message recipient. For instance, an integer array would be encoded in SOAP as:
8
5
9
The SOAP library found on the client and the server performs the encoding/decoding. SOAP's encoding/serialization features are mainly used in conjunction with the RPC mechanism, which you'll see next.
SOAP's RPC mechanism
SOAP's RPC portion speaks to the ability to use the SOAP protocol to invoke procedures on the receiving end of a SOAP message. The RPC mechanism builds on the encoding portion by allowing encoded objects to pass as arguments to a remote procedure.
When using the RPC mechanism, it's relatively easy to set up a call and invoke a remote procedure. You only need to know the name of the procedure you wish to call and the arguments to that method.
Once you invoke a method using SOAP, the SOAP library you use encodes or serializes the arguments using SOAP's encoding standard. The SOAP library you use will also send the RPC over the transport you specify.
This is somewhat CORBA-like, in that it lets you use different languages to encode data, such as an array, and then decode it in another language. This idea of encoding arbitrary objects automatically into an XML message makes producing XML messages much easier than explicitly creating the message by setting each element's value.
In Part 1 , I stated that messaging is really not an RPC mechanism and that one benefit of messaging is the loose coupling it enables by not being bound to particular methods and arguments. SOAP's RPC mechanism seems to muddy the water a bit in that it is an RPC mechanism that does create a more tightly coupled relationship than messaging promises.
Issues with using RPCs
The SOAP RPC mechanism may create tighter coupling than desired for two reasons. First, you know the name of the method you will invoke, as well as its parameters. Consequently, if you change the invoked methods' method signature, you will also have to change the classes (or SOAP clients in this case) that call it. Note: UDDI addresses some of this by providing a way to dynamically look up the method name for a particular Web service.
Second, the interface between the client and server and the parameters passed must be known ahead of time by both parties. If one of a method's arguments should change, the change affects both client and server. For instance, if we change one of the parameters to a SOAP call named Person , a JavaBean, so that it has an additional field, both the client and server may need to be changed as a consequence. SOAP doesn't really address the description of methods and parameters very well, but, as you read in the section ahead, you'll see that the WSDL (Web Services Description Language) compensates.
As a final note on RPC, just because SOAP includes an RPC mechanism does not mean that you must use it. If you prefer to use SOAP only in a message-oriented way, you can still do so. Indeed, nothing forces you to use SOAP's RPC mechanism.
RPC versus message-oriented
Given all of the negatives stemming from the RPC mechanism's tight coupling, you should avoid it, right? Well, it turns out the RPC mechanism proves useful in some cases. One of the reasons for this is simple: it's easier. That is, it takes less work to develop communication between two systems if you use the RPC-oriented approach.
Indeed, a message-oriented approach requires that you define a message format, then compose a message using the format before sending and extracting that data from the message after receiving. The RPC-oriented approach does all this semi-automatically because the method you are calling determines the RPC format and SOAP's encoding/serialization standards for objects determine how the parameters will be encoded into XML.
Because of the tradeoffs between these two approaches, the following guidelines normally apply:
Consider using SOAP's RPC mechanism for communication within the enterprise, assuming that producing a more tightly coupled system is not an issue (if it is then go with the message-oriented approach).
Consider employing SOAP's message-oriented approach for communication between two different business entities. Ideally this is done using an existing industry-standard message schema.
SOAP pros and cons
So what are the advantages to employing SOAP for XML messaging? And what are the drawbacks? One advantage: SOAP appears to be the most widely accepted XML messaging standard; almost all major companies support it.
Next, SOAP allows both message-oriented or RPC-oriented communications, a feature differentiating SOAP from other messaging standards. It even throws in a standard mechanism for XML object encoding/serialization, useful when trying to use SOAP as an RPC mechanism.
As for disadvantages, SOAP requires other supporting standards to provide full functionality. For instance, because SOAP does not include any header elements, you'll need a standard layered on top of SOAP, BizTalk for example, to perform message routing. This means both parties must understand SOAP and BizTalk (in this case).
Moreover, interoperability has not been perfected. Not all SOAP implementations work perfectly together, and it may be some time before they do. Indeed, many of the incompatibilities are encountered when using the encoding and RPC mechanism.
So SOAP isn't perfect yet even though it has existed for almost two years. It's still changing rapidly and it will be a few more years before it is widely deployed. In the meantime, we'll need to live with a few wrinkles. But not to worry. One of the nice things about SOAP is that you can rectify some of its short falls by layering other standards on top of it, as you'll see in the sections ahead.
UDDI
UDDI is a standard for dynamic lookup, binding, and publishing of SOAP services. It allows you to query different UDDI registries to look up businesses, information by business category, and service information.
So what does combining UDDI with SOAP buy you over SOAP alone? One of the areas where XML messaging has been lacking is in the
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: XML messaging, Part 2 - JavaWorld June
2001
View Tutorial: XML messaging, Part 2 - JavaWorld June
2001
Related
Tutorials:
|
Displaying 1 - 50 of about 2174 Related Tutorials.
|
JDO UNPLUGGED - PART 1
UNPLUGGED - PART I
JDO UNPLUGGED - PART I... databases and XML
databases also. This is the major advantage of JDO over the other... , in the next
part of this tutorial |
JDO UNPLUGGED - PART II
UNPLUGGED - PART II
JDO UNPLUGGED - PART II... interfaces and classes defined in
the JDO specification.
2. jdori.jar.../products/jta/index.html
2. antlr.jar : It is the parsing technology used |
Struts 2 Tutorials for Beginners, Struts 2 Tutorial
, ResourceBundles, XML etc.
Struts 2
Training! Get Trained Now!!!
Struts 2 Features... the
application.
Struts 2 xml configuration file... part
of any web application. With the release of Struts 2, validation are now much |
Java XML Books
, Part 2
In this second part in a several part series on XML for Java.... The java.xml.parsers package is part of the Java API for XML Processing (JAXP...
Java XML Books
Java XML Books
  |
Struts 2 Tutorial
, ResourceBundles, XML etc.
Struts 2
Training! Get Trained Now!!!
Struts 2 Features... the
application.
Struts 2 xml configuration file... part
of any web application. With the release of Struts 2, validation are now much |
Java Interview Questions - Page 2
Interview Questions - Page 2
 ...? DOM vs SAX parser
Answer: parsers are fundamental xml components, a bridge between XML documents
and applications that process that XML |
J2EE Interview Questions -2
Questions -2
 ... descriptor is simply an XML(Extensible Markup Language) file with the extension of .xml. Deployment descriptor describes the component deployment settings |
XML Interviews Question page9
, because it is an architecture, not an application, so it is not part of XML's job...
XML Interviews Question page9,xml Interviews Guide,xml Interviews
XML Interviews Question page9
  |
XML Interviews Question page19
XML Interviews Question page19,xml Interviews Guide,xml Interviews
XML Interviews Question page19
 ... are special attributes used to declare XML namespaces?
I don't know the answer |
XML Parsers
XML Parsers
XML Parsers
 ...;
XML parser is used to read, update, create and manipulate
an XML document.
Parsing XML |
Struts 2 Training
Struts 2 Training, Training for developing applications with Struts 2
Struts 2 Training
 ...;
The Struts 2 Training for developing |
JSTL XML Tags
- JSTL
&
SQL-TAGS
Tutorial
Home |
Part
1 | Part 2... |
Part
1 | Part 2 | Part
3 | Part 4
 ...
JSTL XML Tags
JSTL XML Tags
  |
Open Source XML Editor
Open Source XML Editor
Open Source XML Editor
Open
source Extensible XML Editor
The Xerlin Project is a Java? based XML modeling application written to make creating and editing XML files easier. It runs |
XML: An Introduction
XML
XML: An Introduction
 ... is XML?
"XML is a cross-platform, software and
hardware independent tool for transmitting information"
XML is a W3C Recommendations. It
stands |
XML Books
the XML part of the technical book publishing industry, as well as a monster thread... which part of an XML document the XSLT transforms. Written for professional...
XML Books
XML Books
  |
Eclipse Plunging/XML
Eclipse Plunging/XML
Eclipse Plunging/XML...;
XMLBuddy
XMLBuddy XML editor. Supports content assist.... Validate in background
while you edit or on command. Format all or any part |
Struts 2 Features
Struts 2 Features
Struts 2 Features
 ... of the general features of the current Apache Strut 2 framework are given below... in Strut 2 allow creating dynamic web applications with less number of coding. Not only |
Designing XML Schema
Designing XML Schema
Designing XML Schema...;
XML documents can have a reference to a DTD or to an
XML Schema.
A Simple XML Document
Look |
XML Attributes
XML Attributes
XML Attributes...;
XML... information that is not a part
of the data. In the example below, the file type |
An Overview of the XML-APIs
XML-based data.
JAXM: Java API for XML Messaging
The JAXM API...
An Overview of the XML-APIs
An Overview of the XML...
for XML. But we will concentrate most on
JAXP in our coming
tutorials |
Use of Core XML tags in JSP
:
2. XMLinJSP.jsp
<%@ taglib uri="http://java.sun.com/jstl/xml" prefix...Use of Core XML tags in JSP
Use of Core XML... use of Core XML tag in JSP
JSTL (JSP standard tag library) XML tag can |
XML Transformation in JSP
XML Transformation in JSP
XML Transformation... to demonstrate XML Transformation tag in JSP
This example illustrate use of XML transformation tag in JSP file. This
example performs transformation from an XML file |
Struts 2 Validation Example
Struts 2 Validation,Struts 2 Validation Example
Struts 2 Validation Example
 ... you will be able to write validations for your Struts 2
projects. The concepts |
Struts 2 Architecture - Detail information on Struts 2 Architecture
Struts 2 Architecture,Struts Architecture
Struts 2...;
Struts and webwork has joined together to develop the
Struts 2 Framework. Struts 2 Framework is very extensible and elegant for the development |
XML Interviews Question page21
to determine what XML namespace a prefix in a DTD points to. Which means...
2...
XML Interviews Question page21,xml Interviews Guide,xml Interviews
XML Interviews Question page21
  |
Retrieving Data From the XML file
Retrieving Data From the XML file
Retrieving Data From the XML file
 ... to parse and expose
XML information using the JAXP with a JSP page. This
example |
Definition of Bioinformatics
;
About Bioinformatics
In February 2001, the human genome was finally... for Biotechnology Information (NCBI
2001) defines bioinformatics as:
"... the Bioinformatics will become an
integral part of the biology.
  |
Show output as a xml file using Velocity
Show output as a xml file using Velocity
Show output as a xml file using Velocity
 ... output as a xml file in velocity. The method
used in this example  |
Retrieving XML Data Using GWT
Retrieving XML Data Using GWT
Retrieving XML... XML file
Data from the server using GWT. The basic building
block for running...;EntryPoint {
private static final String XML_LABEL |
Wi-Fi as a part of LBS
Wi-Fi as a part of LBS
Wi-Fi as a part of LBS
  |
Why Struts 2
minimize the use of xml.
Stateful
Checkboxes - Struts 2 checkboxes do...
New Features of Struts,Features of struts 2,Why Struts 2
Why Struts 2
  |
Why Struts 2
minimize the use of xml.
Stateful
Checkboxes - Struts 2 checkboxes do...
New Features of Struts,Features of struts 2,Why Struts 2
Why Struts 2
  |
XML handling in a template using Velocity
XML handling in a template using Velocity
XML...
to use XML file in a velocity template and
also shows that use of macro... through method init().
2:- Create object of
VelocityContext Class.
3 |
Developing Axis Web services with XML Schemas.
Developing Axis Web services with XML Schemas
Developing Axis Web services with XML Schemas... to quickly develop the working web services with xml schemas. All the necessary Axis jar |
Display image on JSP page using XML
Display image on JSP page using XML
Display image on JSP page using XML
 ... to know how we can
display a image on JSP page by using XML.
This example |
Parsing The XML File Using JDOM Parser in JSP
Parsing The XML File Using JDOM Parser in JSP
Parsing The XML File Using JDOM Parser in JSP
 ...;
In this example we show how to work with JDOM parser to parse the xml
document. JDOM can read |
SME Server 7.0 Pre 2 has been released now
SME Server 7.0 Pre 2 has been released now
SME Server 7.0 Pre 2 has
been released now
SME Server 7.0 pre-release 2... a solid, easy-to-use server for their small-business customers. In July 2001, e-smith |
Programming: Initials 2
Java: Programming: Initials 2
Java: Programming: Initials 2
Name...
extra can cancel out points you may lose in the main part of the problem |
Text Clock 2
Java: Example - Text Clock 2
Java: Example - Text Clock 2
This is the same as Example - Text Clock...
for an explanation of a simple timer class.
Main program / Applet
1
2
3
4 |
Stored Data in XML File using Servlet
Stored Data in XML File using Servlet
Stored Data in XML File using Servlet
 ... will learn how to stored data in xml file
using Servlet We have created file |
Getting Dom Tree Elements and their Corresponding XML Fragments
Java XML DOM Example,XML Fragments,Getting Dom Tree Elements and their Corresponding XML Fragments
Getting Dom Tree Elements and their Corresponding XML Fragments
  |
XML Interviews Question page3
XML Interviews Question page1,xml Interviews Guide,xml Interviews
XML Interviews Question page3
 ... it provides only one way of describing your information.
XML allows groups |
Struts 2 Session Scope
Struts 2 Session,Struts 2 Sessionaware,Struts 2 Session Scope
Struts 2 Session Scope
 ... to be in
the classpath.
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
< |
Technology What is and FAQs
it
is the part of the MPEG-4 standard.
ASCIIASCII, the
abbreviation... Language is also an XML-based
language like EAI the other business software...; protect the privacy of email, data files,
drives and instant messaging |
XML Validation
XML Validation
XML Validation...;
XML with correct syntax is Well Formed XML.
XML validated against a DTD |
Open Source Forum/Bulletin Board Software written in Java
|
Overview of the POI APIs
for manipulation of various file formats
based upon Microsoft's OLE 2 Compound... a complete API for porting other OLE 2 Compound Document formats.
OLE 2 Compound...; POIFS if we had a document written in OLE 2 Compound Document
Format, probably |
Java: String Exercise 2
Java: String Exercise 2
Java: String Exercise 2
Name ______________________
Assume the following....
1__________h.length()
2__________h.substring(1)
3__________h.toUpperCase()
4 |
Create XML file from flat file and data insert into database
Create XML file from flat file and data insert into database
Create XML file from flat file and data insert into database...;
In this section, we have developed an application to
create xml |
Open Source Code
is SOAP
SOAP is a protocol for exchanging XML-based messages over a computer... stack, providing a basic messaging framework that more abstract layers can build....
There are several different types of messaging patterns in SOAP, but by far |
|
|
|