fxml vs amf vs json, json questions

29 views
Skip to first unread message

Larry Erickson

unread,
Feb 9, 2011, 2:48:17 AM2/9/11
to restfulx-framework
Looking to improve my applications speed and have been playing around
with speed differences between fxml, json, and amf.

My app needs to initially index about 15 fairly large models, and
after that it pretty much constantly receives push messages from the
juggernaut push server.

I have made all my controllers capable of returning fxml, json, or
amf. From flex I can successfully initially index my models in either
fxml or amf, but am am struggling with json. When getting my index
call via json, I get errors.

ApplicationController.initialize([JSONHTTPServiceProvider,
AMFServiceProvider]); // works and returns all as fxml
ApplicationController.initialize([JSONHTTPServiceProvider,
AMFServiceProvider], AMFServiceProvider.ID); // works, all as amf
ApplicationController.initialize([JSONHTTPServiceProvider,
AMFServiceProvider], JSONHTTPServiceProvider.ID); //fails and returns

TypeError: Error #1009: Cannot access a property or method of a null
object reference.atorg.restfulx.controllers::CacheController/index()[/
Users/Dima/Projects/riadrom/restfulx_framework/framework/src/org/
restfulx/controllers/CacheController.as:
93]atorg.restfulx.services::ServiceResponder/result()[/Users/Dima/
Projects/riadrom/restfulx_framework/framework/src/org/restfulx/
services/ServiceResponder.as:120]at Function/<anonymous([/Users/Dima/
Projects/riadrom/restfulx_framework/framework/src/org/restfulx/
services/http/XMLHTTPServiceProvider.as:
406]atflash.events::EventDispatcher/
dispatchEventFunction()atflash.events::EventDispatcher/
dispatchEvent(flash.net::URLLoader/onComplete()

Is there anything else special I have to get JSON going?
Based on my findings, json is faster than amf or fxml on the rails
end, does that make sense?
I want my app to load as fast as possible, which format should i be
using? I know there have been threads on this before, just wondering
if anyone has any new findings.

In regards to using the juggernaut push server to push data to flex,
it appears that juggernaut does not allow the pushing of amf. Is
there a workaround for that?

I am having problems unmarshalling the results of a json message. It
appears to be pushing fine from rails. I successfully unmarshall a
push message sent via fxml by doing the following.

private function onServerPush(event:ServerPushEvent):void {
var unmarshalled:RxModel =
Rx.serializers.xml.unmarshall(event.message) as RxModel;
Rx.models.cache.update(unmarshalled, XMLHTTPServiceProvider.ID as
IServiceProvider);
}

I am trying to change this to accept json and so I did

var unmarshalled:RxModel = Rx.serializers.vo.unmarshall(event.message)
as RxModel;
Rx.models.cache.update(unmarshalled, JSONHTTPServiceProvider.ID as
IServiceProvider);

but this gave me the error

Error: could not unmarshall provided object:ReferenceError: Error
#1069: Property id not found on String and there is no default value.
at org.restfulx.serializers::VOSerializer/unmarshallObject()[/Users/
Dima/Projects/riadrom/restfulx_framework/framework/src/org/restfulx/
serializers/VOSerializer.as:98]

Should I be doing something differently here?

Is there any reason to believe pushing and unmarshalling json will be
better than fxml?

In the end I think the best solution is going to be to initially load
with amf, and then push with json. Does anyone have any opinion on
that being a good or bad solution?

Thanks for any help given.

Larry


Reply all
Reply to author
Forward
0 new messages