Prerequisites
Install Flex Builder
Install LCDS Data Services
Install WTP in Flex Builder
Here’s a simple project that shows you how to create a simple Hello World for Flex + Java via LCDS. I’ll also show you how to debug the server [java] code as we move along.
File->New->Flex Project
Select the target runtime. You will need to click ‘New’ to create one if none are available.
Create a new target runtime if needed.
Be sure to change your Output URL to match the LCDS [tomcat] config (defaults to 8400)

Run->Debug->Other
Again, make sure the URLs are using the correct port
Project->Properties->Flex Server
Okay, are setup is complete now we’re ready to code.
Here’s the MXML
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private function sayHello():void
{
testService.getOperation('sayHelloTo').send(txtName.text);
}
private function onFault(event:FaultEvent):void
{
trace(event);
}
private function onSayHelloToResult(event:ResultEvent):void
{
Alert.show(event.result as String);
}
]]>
</mx:Script>
<mx:RemoteObject id="testService" fault="onFault(event)" destination="helloDest">
<mx:method name="sayHelloTo" result="onSayHelloToResult(event)"/>
</mx:RemoteObject>
<mx:TextInput id="txtName" x="10" y="10"/>
<mx:Button click="sayHello()" x="178" y="10" label="Go"/>
</mx:Application>
Note the destination=”helloDest” line, we’ll have to configure a LCDS destination with this name in a few steps…
Create a simple java class to test against:
public class HelloWorld {
public String sayHelloTo(String name)
{
return "Hello " + name;
}
}
And finally, we need to setup the destination
To do so, edit \WebContent\WEB-INF\flex\remoting-config.xml, adding the following
<destination id="helloDest">
<properties>
<source>HelloWorld</source>
</properties>
</destination>
That’s it, now we are ready to test.
Set a breakpoint on the on ‘return “Hello ” + name;‘ line in you’re java code.
Launch the server in debug mode
Now, launch the flex app [in debug mode if you want to debug the front end as well].
Type your name in the input box and click ‘Go.’
You’ll see your breakpoint being caught, both server [java] side and client side







