How can we support both synchronous and asynchronous Web services with J2EE?
Synchronous Web services can be defined as services that are invoked over existing Web protocols by a client that blocks/waits for a response. Synchronous Web services that are generally better served by RPC-oriented messaging.
Asynchronous Web services can be defined as services that are invoked over existing Web protocols by a client that does not wait for a response, but does expect a response at a later time. Document-oriented messaging is often used for asynchronous Web services along with some form of workflow infrastructure.
Servlets, HTTP and XML/SOAP are usually the implementation technologies used to implement synchronous or asynchronous endpoints. The servlet will receive requests from clients and dispatch the requests to components or services containing business logic. The business logic components then process the request and return an appropriate response. In an asynchronous invocation, the business logic component will use asynchronous messaging technologies such as Java Message Service (JMS) and/or message-driven beans to handle the response.
The Java API for XML-based Remote Procedure Calls (JAX-RPC) and the Java API for XML Messaging (JAXM) are provided by Sun as implementation technologies for handling SOAP-based message creation and parsing. Other frameworks such as Apache SOAP, Apache AXIS, and proprietary solutions can be used as enhancements or replacements for JAX-RPC and JAXM.