J2EE Design Pattern : Integration Tier Patterns : Web Service Broker Design Pattern
|Web Service Broker Design Pattern
Web Service Broker access services using XML and web protocols
J2EE applications expose coarse-grained business services using Service Facade. However, these services might be too fine grained to expose as a web service or may not be designed to be exposed outside of their application.
You want to provide access to one or more services using XML and web Protocols.
Use a Web Service Broker to expose and broker one or more services using XML and Web protocols.
A Web Service Broker is a coarse-grained service exposed as a Web service. It coordinates interactions among one or more services, aggregates responses and may demarcate and compensate transactions.
Participants and Collaborations
The Client can be anything that is capable of making a Web service request.
The EndpointProcessor is a servlet. It is the initial point of entry into the Web service, and is responsible for accepting and processing a request. The request is typically based on an HTTP request, such as a SOAP request. Typically, the EndpointProcess is built-in to the runtime system, such as when using JAX-RPC. You can also build a custom EndpointProcessor.
The WebServiceBroker is a Web service that serves as a broker to one or more services. Those services can be J2EE services, such as Session Façade and Application Services, or legacy EIS systems. The WebServiceBroker can be realized in three ways.
A POJOBroker is a WebServiceBroker implemented as a POJO.
The SessionBeanJAXBroker is a JAX-RPC based, EJB 2.1 Session Bean declared as a Web service endpoint. It is implemented as a stateless session bean, and described using WSDL. A SessionBeanJAXBroker component needs to run inside an EJB 2.1 compliant EJB container.
The POJOJAXBroker, like the SessionBeanJAXBroker, it is based on JAX-RPC, but is not a session bean. It is a POJO and doesn’t need to run in an EJB container – it can run in a Web container. The POJOJAXBroker is written much like an RMI component and must use the JAX-RPC runtime to operate.
The BusinessService can be a J2EE Session Façade, an Application Service, or a POJO Façade to EIS.
- Custom XML Messaging Strategy
- Java Binder Strategy
- JAX-RPC Strategy
|Example for Web Service Broker