Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Configuring the flex app

  1. #1
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default Configuring the flex app

    Hi,
    I am trying to convert a sample of mine but I think I am missing something. The docs are talking about the configuration of the services in services-config.xml and remoting-config.xml. The remoting.xml can be pretty much left with some defaults. You do not have to configure the destinations.

    In the log files I can see this going for the server side. I see that the configured classes are used. However, I am having some problems at the client. There I cannot find the destinations. Am I doing something wrong? Should I now configure the client differently from the server?

    Following my code for the configuration, the commented part is the bean now exposed using the spring integration.
    Code:
    <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="bookManager">-->
        <!--<properties>-->
        <!--<factory>spring</factory>-->
        <!--<source>bookManager</source>-->
        <!--</properties>-->
        <!--</destination>-->
    
        <destination id="authenticationHelper">
            <properties>
                <source>nl.gridshore.samples.books.web.security.AuthenticationHelper</source>
            </properties>
        </destination>
    
    </service>
    If I change this for the client into:
    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="remoteBookManager"/>
    
        <destination id="authenticationHelper">
            <properties>
                <source>nl.gridshore.samples.books.web.security.AuthenticationHelper</source>
            </properties>
        </destination>
    
    </service>
    Than it all seems to work, no I have the problem I cannot share config files, Allthough I like it that I only need to define the destinations without any hassle of factories etc. I still need to know the name of the bean that is exposed. It feels like something that cannot be overcome by the spring blazeds library.

    Am I right?

    Jettro
    Last edited by jettro; Dec 23rd, 2008 at 03:01 AM.
    Jettro Coenradie
    http://www.gridshore.nl

  2. #2
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Quote Originally Posted by jettro View Post
    However, I am having some problems at the client. There I cannot find the destinations.
    What do you mean exactly? I'm assuming you mean when referencing the services at runtime with a RemoteObject?

    It should definitely work without having to add
    Code:
    <destination id="remoteBookManager"/>
    for the client.

    Are you perhaps not accessing the destination by the correct identifier? The dynamic destination is configured such that by default the id is the same as the bean id of the exporter, though that is configurable via the serviceId property of the exporter.
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  3. #3
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default

    Yes I mean from code, I do create the services programmatically. I did manage to get it working with a custom build channelset. It seems the client does not know how to connect to the destination because the client does not know it.

    Code:
    public class BookService extends RemoteService {
            public function BookService(channelSet:ChannelSet) {
                super("bookService", "remoteBookManager",channelSet);
            }
    }
    
    public class RemoteService {
        protected var remoteObject:RemoteObject;
    
            public function RemoteService(id:String, destination:String, channelSet:ChannelSet) {
                this.remoteObject = new RemoteObject(id);
                this.remoteObject.destination = destination;
                this.remoteObject.channelSet = channelSet;
                this.remoteObject.addEventListener(FaultEvent.FAULT,onRemoteException);
            }
    }
    With the config file I cannot make this work.

    I'll do some more experimentation to nail this one doen

    Quote Originally Posted by jeremyg484 View Post
    What do you mean exactly? I'm assuming you mean when referencing the services at runtime with a RemoteObject?

    It should definitely work without having to add
    Code:
    <destination id="remoteBookManager"/>
    for the client.

    Are you perhaps not accessing the destination by the correct identifier? The dynamic destination is configured such that by default the id is the same as the bean id of the exporter, though that is configurable via the serviceId property of the exporter.
    Jettro Coenradie
    http://www.gridshore.nl

  4. #4
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    Ahh, okay I see. Yes, I do think assigning the ChannelSet to the RemoteObject is the key there. I don't think there's any getting around that when using dynamic destinations.

    See here:
    http://livedocs.adobe.com/blazeds/1/...econfig_1.html

    Though I believe if you have "my-amf" set up as an application-wide default, it would work without needing to explicitly specify the ChannelSet.

    For example, from the services-config.xml in the BlazeDS sample:

    Code:
    <services>
            
            <service class="flex.samples.DatabaseCheckService" id="hsqldb" />
            
            <service-include file-path="remoting-config.xml" />
            <service-include file-path="proxy-config.xml" />
            <service-include file-path="messaging-config.xml" />
            
    	    <service class="flex.samples.runtimeconfig.EmployeeRuntimeRemotingDestination" id="runtime-employee-ro" />
    
        	<!-- 
        	Application level default channels. Application level default channels are 
        	necessary when a dynamic destination is being used by a service component
        	and no ChannelSet has been defined for the service component. In that case,
        	application level default channels will be used to contact the destination.
            -->   
            <default-channels>
               <channel ref="my-amf"/>
            </default-channels>
        
    </services>
    Jeremy Grelle

    Staff Engineer, Web Products Team
    SpringSource

  5. #5

    Default

    I have a similar issue here. I have configured the server as suggested. But, when i make a call from the client i get the following error:

    Code:
    message='Destination 'loginService' either does not exist or the destination has no channels defined

    remoting-service

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

    services-config.xml
    Code:
        <channels>
            <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
                <endpoint url="http : / / {server.name}:{server.port}/{context.root}/spring/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
            </channel-definition>

    Spring beans
    Code:
    	<bean id="loginServiceController" class="org.phoenix.core.LoginService" />
    	    
    
    	<bean id="loginService" class="org.springframework.flex.messaging.remoting.FlexRemotingServiceExporter">
    		<property name="service" ref="loginServiceController"/>
    		<property name="messageBroker" ref="messageBrokerFactory"/>
    	</bean>
    What am i missing?

  6. #6
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    11

    Default

    Not sure whether they're typos or not, but it's supposed to be remoting-config.xml (not remoting-service) and there are some spaces in the endpoint URL in the services-config.xml which may cause some unexpected behaviour.

  7. #7

    Default

    Not sure whether they're typos or not, but it's supposed to be remoting-config.xml (not remoting-service)
    The remoting-service is defined in the Services-config file. The only thing that you have to worry about is to ensure that file name matches the one provided in services-config.xml

    some spaces in endpoint URL
    - I did this because i was not allowed to post URL possibly because of being a new user.

  8. #8
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default Somebody wants to try it out?

    I have a sample that I have been using for a while and I have re-written it with the blazeds spring integration. I still have the same problem as mentioned in this thread. It only works when I add an empty destination to the client side configuration. If someone has the time to try it out:

    http://code.google.com/p/gridshore/s...books-overview

    It is all maven, so you can build it using maven, do make sure you have the M1 of the integration in you repository.

    You can start the application using jetty integrated with maven:
    cd books-web
    mvn clean jetty:run-war

    Open the link
    http://localhost:8080:/books-web
    Jettro Coenradie
    http://www.gridshore.nl

  9. #9

    Default

    While i try the application...!!


    Quote Originally Posted by jettro View Post
    It only works when I add an empty destination to the client side configuration.
    I am surprised that this works for you, because when I compile my application with an entry in remoting-service, I get an error on my web server, which says that I have the service exposed twice one in remoting-service and other in the spring-bean configuration.

    However, I tried by creating a channel in my code-behind and assigned that channel to my remote service. It worked.

  10. #10
    Join Date
    Aug 2004
    Location
    The Netherlands
    Posts
    160

    Default

    Quote Originally Posted by k.v.ahuja View Post
    While i try the application...!!


    I am surprised that this works for you, because when I compile my application with an entry in remoting-service, I get an error on my web server, which says that I have the service exposed twice one in remoting-service and other in the spring-bean configuration.

    However, I tried by creating a channel in my code-behind and assigned that channel to my remote service. It worked.
    I only added the destination to the client, so I duplicated the files. Yes I know that is not clean, but for the time being it does work. As for the Channels in code, yes I did that as well and for me it worked also. I am planning on using the other spring-flex module. The action script integration. There was some example code for configuring a channel using the xml config.
    Jettro Coenradie
    http://www.gridshore.nl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •