3 Replies Latest reply on Aug 31, 2010 6:35 AM by daslicht

    Method to call Java

    SrinivasanJR Level 1



            In Java, we can write a method which returns integer and also fill the hashmap which is passed as argument.




      HashMap map= new HashMap();

      int a = sampleMethod(map);



      public int sampleMethod(HashMap map)




           return 0;



      So here when the method is called , the return type returns int and also the hashmap will be filled with the value.

      Similarly in Java with CORBA as middlelevel , we can have a return value and also fill the holder object.


      Is there anything possible similar to that?


      I have a AS in Flex which calls the remote method as follows


      public static function getSession(userId:UserLoginIdentifier , sessionIdHolder:Object, true,


                  message:InfoMessageHolder):InfoMessageHolder {


              try {


                  return server_.getSession(userId,sessionIdHolder, true, message);


              } catch (e:Error) {


      //            TraceManager.TrException(e);


                  throw e;




              return null;




      In Java, the getSession Method returns InfoMessageHolder which can be retrieved by implementing result_handler.

      But I also need to send the sessionIdHolder. How do I fill that?


      Is there anyother way to do it? ie filling two different objects in the Java and send to flex?




        • 1. Re: Method to call Java
          daslicht Level 2


          so you want to use Java as Backend for your Flex Applikation?


          Probably you like to have a look on BlazeDS.


          Have a nice day !


          • 2. Re: Method to call Java
            SrinivasanJR Level 1


            Yes. Here I am doing the remote method call using BlazeDS only.


            But is it possible to update two different objects in the Java part and then can those be used at the flex part?

            I mean that will the holder will be filled with values?




            • 3. Re: Method to call Java
              daslicht Level 2


              so basically you want to call a java function, this function updates to different objects , and than you want both objects be returned?


              Something like this:


              Flex->Java->updateA  return->Flex



              Could you probably create a Value object for that and store both updated object into it and return it ?


              Hope that helps somehow.



              Have a nice day !