0 Replies Latest reply on Jan 9, 2010 6:50 PM by lakshdn

    Not able to call Java from flex using RemoteObject

    lakshdn

      hi,

       

      I am badly stuck in compiling my flex app to connect to Java code on the server side using LCDS remoteObject component.

      My swf file wouldn't trigger a method on the Java class, below is the snippet of all relevant codes, i just don't know what to do.

      Please help on what am i missing or what i am doing wrong in this.

       

      ------> 1. here is the ant target that uses mxmlc compiler option

       

      <target name="flex-compile" depends="copy-all">
          <mxmlc
            file="${uisrc}/OnlineServicesPortal.mxml"
            output="${prjdeploydir}/OnlineServicesPortal.swf"
            actionscript-file-encoding="UTF-8"
            keep-generated-actionscript="true"
            incremental="true"
            as3="true">
      <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
      <source-path path-element="${FLEX_HOME}/frameworks"/>
      <library-path dir="${FLEX_HOME}/frameworks" append="true">
           <include name="libs" />
      </library-path>
      <compiler.source-path path-element="${FLEX_HOME}/frameworks"/>  
      <compiler.include-libraries dir="${FLEX_HOME}/frameworks" append="true">   
           <include name="libs/datavisualization.swc" />   
           <include name="libs/fds.swc" />  
           <include name="libs/player/10/playerfds.swc" />   
           <include name="locale/en_US/datavisualization_rb.swc" />
           <include name="locale/en_US/fds_rb.swc" />
      </compiler.include-libraries>


      <!--compiler.services filename="${src}/flex/services-config.xml"/-->
      <!--context-root context-path="portal"/-->


      <default-size width="500" height="600" />
          </mxmlc>
        </target>

       

       

      ---------2. services-config.xml file

      <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
          <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
          <properties>
      <polling-enabled>false</polling-enabled>
          </properties>
      </channel-definition>
      <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
          <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
      </channel-definition>

       

      ----------3. remoting-config.xml file

      <service id="remoting-service"
          class="flex.messaging.services.RemotingService">

          <adapters>
              <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
          </adapters>

          <default-channels>
              <channel ref="my-amf"/>
              <channel ref="my-http"/>
          </default-channels>

          <destination id="portal">
              <properties>
                  <source>com.mssb.portal.impl.PortalService</source>       <!---this class file is valid & exists-->
              </properties>
          </destination>
      </service>

       

       

      -----------4. mxml file

      <mx:RemoteObject  id="myRO"  destination="portal"  result="createFieldsResultHandler();"  fault="createFieldsFaultHandler();">
      </mx:RemoteObject>

       

      myRO.persistServiceDefinition(serviceDef)                           //called from action script function invoked upon a click of a button.