0 Replies Latest reply on Sep 17, 2013 3:19 AM by riapp

    Mapping ActionScript and Java objects with BlazeDS

    riapp

      Hello,

       

      I'm testing a communication between Flex and Java under BlazeDS. For this I defined a Class both in ActionScript and Java named Globale:

       

      Frontend side :

       

      package traitement
      {
          [Bindable]
          [RemoteClass(alias="traitement.Globale")]
          public class Globale
          {
      
              public var donnee_1:Number;
              public var donnee_2:Number;
              public var donnee_3:Number;
              public var donnee_4:Number;
              public var donnee_5:Number;
              public var donnee_6:Number;
              public var donnee_7:Number;
              public var donnee_8:Number;
      
              public function Globale(var_1:Number, var_2:Number, var_3:Number, var_4:Number, var_5:Number, var_6:Number, var_7:Number, var_8:Number)
              {
                  donnee_1 = var_1;
                  donnee_2 = var_2;
                  donnee_3 = var_3;
                  donnee_4 = var_4;
                  donnee_5 = var_5;
                  donnee_6 = var_6;
                  donnee_7 = var_7;
                  donnee_8 = var_8;
              }
      
          }
      }
      

       

      Backend side :

       

      package traitement;
      
      public class Globale {
      
          public double donnee_1;
          public double donnee_2;
          public double donnee_3;
          public double donnee_4;
          public double donnee_5;
          public double donnee_6;
          public double donnee_7;
          public double donnee_8;
      
          public Globale(double var_1, double var_2, double var_3, double var_4, double var_5, double var_6, double var_7, double var_8)
          {
              donnee_1 = var_1;
              donnee_2 = var_2;
              donnee_3 = var_3;
              donnee_4 = var_4;
              donnee_5 = var_5;
              donnee_6 = var_6;
              donnee_7 = var_7;
              donnee_8 = var_8;
          }
      
      }
      

       

      Here is the class Invocations that contains the function invocation() in the backend side :

       

      package traitement;
      
      import traitement.Globale;
      
      public class Invocations {
      
          public Globale invocation()
              {
                  Globale b = new Globale(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
                  return(b);
              }
      
      }
      

       

      Here is the MXML file invoking the function invocation() via a remote object :

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ext="ext.*"
          horizontalAlign="center"
          verticalGap="0"
          creationComplete="fonction();"
          >
      
          <mx:Script>
              <![CDATA[
              import mx.rpc.events.FaultEvent;
              import mx.rpc.events.ResultEvent;
              import mx.controls.Alert;
              import traitement.Globale;
      
              public function erreur(e:FaultEvent):void
                  {
                      Alert.show(e.fault.message);
                  }
      
              public function succes(e:ResultEvent):void {
                      var a:Globale = Globale(e.result);
                      Alert.show(a.donnee_1.toString());
                  }
      
              public fonction():void
                  {
                      remoteobject.invocation();
                  }
      
              ]]>
          </mx:Script>
      
          <mx:RemoteObject id="remoteobject"
              showBusyCursor="true"
              fault="erreur(event)"
              destination="dest_1"
              result="succes(event)"
              />
      
      </mx:VBox>
      

       

      Finally, here is the <destination> tag integrated inside the remoting-config.xml file :

       

      <destination id="dest_1">
              <properties>
                  <source>traitement.Invocations</source>
                  <scope>application</scope>
              </properties>
      </destination>
      

       

      When I run the application, instead of having the variable of type Number casted to String displayed into the Alert, I have this error message :

       

      faultCode:Server.Acknowledge.Failed faultString:'Didn't receive an acknowledge message'

      faultDetail:'Was expecting mx.messaging.messages.AcknowledgeMessage, but received null'

       

      Thank you for your help.