1 Reply Latest reply on Aug 29, 2008 2:03 AM by Newsgroup_User

    I'm lost in the world of Data Services

    EvolvedDSM Level 2
      Quick Question for those who use FDS/LCDS with coldfusion data sources:
      How are you setting up your server to utilize FDS/LCDS on a flex app that is trying to use a coldfusion data source?

      Long Version:
      I'm able to create projects that use FDS2/LCDS (I have both Flex 2 and 3 licensed) on my localhost using the integrated JRun server installation. Connecting to data services that I specify in data-management-config is a breeze and everything works great.

      The whole point of testing my apps on localhost is to eventually move them to production where multiple PCs will be able to use my applications. The application I'm currently working on requires data to be pushed to the client when data is added/modified/deleted, hence my reason for needing Data Services.

      From my understanding, the integrated JRun server is for development only, and that I should use a J2EE installation of FDS/LCDS. So I looked into what can be done for J2EE, and found "Glassfish" by Sun. After installing this to the server, it was rather easy to access its default pages from any remote PC. Reading further into J2EE and FDS/LCDS, I needed to deploy the flex.war package to the server. I did this just fine, and could access it via http://myserverip:4043/flex/ and it gives me the default flex page "Welcome to adobe livecycle data services."

      Here's where I'm stuck and am not understanding how FDS/LCDS works with a J2EE server. I've created a flex project that uses J2EE application server with LCDS remote object access. I specify the server location (path to my flex deployment) and the application location (a directory inside the flex deployment). If I make a standard flex page with static objects such as a button or text label, and then try to view it on my J2EE address, it works fine.

      Now, when I try to set up a data service, this is where it doesn't work. BIG NOTE: I'm using CFCs because I have a ColdFusion installation on my server! So I am also using the ColdFusion data source management on my database
      1. I create my CFCs and actionscript files using the CFC Wizard and place the CFCs in a directory in my C:\CFUSIONMX7\wwwroot and the actionscript into a folder in my project
      2. I set up data-management-config on the J2EE deployment (adding the CF adapter and the proper destination named 'myds' with the component property pointing to the cfc directory and assembler).
      3. I added the ColdFusion channels in services-config on the J2EE deployment (cf-dataservice-rtmp, cf-polling-amf)
      4. In my project application, I declare a dataService and ArrayCollection (ds and ac), and set them to...
      ds = new DataService("myds");
      ac = new ArrayCollection;
      ds.fill(ac);
      5. I created a datagrid and set its dataProvider = "{ac}"
      6. Added creationComplete to the appilcation tag, and set it to a function that will define my ds and ac on application start

      Here's my code for the application:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.data.DataService;

      private var ds:DataService;
      [Bindable]
      private var ac:ArrayCollection;

      private function initApp():void{
      setGrid();
      }

      private function setGrid():void{
      ds = new DataService("recepds");
      ac = new ArrayCollection
      ds.fill(ac);
      }
      ]]>
      </mx:Script>
      <mx:DataGrid id="gridid" dataProvider="{ac}">
      <mx:columns>
      <mx:DataGridColumn headerText="Column 1" dataField="dbcol1"/>
      <mx:DataGridColumn headerText="Column 2" dataField="dbcol2"/>
      <mx:DataGridColumn headerText="Column 3" dataField="dbcol3"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Application>

      Here's my data-management-config:
      <service id="data-service"
      class="flex.data.DataService">

      <adapters>
      <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/>
      <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/>
      <adapter-definition id="coldfusion-dao" class="coldfusion.flex.CFDataServicesAdapter"/>
      </adapters>

      <default-channels>
      <!--
      Set the ref id of the default channels to use as transport for this service.
      The channel is defined elsewhere using the channel-definition tag.
      -->
      <channel ref="my-rtmp"/>
      <channel ref="my-polling-amf" />
      </default-channels>

      <destination id="myds">

      <adapter ref="coldfusion-dao"/>
      <channels>
      <channel ref="cf-dataservice-rtmp"/>
      <channel ref="cf-polling-amf"/>
      </channels>

      <properties>
      <component>myproject.cfc.myAssembler</component>
      <scope>application</scope>

      <metadata>
      <identity property="myID"/>
      </metadata>
      </properties>
      </destination>

      <properties>
      <use-cluster-broadcast>true</use-cluster-broadcast>
      </properties>

      </service>

      So, if anyone has taken the time to read this far, can you provide help in why my data service will not work even though it's configured the same way on my localhost, which does work.