Soap Programming with Java (Transcend Technique Programming Series)

Soap Programming with Java (Transcend Technique Programming Series)

by Bill Brogden
     
 
Since its emergence in 1998, the Simple Object Access Protocol (SOAP) has come to occupy a central place in today's breed of modular applications known as Web Services. Thanks to SOAP, all you need is a basic knowledge of XML to write programs that interact seamlessly with a growing number of online services providing currency conversion, user authentication, and more

Overview

Since its emergence in 1998, the Simple Object Access Protocol (SOAP) has come to occupy a central place in today's breed of modular applications known as Web Services. Thanks to SOAP, all you need is a basic knowledge of XML to write programs that interact seamlessly with a growing number of online services providing currency conversion, user authentication, and more.

But for every service that has been implemented, there are many more that remain mere ideas. SOAP Programming with Java provides the foundation and skills for realizing those ideas as fully functional solutions. Building on your knowledge of XML and XML tools, you'll create your own SOAP-based services that use not only HTTP but also the services media of the future: Java Message Service (JMS), JavaSpaces, and JavaMail. You'll also graduate from wired to wireless development, learning how Web-enabled devices fit into the world of SOAP-based distributed computing.

All this detailed, practical coverage is presented within the framework of Java programming, allowing you to capitalize on the advantages Java offers. Whether you use this book as an introduction to Web Services development or as a tool for mastering particular techniques, it will equip you with a sound understanding and hard-to-find skills.

Product Details

ISBN-13:
9780782129281
Publisher:
Sybex, Incorporated
Publication date:
01/28/2002
Series:
Transcend Technique Programming Series
Edition description:
BK&CD-ROM
Pages:
416
Product dimensions:
7.54(w) x 9.03(h) x 0.97(d)

Read an Excerpt

Chapter 8: SOAP Architecture Using Messages

  • Point-to-Point vs. Publish-Subscribe messaging
  • The principles of Java Message Service
  • Working SOAP examples with Java Message Service
  • The JavaSpaces architecture
  • The advantages of JavaSpaces over Java Message Service
  • Getting JavaSpaces running on your system
  • Working SOAP examples with JavaSpaces
It is important to stress that SOAP is quite flexible with transport mechanisms, which is what makes it such an attractive technology. Having covered the HTTP-based architecture in the previous chapters, this chapter reviews two message transport mechanisms, Java Messaging and JavaSpaces, with extensive example code for each.

Messaging Systems in General

Messaging systems came into being with the first networks, and a variety of messages are exchanged over computer networks. Naturally, one thinks first of the ubiquitous e-mail; however, many other types of valuable data are moved over networks, making messaging systems very important in enterprise-level computing, even without e-mail.

There has been a recent trend to recognize messaging systems as a separate class of application, frequently called Message-Oriented Middleware (MOM). A MOM system takes responsibility for transmitting application messages over a network and provides support for load balancing, fault tolerance, and transactions. Basically, there are two models for messaging:point-to-point and publish/subscribe.

The Point-to-Point Model

In this model, a message is transmitted from a sender to a single recipient. As shown in Figure 8. 1, once the sender, client A, dispatches a message to a local router, the message can travel directly to the recipient, client B, or be relayed through additional routers to client C. Once the sender has succeeded in getting the message to the router, the sender's work is done.

The router holds the message in a message queue, which may or may not be backed up to permanent storage. Each queue has a unique name. A given queue can be associated with one recipient or multiple recipients, but the router ensures that each message goes only to a single recipient. You might use multiple recipients for load-balancing jobs between multiple worker processes.

The Publish/Subscribe Model

In a point-to-point system, a message is sent to a named queue where it is held until it's retrieved by a specific receiver. In the publish/subscribe model, a message is sent by a mes- sage producer, or publisher, to a topic, and copies are sent to all of the topic's subscribers.

This architecture is depicted in Figure 8.2 with a single router, but the message distribution system could involve many router applications.

Advantages
Because of the services a MOM system provides, messaging offers some advantages over the client-server or remote procedure call (RPC)architectures:

Asynchronous With MOM, the sender and receiver of a message do not have to be working, be connected, and have available CPU cycles at the same time.

Fault tolerance MOM software can route around network problems, adjust to network loads, and resend messages in the event of errors.

Ignore network architecture Applications using MOM can totally ignore all of the complexities of the network architecture past the initial entry point.

Security MOM systems can enforce security precautions independently from the applications.

Disadvantages
An obvious disadvantage for MOM systems is speed. Message transmission through an interme- diary server can never be as fast as direct client-server or RPC connectivity. Another possible disadvantage is the added complexity of maintaining yet another application in the form of the message server, with the attendant storage, network traffic, and processing power requirements.

Reliability Requirements

As the number of separate components in enterprise networks grows, messaging becomes more and more attractive, despite the disadvantages. The rush to wireless connectivity and the trend toward the distribution of computing power into smaller and simpler devices emphasizes the problem of maintaining reliability. Although device reliability keeps increas- ing, the number of connected devices increases even faster. Therefore, it is a good probabil- ity that some part of your network will not be working at some point along the way.

SOAP Standards and Messaging

Although SOAP is basically a protocol for sending an XML-encoded message via any transport mechanism, work on standards and example implementations has not been evenly distributed over the universe of possible SOAP uses. In fact, so far the standardization effort has emphasized HTTP transport and the RPC model of request and response. The Apache SOAP implementa- tion reflects this emphasis;it provides minimal support for various messaging architectures.

Fortunately, the suitability of Java for creating messaging services has been apparent from the very start. There are two approaches to messaging with Java APIs:Java Message Service (JMS)API and JavaSpaces. The JMS API has been mature since 1998 and has numerous commercial implementations. The more innovative JavaSpaces API has been developed in connection with Sun's Jini initiative and does not have as many commercial implementations.

Java Message Service

Creation of the JMS API was accomplished by Sun in close cooperation with industry vendors of MOM software. Although the initial intent was simply to create an API for messaging, the increasing industry interest in messaging as an alternative to Remote Method Invocation (RMI) resulted in a much more complete API than originally planned. The current reference version of JMS can be downloaded from the following site:

http://java.sun.products/jms/

Message Characteristics

The most important element in the JMS API is the javax. jms. Message interface, which defines all of the basic characteristics of Message objects. This interface defines a huge number of methods, but for the purposes of this chapter, the most important variables that a message has in addition to payload are delivery mode, time-to-live, and priority....

Meet the Author

Bill Brogden has been working with Java since version 1.0 was released. His first big Java project was an applet that presented animated near-real-time Major League Baseball games. Bill is employed by LANWrights, Inc., where he uses Java technology to develop online courseware. He has written several books about Java, including Java Developer's Guide to Servlets and JSP and Java Developer's Guide to E-Commerce with XML and JSP, both from Sybex. In his spare time, Bill reads science fiction and trains basset hounds. He lives in the woods near Austin, Texas, with his wife, Rebecca, and numerous hounds.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >