
J2EE™ and Web Services
• For the last few years, Sun and the massive assembly of companies behind Java have been pushing
J2EE as the solution to enterprise applications.
• So is web services technology replacing J2EE? Should Java enterprise be abandoned?
- Web services will not replace J2EE. Web services will be achieved by using J2EE.
- Web Services become one more part of a larger system, or one more view into the backend system.
- Web Services provide interoperability between J2EE systems and other technologies.
• The applications that are driving Web Services generally (not always) fall into several categories.
- System to system integration, either between two systems in one company or in different companies.
- Interoperability between MS and other non-windows based platforms.
- Systems designed to be services invoked in heterogeneous environments.
• Think of a Web service as a method that can be called by passing XML to a Web server.
- The Web server must take the XML and react to it.
- This work will be done by adding XML code to existing J2EE solutions.
- Servlets and JSP already work with HTTP, now they will need to work with XML in HTTP.
- SOAP will be used to create Web services. Java will be used on the server to interpret the SOAP.
• Recall SOAP is a protocol that defines how the message will be sent. Java and J2EE can be used to
create the server side power to react to these messages.
- Recall the purpose of this architecture is to loosely couple systems, not create a new way to build these
systems.
- Java and J2EE are commonly used in these systems.
- J2EE works with SOAP, as do other technologies.
- Technologies provide SOAP implementations to allow successful Web services.
• The whole idea of using XML for communication allows us to more loosely couple systems.
• Traditional systems (like EJB) are tied together more tightly, becoming very difficult to integrate with
other systems.
- Imagine attempting to change your B2C web site to be used by another business to sell the same
product.
- Imagine creating your components so that anyone can use them – other divisions of your company or
any business you partner with.
- Realize you can’t control what systems (OS, coding language, server hardware, database) are used by
your partners.
• In order to create these systems you must create a more loosely coupled system, and XML becomes
the key.
• Unlike the tightly coupled binary protocols (EJB/DCOM) web services is a way to loosely couple
systems.
• With binary protocols, both client and server must agree on a technology to use.
- Calls from one system to another are done by transporting “Proxy” services to a client.
- These client side proxies use a technology on the client that matches the server.
• An example would be Enterprise Java Beans (EJB) which uses Java RMI/IIOP for communication.
- In EJB the client can discover the EJB service at runtime, but the client needs previous knowledge of
the service.
- The client needs the interface to the server before the client is written.
- The client’s interface must match the server’s or problems arise.
- The client must be able to run Java code, or some technology that converts calls to IIOP.
• Unlike more tightly coupled technologies, web services allow the client to use any technology.
- The client can discover the service at runtime, or it can be done before compile.
- To create a client to invoke a web service the client need only create an HTTP call populated with
XML.
- XML and HTTP are supported by just about any technology.
- The client can be generated quickly because WSDL standardizes how web services describe their
services.
• EJB solutions will not be going away any time soon. Tightly coupled systems have large advantages.
- Security information is easily managed between the two systems.
- The developers of the system have control when errors occur because both sides of the communication
are within their control.
• Loosely coupled systems have a different set of advantages.
- Less time is spent defining how the two systems will communicate.
- Interoperability between systems of different types is possible.
- Solutions are more flexible because a change to one might not relate to the other.
• Although web services are a competitor to more tightly coupled technologies, they are not a 100%
replacement.
- Some systems benefit greatly from the more loose and flexible web services.
- Some systems are better served with a more tightly coupled reliable infrastructure.
- Most web services created represent a new, more flexible way, to call existing systems. They allow
you to publish to, and communicate with, disparate systems.
JEE and Web Services
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services