0 Replies Latest reply on Feb 3, 2007 5:41 AM by ehrvert

    Problem with Java RemoteObject

    ehrvert
      Hello All,
      Thanks in advance,

      I need to use Java RemoteObject in my small aplication, but I have problem with it:

      I have simple java class with three methods:

      public class SimpleClass(){

      public String testString(){
      return "test string...";
      }

      public ArrayList testArrayList(){
      ArrayList list = new ArrayList();
      list.add("test1");
      list.add("test2");
      list.add("test3");
      return list;
      }

      public void testConsole(){
      System.out.println("Test console...")
      }
      }

      I configure file remotig-config.xml :

      <?xml version="1.0" encoding="UTF-8"?>
      <service id="remoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">

      <adapters>
      <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
      </adapters>

      <default-channels>
      <channel ref="my-amf"/>
      </default-channels>

      <destination id="testRemoteObject">
      <properties>
      <source>test.SimpleClass</source>
      </properties>
      </destination>
      <service/>


      and I try call method from my SimpleClass in my aplication:

      <mx:RemoteObject id="test" destination="testRemoteObject"/>

      <mx:Label text="{testRemoteObject.testString()}"/>

      and I see in my label: "[object AsyncToken]"

      when I try

      <mx:Label text="{testRemoteObject.testString}"/>

      I see in my label: " [object Operation]"

      Can any one please guide me how to get String from my Java method ' testString()' and put it to mx:Label component ?

      And second question how I can iterate over ArrayList from my Java method 'testArrayList()', and how i can call some methods on object from this list ?

      I also try call method 'testConsole()' and in my Tomcat console appear String "Test console..." so I suppose that I correct configure RemoteObject.

      Plese guide me as soon as possible because its urgent for me.
      Thanks again.