0 Replies Latest reply on Aug 13, 2007 4:40 AM by raga_menon

    Sample Example on Remote Object

    raga_menon Level 1
      Hi All,

      I am doing a sample program in Flex using Remote Object, when i enter Data in TextInput and click getData(button) in the TextArea conrol the the Data in TextInput should be displayed along with that some updation, these updations are declared
      in the Java. when i click on the Button(getData) it will update the Data using the RemoteObject. Here is my Application..
      Also described the desired path in RemoteConfig.xml


      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:RemoteObject id="srv" destination="testsession" fault="faultHandler(event)" >
      <mx:method name="getMessage" result="display(event)" ></mx:method>


      import flash.net.navigateToURL;
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      public function getMessage():void {
      Alert.show("alertin echo"+ input.text);
      public function display(event:ResultEvent):void {
      Alert.show("In display Response");
      output.text = event.result();
      private function faultHandler(event:FaultEvent):void
      Alert.show("Server Message: Error"+event.message);
      } ]]>

      <mx:Panel title="Sample" width="320">
      <mx:Form width="500">
      <mx:FormItem label="Input Message"> <mx:TextInput id="input"/> </mx:FormItem>
      <mx:FormItem> <mx:Button label="Get Message" click="getMessage()"/> </mx:FormItem>
      <mx:FormItem label="Output Message">
      <mx:TextArea id="output" show="getMessage()"/>

      Here is My Java Application EchoService.java:

      import java.text.DateFormat;
      import java.text.SimpleDateFormat;
      import java.util.Date;
      public class EchoService

      public String echo( String inputMessage ) throws Exception
      StringBuffer result = new StringBuffer();
      result.append("EchoService received ");
      result.append(" at ");
      result.append(dateFormat.format(new Date()));
      return result.toString();
      private DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

      when i run these am getting an Error at ServerMessage as:


      Server Message: Error(mx.messaging.messages::ErrorMessage)#0
      body = (Object)#1
      clientId = (null)
      correlationId = "F3C89B4B-8166-32AA-7C80-5F0CE42EFB40"
      destination = ""
      extendedData = (null)
      faultCode = "Client.Error.MessageSend"
      faultDetail = "Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: ' http://localhost:8600/messagebroker/amf'"
      faultString = "Send failed"
      headers = (Object)#2
      messageId = "443DBB42-8B18-84D8-151F-5F0CED757E35"
      rootCause = (Object)#3
      code = "NetConnection.Call.Failed"
      description = "HTTP: Status 500"
      details = " http://localhost:8600/messagebroker/amf"
      level = "error"
      timestamp = 0
      timeToLive = 0

      can anyone help me how to achieve this.

      Raa Text ERROR