Announcement Announcement Module
Collapse
No announcement yet.
Working with Cairngorm Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Working with Cairngorm

    In our Flex enviroment we are using a mvc framework from adobe called Cairngorm. In carngorm the services are configured in Services.mxml like this:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <cairngorm:ServiceLocator
    	xmlns:mx="http://www.adobe.com/2006/mxml"
    	xmlns:cairngorm="com.adobe.cairngorm.business.*">
    	
    	<!-- Login Service -->
    	
    	<mx:RemoteObject id="person" showBusyCursor="true"
    				destination="person">
    		<mx:method name="create"/>		
    		<mx:method name="save"/>
    		<mx:method name="remove"/>
    		<mx:method name="findByUserName"/>
    		<mx:method name="findIdByUserName"/>
    		<mx:method name="findByLastName"/>
    		<mx:method name="findCoachAthlets"/>
    		<mx:method name="findCoaches"/>
    		<mx:method name="findByEmail"/>
    		<mx:method name="getAll"/>
    	</mx:RemoteObject>
    		
    </cairngorm:ServiceLocator>
    In normal the Service is defined in remoting-config.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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"/>
        </default-channels>
    
    	<destination id="person">
                <properties>
                    <factory>spring</factory>
                    <source>person</source>
                </properties>
    	</destination>		
    </service>
    The example app in the spring-flex distribution shows us to empty the remoteing-config.xml. Then I configured the web-application-config.xml like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
               http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
        <!-- Includes Backend context -->
        <import resource="classpath:/com/globalfoxsystems/trainingguide/core/config/application-context.xml" />
        
        <!-- Maps request paths at /messagebroker to the BlazeDS MessageBroker -->
    	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <value>
                    /messagebroker/*=mySpringManagedMessageBroker
                </value>
            </property>
        </bean>
    
    	<!-- Dispatches requests mapped to a MessageBroker -->
    	<bean class="org.springframework.flex.messaging.servlet.MessageBrokerHandlerAdapter"/>
    
    	<!-- Bootstraps and exposes the BlazeDS MessageBroker -->
    	<bean id="mySpringManagedMessageBroker" class="org.springframework.flex.messaging.MessageBrokerFactoryBean" />	
        
        <!-- Expose the productService bean for BlazeDS remoting -->
        <bean id="person" class="org.springframework.flex.messaging.remoting.FlexRemotingServiceExporter">
            <property name="messageBroker" ref="mySpringManagedMessageBroker"/>
            <property name="service" ref="personDao"/>        
        </bean>
    </beans>
    bean with id=person refers to my personDao in my backend. As I understand the documentation id=person is my service tho wich flex refer the methods for the application.

    But I can not access to the remote service. Starting Tomcat show me no errors. I can not understan, why it not work or I missunderstood the spring-flex enviroment.
    Thank you for your help in advance!

  • #2
    I would be surprised if this was really an issue with Cairngorm - but it might be with your RemoteObject definition. The first thing I would recommend is to download an Http Proxy that understands AMF - such as Charles or Service Capture. This will let you see the exact traffic going back and forth.

    Also double check your service-config.xml. If you read the 'how to' blog you will notice that Jeremy changes the endpoint URL of the channel-definition with id="my-amf". He added 'spring' to the path which is what the servlet-mapping specified in the url-pattern.

    I assume you are not using hibernate - correct?

    Lastely - double check the endpoint attribute onthe RemoteObject and make sure it includes the 'spring' path such as:
    endpoint="http://localhost:8080/myapp/spring/messagebroker/amf"

    NOTE: I have been using 'spring' but you may have your url-pattern set to something else, or nothing at all. I was just using this to be consistent with the example from the Blog.

    Comment


    • #3
      I believe you are mixing up things. In you remoting-config-xml it seems as if you're using the Spring Factory for BlazeDS (made by Jeff Vroom).

      This is actually different than using the Spring BlazeDS Integration stuff.

      I suggest you head to Christophe's site and download the testdrive distribution to get started without hassle.

      Dirk.

      Comment


      • #4
        We are thinking Cairngorm+Spring ActionScript as a one possible solution for our Flex architecture.

        Does Cairngorm work directly with Spring BlazeDS? How about Maven support, for example, do flex-mojo`s compile Cairngorm code?

        Too much frameworks, too much choises...

        Comment

        Working...
        X