Summary
Sun published a detailed white paper and tutorial on implementing a service-oriented system with Java EE 5. The paper's practical example shows how to use new Java EE 5 features, such as annotations for persistence and to expose an EJB as a Web service, and how to integrate BPEL and the Java Business Integration API (JBI) with an EE 5 environment.
Advertisement
While Java EE 5 simplifies enterprise application development, it does so chiefly by introducing new programming models and several new APIs. Sun recently produced a new tutorial on how the various EE 5 API elements and tools fit together in the context of an example application. The tutorial, Implementing Service-Oriented Architectures (SOA) with the Java EE 5 SDK, is available as a PDF download.
While the whopping 65 pages of this paper indicate the size of the new Java EE APIs, the paper does a very good job of introducing each API from the ground up, including persistence-related annotations for EJBs, and the use of Web service annotations that help expose an EJB as a Web service.
After covering the relevant core EE APIs, the paper provides a thorough, but still manageable, introduction to Java Business Integration (JBI), or JSR 208. (See the Artima Leading-Edge Java interview with JBI Spec Lead Ron Ten-Hove, Service-Oriented Java Business Integration.)
JBI provides a meta-container for the integration of multiple Web services via messages that pass from one service to another. Services register with the JBI meta-container, and the container then orchestrates what messages should be delivered to what component services. JBI also facilitates Web service composition: a Web service that relies on messages from two or more other services registered with the container, can itself be exposed as a composite Web service.
Having explained these key concepts, the paper then describes an example application that allows customers to submit loan applications:
When the loan request is received, the personal information supplied by the user is verified across an existing database, and approval is granted or rejected based on the information and the amount requested... After certain formalities are fulfilled, a report, in the form of an approval letter, is generated and sent to the user, confirming the approval of the loan. If the loan is
rejected for some reason, then a report showing the reason for the rejection is generated and displayed.
The paper includes detailed code examples in support of this business use case.
The paper's concluding segment focuses on the Web Services Business Process Execution Language (WS-BPEL), and how it allows users to specify workflow between composite Web services. BPEL is a rather complex and intimidating specification, but the paper provides a short and to-the-point practical introduction, with examples relevant to the loan application business use case.
Web services have been the subject of hype for many years, but now Java EE 5 makes the creation of Java-based Web services really easy. As well, developer tools have become more capable of hiding Web service complexity from developers. And Web services do seem to offer useful functionality, as the example application in this paper demonstrates.
What do you think of the current state of Java Web service development?