BlazeDS
Overview:
The evolution to more engaging RIAs has created the need for better data connectivity options. Remoting simplifies the reuse of existing server logic automatically marshalling calls between the Flash client and the Java methods on the server. In addition, the use of a AMF binary data transfer format increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.
Reasons to Adopt BlazeDS: The following are the top reasons to adopt BlazeDS:
1. Easily connect Flex and Adobe AIRĂ¢„¢ applications built using Flex and Ajax to existing Java server logic.
2. High performance data transfer for more responsive applications.
3. Real-time server push over standard HTTP.
4. Full pub/sub messaging that extends existing messaging infrastructure.
5. Free and Open source
BlazeDS
Open source Java remoting and web messaging for Flex & AIR applications
- Simplifies integration with existing Java code
- Increases performance
- Enables pub/sub and push over standard HTTP
- For a complete description of the BlazeDS features, please refer to the BlazeDS Feature List
LiveCycle Data Services, Community Edition
LiveCycle Data Services Community Edition subscription offering provides access to certified builds of BlazeDS and enterprise and developer support.
- Regular Adobe certified builds of BlazeDS and the latest updates and patches.
- Access to developer and enterprise support resources
LiveCycle Data Services ES
LiveCycle Data Services ES is a complete data infrastructure for enterprise Flex and AIR applications
- Reduced dev & maint. costs for complex DB applications.
- High performance data streaming, paging, and data synchronization requirements.
- Integration with portals.
- LiveCycle connectivity.
- Advanced deployment options for maximum scalability.
- Access to developer and enterprise support resources.
Building Web and Desktop Applications with BlazeDS and AMF
Many applications running in Adobe AIR or Flash Player use XML-over-HTTP technologies, such as SOAP or REST, to move data between the client and server. This method is simple and fairly easy to set up. Every server technology can easily speak XML since it is a text-based protocol. XML is perfect when protocol transparency is necessary. For instance, Flickr's web services use RESTful-style XML over HTTP. This allows any developer using any technology to easily interact with Flickr by sending simple text-based requests to Flickr. Flickr then responds with simple XML, which makes it easy for developers to easily parse and use the data. One downside to text-based protocols like XML is that the additional layer of data abstraction is usually cumbersome to write and maintain. In addition, this data abstraction layer consumes resources on the server-side and client-side when the data is serialized and deserialized (see Figure 1).
For some time, Flash Player has supported a transport protocol that alleviates the unnecessary bottlenecks associated with text-based protocols and provides developers a simpler method of communicating with servers. Called Action Message Format (AMF), this binary protocol for exchanging data can be used over HTTP in place of text-based protocols that transmit XML. Applications using AMF can eliminate an unnecessary data abstraction layer and communicate more efficiently with servers. To see a demonstration of the performance advantages of AMF, check out the Census RIA Benchmark application.
Over the past few years numerous open source projects emerged to provide AMF implementations similar to an old Macromedia product called Flash Remoting. These projects allowed developers using PHP, Java, and other technologies to use AMF in their applications. When Flex 1.0 was released it also included AMF capabilities. When Flex 2 was released it included XML and AMF capabilities, but the server-side AMF capabilities were moved into a new product called Flex Data Services. Flex Data Services became LiveCycle Data Services ES when it joined the Live Cycle product suite. While LiveCycle Data Services ES Express has been free for a single CPU server, the pricing for servers with more than a single CPU discouraged some developers from using AMF or caused them to choose other non-standard AMF implementations.
In December 2007, Adobe made two significant announcements which allow everyone to begin taking advantage of AMF. The first announcement is that the specification for AMF is now publicly available. Publishing the specification allows other projects to implement AMF based on the specification rather than reverse engineering the protocol. No matter what back-end technology developers use - Java, ColdFusion, PHP, .Net, Ruby, etc. - the implementation of AMF can be spec-compliant. The second significant announcement was that a portion of the LiveCycle Data Services ES technology was being open sourced as a project called BlazeDS.
BlazeDS includes a Java implementation of AMF which is used for remotely communicating with server-side Java objects as well as for passing messages between clients. BlazeDS remoting technology allows developers to easily call methods on Plain old Java objects (POJOs), Spring services, or EJBs. Developers can use the messaging system to easily send messages from the client to the server or from the server to client. BlazeDS can also be linked to other messaging systems such as JMS or ActiveMQ. Because the remoting and messaging technologies use AMF over HTTP they gain the performance benefits of AMF as well as the simplicity of not having to deal with an additional data abstraction layer. BlazeDS works with a wide range of Java-based application servers, including Tomcat, WebSphere, WebLogic, JBoss, and ColdFusion. In addition, BlazeDS can easily be used in Flex applications for the web (running in Flash Player) and the desktop (running in Adobe AIR).
Developers can begin using BlazeDS today by downloading the prerelease version from Adobe Labs. To get started, simply deploy the blazeds-samples.war file in any servlet container. This web application contains a number of preconfigured sample applications that can be accessed at http://localhost:8080/blazeds-samples/ (The port may vary depending on your application server and server configuration).
To begin using the BlazeDS Remoting Service in your applications, follow these simple steps:
1. Create a new POJO Java class which exposes the methods you want to access from a Flex application.
2. Configure a BlazeDS remoting destination in the remoting-config.xml file.
3. Create a Flex application which uses the RemoteObject class.
To use the BlazeDS Messaging Service, follow these simple steps:
1. Create a messaging destination in the messaging-config.xml file.
2. Create a Flex application that uses the Producer and Consumer classes to send and receive messages.
3. Begin listening for messages by subscribing to the Consumer's message feed.
That is all you need to do to efficiently make remote requests to your back-end Java objects and utilize the messaging system with BlazeDS! Let's walk through those steps in more detail using
Eclipse 3.3 Classic
- Flex Builder 3 Beta 3 (
Eclipse Plug-Ins)
- Any Java Application Server (Tomcat, JBoss, WebLogic, WebSphere, etc.)
- BlazeDS
To create a simple Remoting Application:
1. Unjar the blazeds.war file from BlazeDS into your application server's deployment folder. For instance, on JBoss use
2. Start Eclipse / Flex Builder
3. Create a new Java Project that you can use to configure BlazeDS and add Java classes to your web application.
a. Use a project name like "blazeds_server"
b. Create the project from existing source; use the path of the WEB-INF directory of your deployed BlazeDS WAR, such as:
c. Add the src directory to the build path
d. Use the WEB-INF/classes directory as the output folder
public class HelloWorld {
public String sayHello(String name) {
return "hello, " + name;
}
<destination id="HelloWorld">
<properties>
<source>HelloWorldsource>
properties>
destination>
6. Start your application server and verify your web application is configured by going to the following URL (The port may vary depending on your application server configuration): http://localhost:8080/blazeds/ (If your server is not configured to display directory contents, you might see a 404 error. This is OK.)
7. Create a new Flex Project
a. For the project name, type "testHelloWorld" Select "J2EE" as the Application Server Type
b. Select "Use remote object access service" and LiveCycle Data Services
c. Specify the Root folder to be to location of your deployed WAR file
d. Specify the Root URL to be: http://localhost:8080/blazeds (Your port name may be different depending on your application server configuration)
e. Specify the Context Root to be: /blazeds
f. Verify the configuration and click Finish
xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:RemoteObject id="ro" destination="HelloWorld"/>
<mx:TextInput id="n" change="ro.sayHello(n.text)"/>
<mx:Label text="{ro.sayHello.lastResult}"/>
mx:Application>
By,
Sharif Ul Islam
Senior Software Engineer
Mannaco Microsystems, Inc
www.manna-co.com
No comments:
Post a Comment