I'm having a problem calling Java services via Flex BlazeDS.
I'm using Spring 3.0.5 with Annotations and Flex 1.0.3.
I've created a POJO as "Group" with public attributes, and I have a AS4 "Group" class with the same attributes.
I setup my RemoteObject as so:
and call this from my modules as:Code:public static function getRemoteObject(destination:String, event:Function, error:Function, showBusyCursor:Boolean=false):RemoteObject { var cs:ChannelSet = new ChannelSet(); var amfChannel:AMFChannel = new AMFChannel("my-amf", "messagebroker/amf"); cs.addChannel(amfChannel); var service:RemoteObject = new RemoteObject(); service.channelSet = cs; service.destination = destination; service.showBusyCursor = showBusyCursor; service.addEventListener(ResultEvent.RESULT, event); service.addEventListener(FaultEvent.FAULT, error); return service; }
This works without a problem, but if I call another service from the same bean, Flex/BlazeDS doesn't seem to be able to map the Flex Group object to the POJO.Code:var grp:Group = new Group(); ... load group var service:RemoteObject = RemoteCalls.getRemoteObject("GroupDAO", resultHandler, faultHandler); service.createGroup(grp);
I've listed the BlazeDS logs for a successful request and a failed request. Both services work, but I can only use one of them as many times as I want, but the other will not work until I reload the Flex App.
Successful:
[BlazeDS]Serializing AMF/HTTP response
Version: 3
(Message #0 targetURI=/2/onResult, responseURI=)
(Externalizable Object #0 'DSK')
(Externalizable Object #1 'flex.messaging.io.ArrayCollection')
(Array #2)
[0] = (Typed Object #3 'com.group.entity.Group')
appId = 14
admin = 0
userId = null
name = "All"
cmnt = ""
updateId = ""
type = 1
updateDate = "2011-02-13 19:04:26.0"
grpId = 22
[1] = (Typed Object #4 'com.group.entity.Group')
appId = 14
admin = 0
userId = null
name = "Junk"
cmnt = ""
updateId = ""
type = 1
updateDate = "2011-02-15 21:16:16.0"
grpId = 28
[2] = (Typed Object #5 'com.group.entity.Group')
appId = 14
admin = 0
userId = null
name = "TEST5"
cmnt = null
updateId = ""
type = 2
updateDate = "2011-02-04 08:41:23.0"
grpId = 21
1.297822576209E12
Failed
[BlazeDS]Deserializing AMF/HTTP request
Version: 3
(Message #0 targetURI=null, responseURI=/2)
(Array #0)
[0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
source = null
operation = "createUserLinkedGroup"
timestamp = 0
headers = (Object #1)
DSId = "BA0A04ED-B518-B539-8D32-D2B0229B6A6A"
DSEndpoint = "my-amf"
destination = "GroupDao"
body = (Array #2)
[0] = (Object #3)
name = null
updateDate = null
grpId = 28
appId = 14
userId = ""
type = 0
cmnt = null
admin = 2
updateId = null
clientId = null
messageId = "3AA0A73A-DA80-0AE0-FD86-2C42AF0AEEEC"
timeToLive = 0
[BlazeDS]Serializing AMF/HTTP response
Version: 3
(Message #0 targetURI=/2/onStatus, responseURI=)
(Typed Object #0 'flex.messaging.messages.ErrorMessage')
headers = (Object #1)
rootCause = (Typed Object #2 'flex.messaging.messages.ErrorMessage')
headers = (Object #3)
rootCause = null
body = null
correlationId = null
faultDetail = null
faultString = "Cannot convert type flex.messaging.io.amf.ASObject with remote type specified as 'null' to an instance of class com.group.entity.Group"
clientId = null
timeToLive = 0.0
destination = null
timestamp = 1.29782269116E12
extendedData = null
faultCode = "Client.Message.Deserialize.InvalidType"
messageId = "BA0ECE15-D82F-FB38-C928-A17D37B02453"
body = null
correlationId = "3AA0A73A-DA80-0AE0-FD86-2C42AF0AEEEC"
faultDetail = "The expected argument types are (com.group.entity.Group) but the supplied types were (flex.messaging.io.amf.ASObject) and converted to (null)."
faultString = "Cannot invoke method 'createUserLinkedGroup'."
clientId = "BA0ECE15-D80A-19E2-936E-ACB39CA25F34"
timeToLive = 0.0
destination = "GroupDao"
timestamp = 1.29782269116E12
extendedData = null
faultCode = "Server.ResourceUnavailable"
messageId = "BA0ECE15-D819-513C-E9CD-9850697CD5C1"
As you can see from the logs, in the successful transactions the correct 'Group' object was used, but in the failed, its unable to locate the correct object to pass.
Any ideas of where I need to look to understand what I am doing wrong ?
Could this issue be related to the Spring Annotations?
I tried changing my definitions from:
to:Code:@Repository("GroupDao") @RemotingDestination public class GroupDaoImpl implements GroupDao {
and now neither of the services will map to the typed Object and I get the same error returned:Code:@Service("GroupDao") @RemotingDestination public class GroupDaoImpl implements GroupDao {
faultString = “Cannot convert type flex.messaging.io.amf.ASObject with remote type specified as ‘null’ to an instance of class com.group.entity.Group”
Thanks


Reply With Quote
