0
votes

I want to recive RemoteObject from my service. Everything works fine but my code looks like this:

<mx:AMFChannel id="myamf"  uri="messagebroker/amf"/> 
<mx:ChannelSet id="channelSet" channels="{[myamf]}"/>
<mx:RemoteObject id="ro" channelSet="{channelSet}" destination="pServ" result="resultHandler(event);" fault="faultHandler(event);"/> 

is there a way to avoid hard typing channel uri in my .mxml file?

i tried with default channels in blazeds xml but without succes.

thats are parts of my configuration:

spring appContext.xml

<context:component-scan base-package="org.flex.test.services"/>
<flex:message-broker>
    <flex:remoting-service default-channels="my-amf"/>
</flex:message-broker>

<flex:remoting-destination ref="personService" destination-id="pServ"/> 

flex services-config.xml

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

    <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>
    </service>
</services>

<channels >
    <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"/>
    </channel-definition>
</channels>

Im running flex app from root of aplication file - main.html.

Thank you for answers!

1

1 Answers

0
votes

The default channel will work, but you need to add a reference to the services.xml as a compiler argument so that the compiler knows what the default is. Something like this should do the trick...

-services {Your base directory}\src\main\webapp\WEB-INF\flex\services-config.xml