From the Trenches of the Enterprise Software

Yakov Fain

Subscribe to Yakov Fain: eMailAlertsEmail Alerts
Get Yakov Fain: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Enterprise Architecture, Java EE Journal, Java Developer Magazine, Telecom Innovation, Entrepreneurs and Innovators

Blog Feed Post

RIA Integration: Bits and Pieces, Part One

First in a series of writeups on integrating Flex and Java EE

There are many ways to have various software components to communicate in Java EE enterprise architecture.  The same is applicable for integrating rich Internet Applications written in Adobe Flex and Java EE systems. Let’s consider the following scenario:

An application A is being developed using Flex-BlazeDS-Java, and it needs to integrate with a third-party Java-based Web application B, where the users must register, otherwise they can’t continue using the application A.

Of course, to implement this scenario you can engage some of the business process management software packages that will allow you to describe and configure the workflow with minimum or no coding. But the less moving parts are used in the architecture the better. Here’s the pretty simple way to implement our scenario.

Step 1. When the user presses the button on Flex view, the code is being executed inside the virtual machine – Flash Player, which in turn is sitting inside HTML wrapper.    So the first goal is to make a call from inside the Flash Player to the outside world. Using the ActionScript class ExternalInterface you can map the internal function, say registerUserAS() to the wrapper’s JavaScript function registerUserJS(). You have to write both of these functions yourself.

Step 2. The JavaScript function registerUserJS() opens the URL of the application B in a separate Web browser window, where the user registers as required by the application B.

Step 3. In the application A, develop and deploy Java servlet, say RegistrationCompleteServlet that can be called by the application B when the user successfully completed the registration. During this call, the application B will pass to the servlet a Data Transfer Object  RegistrationInfoDTO, with all required registration details.

Step 4. The RegistrationCompleteServlet and BlazeDS are collocated in the same Java Servlet container(e..g. GlassFish, Tomcat, et al). The RegistrationCompleteServlet initiates a push of the RegistrationInfoDTO to the BlazeDS destination RegistrationDest with the routing to the proper client. How to push the data to the client over the AMF protocol is described in our book Enterprise Development with Flex.

Step 5. Almost forgot to mention that during the startup, our Flex application has created a Consumer subscribed to the messages from the destination RegistrationDest. As soon as the RegistrationInfoDTO is published to this destination, Flex client will receive it and let the user into the next view with a nice greeting, “Thank you, Yakov for registering. Your credit card information has been validated”.

That’s’ all there is to it. I’ve included “Part 1” in the title of this blog, because hoping that this will become a series of writeups on integrating Flex and Java EE.

More Stories By Yakov Fain

Yakov Fain is a Java Champion and a co-founder of the IT consultancy Farata Systems and the product company SuranceBay. He wrote a thousand blogs (http://yakovfain.com) and several books about software development. Yakov authored and co-authored such books as "Angular 2 Development with TypeScript", "Java 24-Hour Trainer", and "Enterprise Web Development". His Twitter tag is @yfain

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.