Chapter 5 Client Design
201
other technologies (such as RMI/IIOP), JAX RPC gives clients greater flexibility
and supports more types of clients.
J2EE application clients may also use RMI/IIOP to make remote calls over
the network on application business logic. RMI/IIOP is often used for clients
operating in intranet environments, where there is a greater degree of control over
the client's deployment and the J2EE server. While these controlled environments
provide a client container that handles the communication security, passing
through firewalls can be problematic. RMI/IIOP provides clients with secure
access to the application business logic while at the same time taking care of the
details of the client and server communication and marshalling and demarshalling
parameters.
Java Message Service (JMS) is another means for J2EE clients to communi
cate with server applications. JMS provides a means for asynchronous communi
cation. Applications using JMS are better suited to a setting that is behind a
firewall, since messaging systems generally do not work well on the Internet.
(Often, messaging systems are not even exposed on the Internet.) Not only must
developers have some knowledge of how to work with messaging systems, such
as how to set up and use topics or queues, but the messaging system mechanisms
must already be in place.
Although Web services provide a standard way to exchange XML documents
over HTTP, you can use nonstandard approaches as well. Communication using
the HTTP protocol requires only a simple infrastructure to send and receive mes
sages. However, the client application must be able to parse the XML documents
representing the messages. Parsing involves mapping the XML data to the client
application's object model. When using this means of communication, the devel
oper at a minimum needs to write code to send and receive the documents over
HTTP as well as to parse the document data. If such communication must also be
secure, developers would have to include code that uses Secure Socket Layer
(SSL), making the development task more difficult. However, this means of com
munication may be sufficient, particularly in a closed environment or when clients
are applets. Care should be taken if using this approach, since it is not standard.
5.2
Scenarios for Web Services Based Client Applications
Developers typically write clients to access preexisting Web services that is,
public or private Web services. At times, the same developers may simultaneously
develop both the service and its clients. Regardless of this, client developers should
New Page 1