Announcement Announcement Module
No announcement yet.
Working with Cairngorm Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:
    <?xml version="1.0" encoding="utf-8"?>
    	<!-- Login Service -->
    	<mx:RemoteObject id="person" showBusyCursor="true"
    		<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"/>
    In normal the Service is defined in remoting-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service" 
            <adapter-definition id="java-object"                      class=""  default="true"/>
            <channel ref="my-amf"/>
    	<destination id="person">
    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:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=""
        <!-- 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">
    	<!-- 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 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:

    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.


    • #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.



      • #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...