martin911
Jan 21st, 2009, 10:28 AM
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"?>
<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:
<?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.JavaAdap ter" 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:
<?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.SimpleUrlH andlerMapping">
<property name="mappings">
<value>
/messagebroker/*=mySpringManagedMessageBroker
</value>
</property>
</bean>
<!-- Dispatches requests mapped to a MessageBroker -->
<bean class="org.springframework.flex.messaging.servlet.Message BrokerHandlerAdapter"/>
<!-- Bootstraps and exposes the BlazeDS MessageBroker -->
<bean id="mySpringManagedMessageBroker" class="org.springframework.flex.messaging.MessageBrokerFa ctoryBean" />
<!-- Expose the productService bean for BlazeDS remoting -->
<bean id="person" class="org.springframework.flex.messaging.remoting.FlexRe motingServiceExporter">
<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!
<?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:
<?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.JavaAdap ter" 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:
<?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.SimpleUrlH andlerMapping">
<property name="mappings">
<value>
/messagebroker/*=mySpringManagedMessageBroker
</value>
</property>
</bean>
<!-- Dispatches requests mapped to a MessageBroker -->
<bean class="org.springframework.flex.messaging.servlet.Message BrokerHandlerAdapter"/>
<!-- Bootstraps and exposes the BlazeDS MessageBroker -->
<bean id="mySpringManagedMessageBroker" class="org.springframework.flex.messaging.MessageBrokerFa ctoryBean" />
<!-- Expose the productService bean for BlazeDS remoting -->
<bean id="person" class="org.springframework.flex.messaging.remoting.FlexRe motingServiceExporter">
<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!