3 Replies Latest reply on Sep 15, 2006 1:42 AM by thePlotz

    Flash Remoting MX  vs AMF3

      We are using Flash MX 2004 and Flash Remoting MX to connect to a java application with this syntax :
      NetServices.setDefaultGatewayUrl(" http://myserver:7778/myApp/gateway");
      gatewayConnection = NetServices.createGatewayConnection();
      flashtestService = gatewayConnection.getService("com.company.myApp.remote.FormProvider", this);
      flashtestService.getInitDataFor(_root.sessionguID, 1);

      Could anyone give me an example on how this is done in Flex 2?

        • 1. Re: Flash Remoting MX  vs AMF3
          Level 1
          Unfortunately, with Flex 2 - connecting to a Java application server is a little more involved.

          You need to have a java application server setup, have your flex application in a war file/directory and have Flex 2 Data Service s installed on your applicaiton server. You need to edit two configuration files service-config.xml and remoting-config.xml and add them to your flex war. Then, in your flex mxml code you can have the following:

          fault="mx.controls.Alert.show(event.fault.message, 'Remote Object Error')">
          <mx:method name="getInitDataFor" result="someMethod(event);"/>

          Then in your action script:

          RO.getInitDataFor(_root.sessionuID, 1);

          You'll then recieve the reply at:

          public function someMethod(event:ResultEvent):void
          var result:* = event.result;

          This is, of course, a very high level overview.....

          your best bet is to go through the Flex Data Services documentation for the whole set up. The Flex 2 Developers Guide has a chapter on how to set this up - http://www.adobe.com/support/documentation/en/flex/

          Good Luck!


          • 2. Re: Flash Remoting MX  vs AMF3
            thePlotz Level 1
            Lots of useful information there, I really appreciate it!
            I have been on this for a week now, and it's not easy :-(
            I have installed the Flex 2 Data Service, and it's running on a jrun4 application server on my windows machine. The application that I'm trying to connect to is on an oracle server with an j2ee root defined on it.
            So the defaultGatewayUrl is then set as a channel or someting in the xml files that You mentioned?
            The part with the flex war I did't understand, but perhaps the documentation is the best way as You wrote.

            Thanks a lot! (and more information is appreciated, from You Andy or others with same issues :-) )
            • 3. Re: Flash Remoting MX  vs AMF3
              thePlotz Level 1
              How should the service-config.xml and remoting-config.xml look like, when I have a java application lying on a server with this address: http://myserver:7778/myApp ?? And where is the formProviderRO set? My last question is about the war file. When I made the project in Flex I chose the 'Compile application locally in Flex', how will the change in the xml-files then take place?

              Hope You can help me awclemen :-) (Or others!)