2.4. Yet Another Hello to the World

The simple application in this section, which shows Flex and Java integration using BlazeDS, says "Hello." The example is first sketched out so that it will be easy to comprehend the functional flow and the rudimentary, yet working, use case. This sketch is shown in Figure 2-10.

Figure 2.10. Figure 2-10

Two types of remote calls are supported in this example application. These are:

  • A call to the sayHelloInString method on a Java object, which takes in a string parameter and returns a string value

  • A call to the sayHelloInObject method on the same Java object, which takes in an object parameter and returns an object

In the case where objects are passed back and forth between Flex and Java, parameters are sent from Flex as AS3 objects, and return values are sent from the remote Java service as Java objects. BlazeDS does the important translation and marshaling between these two languages.

To create this example application, start up your Flex Builder IDE and create a new Flex project. Choose to create a project with a J2EE server and specify the parameters as shown in Figure 2-11.

Figure 2.11. Figure 2-11

By choosing the option to create a joint Java/Flex project, you ease the process of development and deployment, as the entire bundle of source ...

Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.