| By Kevin Schmidt, Gopalan Suresh Raj, Prabhu Balashanmugam | Article Rating: |
|
| April 9, 2007 09:30 AM EDT | Reads: |
28,129 |
The Applicant Evaluator service will be implemented as a stateless session bean annotated to be exposed as a Web service. This service will invoke an external Web service to get a credit report and also invoke another stateless session bean - Performance Evaluator - to get an internal credit report, if one is available.
The Vehicle Information Server and Financial Index Server Stateless Session Bean functions will be exposed as Web services. The Loan Approval Processor service will be implemented as a stateless session bean and annotated to be exposed as a Web service.
The Vehicle Loan Application Process will be implemented as a business process that invokes the Applicant Evaluator, Vehicle Information Server, Financial Index Server, and Loan Approval Processor services in that order (see Figure 3).
Implementation
Java EE technology and the tools
provided in NetBeans allow users to adopt bottom-up or top-down
approaches or a combination of both to deliver composite applications.
In this example we will follow a bottom-up development approach. We'll
start by building Java services, followed by invoking the services in a
business process. We'll then compose the services in a composite
application, deploy the application on Sun Application Server 9.1, and
test the composite application.
NetBeans Enterprise Pack 5.5 provides the necessary capability to perform all the above tasks from within the IDE without the need to use any other tool or editor.
The Java Services
Java EE 5 enables functionality
in an existing Java EE application to be easily service-enabled by
annotating the Java classes. The creation of new Java EE applications
that are Web-service enabled can also be done easily using the EJB
Module Creation Wizard in NetBeans. In the first phase, the EJB Modules
Vehicle Information Server and Financial Index Server are
service-enabled by adding the appropriate annotations to the classes.
In the second phase, two new services are created. The Applicant Evaluator service is a stateless session bean also exposed as a Web service. This service aggregates results from an external Web service, FICOSimulator, and the Performance Evaluator stateless session bean. The FICOSimulator Web service simulates an external Web service that returns a credit report (see Figure 4).
The Loan Approval Processor is another service developed as a stateless session bean, also exposed as a Web service. This service combines reports on the applicant's credit worthiness, the vehicle's value, the loan indicators, and returns a decision based on predefined business rules.
Composing the Services
The Business Process Editor
in NetBeans Enterprise Pack 5.5 can be used to compose services. The
Business Process Editor enables users to model business processes
graphically in a visual environment and the WS-BPEL code is
automatically generated, corresponding to the visual model. However,
the user can choose to make changes directly in the generated WS-BPEL
code and the visual model is automatically synchronized to the
graphical view. The services invoked by business processes are defined
as WSDLs (see Figure 5).
Users can create new WSDLs using the WSDL and XSD Editors directly in
NetBeans. However, users can also import existing WSDLs and XSDs and
edit them using the editors.
A BPEL Project, CreditApplicationProcessorBusinessProcessor, is created and the WSDLs and XSDs for the following services are included: 1) Applicant Evaluator, 2) Vehicle Information Server, 3) Financial Index Server, and 4) Loan Approval Processor Service. Once the WSDLs are imported, Partner Link Types are created for the Port Type that will be invoked from the business process. Please note that the credit application process is going to be exposed as a Web service, so, another WSDL is created, CreditProcessor.wsdl, that represents the interface to the business process.
Partner Link Types specify the role that will be played by the service defined in the Port Type. For example, the Partner Link Type CustomerDataServicesPartners below specifies that the service will play the role of a CustomerReportProvider when the function getCustomerReport is invoked.
<partnerLinkType name="CustomerDataServicesPartner">
<role name="CustomerReportProvider"
portType="getCustomerReport"/>
</role>
</partnerLinkType>
Once Partner Links Types are created in the WSDLs for the PortTypes, they can now be invoked from a business process. The user can simply drag and drop the WSDL on the Business Process Editor canvas and the Business Process Editor automatically recognizes the available Partner Link Types and shows a wizard for configuring the Partner Links for the business process. The wizard allows the user to determine if the business process will be a consuming partner or a providing partner of the service defined in the Partner Link Type.
The WS-BPEL 2.0 specification provides various types of activities for modeling complex and real-world business processes. The business process can receive and reply to messages or it can just receive messages without responding. Business processes can also receive messages asynchronously from external sources. The key constructs supported in the WS-BPEL specification include the ability to invoke external services, handle exceptions, process compensation, and error condition logic. It also allows for modeling the concurrent and conditional execution of activities. The sample used in this article uses only a few of the constructs, namely, Receive, Reply, Invoke, and Assign activities. The Invoke activity is used to consume the services and the Assign activity is used to set and get values to the input and from the output messages of the invoked service. The Assign activity opens up a mapper that allows users to view all the variables in the business process and graphically get and set values between them. The mapper also provides data processing and transformation functions that can be used in conjunction with the assignments. The Receive activity is used to receive an incoming message that creates an instance of the business process at runtime. The reply activity is used to send a response message back to the caller and the business process instance is then discarded.
The user starts by creating a template business process by laying out the activities and then configuring them one at a time. The user drags and drops the CreditProcess WSDL and configures the business process as the providing partner of the service. The user configures the Receive and Reply activities to implement the PortType specified in the CreditProcess WSDL. The user then drags and drops all the other WSDLs and configures the business process as a consuming partner of those services. The user uses one invoke activity per service consumed and configures the invoke activity to link it with the appropriate Partner Link. Once configured, the business process looks similar to Figure 6.
Create and Deploy Composite Applications
NetBeans
provides the capability to group more than one business process
available under different projects into one composite application. This
allows you to group multiple logical business processes and manage them
as one logical unit during deployment. NetBeans also provides the
necessary runtime components for deploying composite applications. The
runtime components include Java Application Server 9.1, WS-BPEL Service
Engine, and HTTP/SOAP Binding Components. The composite applications
can be easily created by selecting and adding components from different
projects in the environment. NetBeans also allows users to build and
deploy composite applications with a single click.
In the sample used in this article, the user adds the business process module from the project CreditApplicationProcessorBusinessProcess to the Composite Application project. The composite application is then deployed at runtime.
Published April 9, 2007 Reads 28,129
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Kevin Schmidt
Kevin Schmidt is the director of product management for SOA and business integration software at Sun Microsystems, Inc. He has 17 years of experience in the software industry in roles that include product management, professional services, pre-sales, and development. Most recently he has focused on composite applications using Java, Web services, SOA, BPM, and related technologies.
More Stories By Gopalan Suresh Raj
Gopalan Suresh Raj, a senior analyst at Compuware Corporation, is a contributing author to Enterprise Java Computing - Applications and Architecture and The Awesome Power of JavaBeans. His expertise spans enterprise component architectures and distributed object computing. He can be reached at www.execpc.com/~gopalan
More Stories By Prabhu Balashanmugam
Prabhu Balashanmugam is a Product Manager for SOA and Business Integration software at Sun Microsystems. He is currently responsible for managing Business Process Management, Event Processor, and Data Integrator products. He has more than 10 years of experience in the software industry in roles that include product management, development, pre-sales, and technology consulting.
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?








































