3 Replies Latest reply on Sep 28, 2006 4:25 PM by vrubba

    RemoteObject Java -> http failled

      Hi, I have an application with flex 2.0, flex data services and java and I want to access methods of my JAVA classes. So I use the remoteObject.

      Here is the code :


      package beans;

      public class Test {

      public Test()
      System.out.println("-= Test start =-");

      public String doTest()
      return "-= This is a test =-";



      <?xml version="1.0" encoding="UTF-8"?>
      <service id="remoting-service"

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

      <channel ref="my-amf"/>

      <destination id="test">



      <?xml version="1.0"?>

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      backgroundGradientColors="[#ffffff, #808080]"

      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import mx.collections.ArrayCollection;
      import flash.events.MouseEvent;
      import mx.rpc.AsyncToken;
      import mx.data.*;
      import mx.managers.*;


      private function doTest():void


      <mx:RemoteObject id="test" destination="test">
      <mx:method name="createTest"/>

      When I launch the server " -= Test start =-" is printed on tomcat so the remoteObject is good initialized but after there is an error due to the method createTest.

      Here is the final message when i launch the application :

      [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed"]
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::faultHandler()
      at mx.rpc::Responder/fault()
      at mx.rpc::AsyncRequest/fault()
      at mx.messaging::ChannelSet/::faultPendingSends()
      at mx.messaging::ChannelSet/channelFaultHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.messaging::Channel/mx.messaging:Channel::connectFailed()
      at mx.messaging.channels::PollingChannel/mx.messaging.channels:PollingChannel::connectFailed ()
      at mx.messaging.channels::AMFChannel/mx.messaging.channels:AMFChannel::statusHandler()

      Please help me.
        • 1. Re: RemoteObject Java -&gt; http failled
          what purpose does the lin <mx:method name="createTest"/> serve? I'd remove that first off and try it again.

          Also add a System.out.println to your doTest function so you'll see when it actually gets called... that will help a bit.

          Just my 2cents.
          • 2. Re: RemoteObject Java -&gt; http failled
            sanclementetech Level 1
            2 things

            1) your method should be doTest not createTest for your remote object
            2) you need to add an endpoint to your remote object
            • 3. Re: RemoteObject Java -&gt; http failled
              vrubba Level 1
              My understanding is that you really only need the <mx:method/> if the method being called requires arguments passed to it. Likewise, if you are not returning any values (i.e. private function doTest():void) you don't really need to supply a resultHandler - at least you don't need one to see if the code is calling your method correctly. If you want to see the string it's supposed to pass back then yes you will need to handle the result.

              I use this format and it lets me call any function in my com.abc.Security java class.
              result="event.token.resultHandler(event)" />