Expand my Community achievements bar.

SOLVED

Help with Flex, Blaze and Cairngorm

Avatar

Former Community Member
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 Accepted Solution

Avatar

Correct answer by
Former Community Member
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");

}

View solution in original post

4 Replies

Avatar

Level 2
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.

Avatar

Former Community Member
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");

}

Avatar

Former Community Member
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



'

Avatar

Correct answer by
Former Community Member
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");

}
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----