4 Replies Latest reply on Dec 18, 2008 10:39 AM by jcbwc

    Help with Flex, Blaze and Cairngorm

    jcbwc
      I using Blaze, Flex3 and Cairngorm, I have a simple application at the moment, in which I dispatch a Cairngorm event, it gets picked up the Command is executed and the Delegate can send data to the RemoteObject. I can see in the output that Blaze is doing what it is supposed to do and returning what it is supposed to return, but the data returned never makes it to the IResponder result function. What am I doing wrong? Can post code if needed.
        • 1. Re: Help with Flex, Blaze and Cairngorm
          Zee Yang
          some code and config snippet would be helpful.

          btw, how are you monitoring the blazeds output. are you looking at the blazeds console? try use charles debug proxy to see the actual network traffic.
          • 2. Re: Help with Flex, Blaze and Cairngorm
            jcbwc Level 1
            BlazeDS Console is where I am seeing the output. I don't see anywhere to attach code so I will put some here, is there any particular code you would like to see.

            <cairngorm:ServiceLocator
            xmlns:mx=" http://www.adobe.com/2006/mxml"
            xmlns:cairngorm=" http://www.adobe.com/2006/cairngorm">
            <mx:RemoteObject
            id="dataService"
            destination="dataService"
            makeObjectsBindable="true"
            source="com.example.apps.reports.service.DataService"
            showBusyCursor="true">
            </mx:RemoteObject>
            </cairngorm:ServiceLocator>

            GetUserCommand.as
            public class GetUserCommand implements ICommand, IResponder{


            public function execute( event : CairngormEvent ): void{
            var delegate:GetUserDelegate = new GetUserDelegate(this);
            delegate.getUsers();
            }

            public function result( data : Object ) : void{
            Alert.show("We got to a result");
            }

            GetUserDelegate.as
            public class GetUserDelegate{
            public function getUsers():void{
            var call:AsyncToken;
            call = service.getUsers();
            Alert.show("Get users was called");
            }
            • 3. Re: Help with Flex, Blaze and Cairngorm
              jcbwc Level 1
              Here is the output in the Tomcat console

              [BlazeDS]Channel endpoint my-amf received request.
              [BlazeDS]FlexClient created with id 'F538FE71-271A-47E9-4786-C89F032AA3C7'.
              [BlazeDS]Channel endpoint my-amf received request.
              [BlazeDS]Before invoke service: remoting-service
              incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage)
              operation = getUsers
              clientId = F538FF59-160D-4EE3-753C-4B75467F375C
              destination = dataService
              messageId = BFC69DEC-BFEC-918B-BD8A-4B0C48E7732D
              timestamp = 1229619743094
              timeToLive = 0
              body = null
              hdr(DSId) = F538FE71-271A-47E9-4786-C89F032AA3C7
              hdr(DSEndpoint) = my-amf

              [BlazeDS]Adapter 'java-object' called 'com.example.apps.reports.service.DataServ
              ice.getUsers(java.util.Arrays$ArrayList (Collection size:0)
              )'
              [BlazeDS]Result: 'flex.messaging.io.ArrayList (Collection size:1)
              [0] = com.example.apps.reports.vo.UserVo
              lastName = Boynton
              age = 32
              firstName = John

              '
              • 4. Re: Help with Flex, Blaze and Cairngorm
                jcbwc Level 1
                Found the problem. ... in my Delegate I forgot to addResponder to the AsyncToken.
                Before:
                public function getUsers():void{
                var call:AsyncToken;
                call = service.getUsers();
                Alert.show("Get users was called");
                }

                After:
                public function getUsers():void{
                var call:AsyncToken;
                call = service.getUsers();
                call.addResponder(this.responder);
                Alert.show("Get users was called");
                }