I am working on a project for John Deere and they have a huge WebSphere implementation. The odds of transferring them over to AMFPHP are not very realistic! Anyways, I spent the weekend playing with BlazeDS as my endpoint for Flex and I really like it. I took me about six hours to figure out tomcat, java in eclipse, and the whole server side endpoint thing. From there it has only taken me about an hour to figure out class mapping, authentication, push technology, and connecting everything to hybernate. So to anyone looking into using BlazeDS stick with it a bit. The biggest hurdle is probably java and tomcat for those like me that don’t understand why you need to restart the application server sometimes and other times it just works. Overall great job Adobe and thanks for releasing a quality opensource project.
The following is my simple hello world example that I used to get started with learning how this system works.
Here are all the files Zipped. I can not figure out how to do code highlighting. Suggestions~!
Java Class File for remote service. Place compiled class in $tomcat_home/webapps/blazeds/WEB-INF/classes/HelloWorld.class
import java.util.Date;
public class HelloWorld {
private String userSaid;
public String repeat(String said) {
this.userSaid = "Reply from server: " + said;
return this.userSaid;
}
public String sayHello() {
Date now = new Date();
return "Hello World " + now;
}
}
Remoting-config.xml place in $tomcat_home/webapps/blazeds/WEB-INF/flex/remoting-config.xml
That’s it for the server side. Now you just need two files updated to run this from Flex.
And then your services-config.xml file in your flex project. Note that this can be the same file as what is on the server! But it needs to be in both places.
I greatly appreciate the example, however, being completely new to Flex and BlazeDS, I’m not sure how to adjust the uri endpoint correctly. There’s no messagebroker location on my tomcat server (???). Apologies for the novice question.
Is there the possibility/chance to get a FLEX / BlazeDS / AMFPHP – solution? This would be a great offer for all non-java, php/flex/as3 coders…to reach the world of realtime collabrations etc..
Meanwhile is there a resource to learn the good old stuff, like the insert/update/select mysql in conjunction with a Flex/BlazeDS environment again/new in Java?
Well, actually my dream is to do this realtime stuff as FLEX / BlazeDS / AMFPHP – solution using my PHP/AS3 skills.
Stevie :
Hi there,
Is there the possibility/chance to get a FLEX / BlazeDS / AMFPHP – solution? This would be a great offer for all non-java, php/flex/as3 coders…to reach the world of realtime collabrations etc..
Meanwhile is there a resource to learn the good old stuff, like the insert/update/select mysql in conjunction with a Flex/BlazeDS environment again/new in Java?
Well, actually my dream is to do this realtime stuff as FLEX / BlazeDS / AMFPHP – solution using my PHP/AS3 skills.
AMFPHP is an AMF solution. BlazeDS is an AMF solution. While not completely mutually exclusive, they really are mutually exclusive. Either or.
@wade There really isn’t any reason to put your destination in both services and remoting if you use the default config files. The remoting-config is an include of services-config. Keep it DRY and whatnot.
Hi, This is really nice hello world example. Earlier worked with PHP and looking for example to communicate flex with java, This example help me a lot. Thanks for sharing.
Great, thx! It works. When downloading the Zip take care to adjust your endpoint uri.
I greatly appreciate the example, however, being completely new to Flex and BlazeDS, I’m not sure how to adjust the uri endpoint correctly. There’s no messagebroker location on my tomcat server (???). Apologies for the novice question.
Hey Wade,
Thanks for this mini tutorial. I am looking fotwatd to work with blazeDS and this post of yours is a good boost to start with.
[FaultEvent fault=[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8080/mms/messagebroker/amf'"] messageId=”F00306EE-8E93-05EE-5E13-41F39B10DC7B” type=”fault” bubbles=false cancelable=true eventPhase=2]
Why mms in http://localhost:8080/mms/messagebroker/amf?
Hi there,
Is there the possibility/chance to get a FLEX / BlazeDS / AMFPHP – solution? This would be a great offer for all non-java, php/flex/as3 coders…to reach the world of realtime collabrations etc..
Meanwhile is there a resource to learn the good old stuff, like the insert/update/select mysql in conjunction with a Flex/BlazeDS environment again/new in Java?
Well, actually my dream is to do this realtime stuff as FLEX / BlazeDS / AMFPHP – solution using my PHP/AS3 skills.
AMFPHP is an AMF solution. BlazeDS is an AMF solution. While not completely mutually exclusive, they really are mutually exclusive. Either or.
@wade There really isn’t any reason to put your destination in both services and remoting if you use the default config files. The remoting-config is an include of services-config. Keep it DRY and whatnot.
Have you tried creating new Flex application which will use BlazeDS and will be hosted on IBM WAS? Any suggestions/comments will be helpful.
@Xevi Colomer
Hey i tried the following endpoint as i configured blazeDS on 8400 port
http://localhost:8400/blazeds/messagebroker/amf
and that worked perfectly.
Nice hello world Example, just the kind I’ve been looking for. Thanks for sharing.
If you want to read other blazeDS base example go to http://programmaremobile.blogspot.com/2009/10/java-and-blazeds-by-example.html
Great share, thanks a lot!!
Hi, This is really nice hello world example. Earlier worked with PHP and looking for example to communicate flex with java, This example help me a lot. Thanks for sharing.