3 Replies Latest reply on Mar 14, 2008 5:04 AM by SujitG

    Calling Spring Beans From Flex

    Agent-96 Level 1
      Hi,

      I have a java J2ee project, with spring integrated. I have set up the project so that I can make calls from flex mxml files to spring managed objects. This works as expected.

      My project deploys so that I have the following folder and file hierarchy.

      MyProj (folder) - MortgageCalc.mxml file (this contains code to make the remote calls)
      |- Web-INF
      |- classes (compiled Java classes)
      |- flex (containing my services-config, remoting-config)
      |- lib (all my jars)

      My MortgageCalc.mxml file is very simple; it looks like this :

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:RemoteObject id="ro" destination="mortgageService"/>
      <mx:TextInput id="amount"/>
      <mx:Button label="Calculate" click="ro.calculate(Number(amount.text))"/>
      <mx:TextInput id="monthlyPayment" text="{ro.calculate.lastResult}"/>
      </mx:Application>

      MyProj sits under tomcat/webapps.

      What I would like to do is move my flex code into a new folder under tomcat, as a separate web app - calling the Spring beans in another web-app.

      So my set-up would be

      tomcat/webapps/MyProj (containing all my Java code)
      tomcat/webapps/MyFlexApp (with my flex app)

      I have tried and failed, I get the following error message :
      [RPC Fault faultString="[MessagingError message='Unknown destination 'mortgageService'.']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to 'mortgageService'"]

      I have very crudely just copied over the Web-INF/flex folder into MyFlexApp, crossed my fingers and hoped. Can somebody let me know what folders belong where to get this working? Or if it's even possible at all? Or maybe I need to change services-config, or remoting-config?

      Thanks,

      Matt