开发者

remote implementation for HTTPService in flex

In my flex application 开发者_开发百科I am using httpService to connect to the server, for the response from server I wanted it to convert the http response to flex object, Is there any remote implementation availabe for the above purpose


to augment earlier post, it depends on what you are sending from the server side. If you are using HTTPService then it is ideally a XML document (RestFul style). Based on the result format set to the service object, flex tries to convert it to that type of result by mapping XML to other type of flex object. most useful result formats in this case would be object (default), e4x, xml. for more information you need to see ASDoc.

if the payload of your HTTP is custom object which is directly serialized on server side (not to xml), then it is pretty hard to re-construct that object on flex side.

IF you payload is String or any other format which you want to parse manually then set the result format to "text" which will return you a string and you can process it later.


If you want flex to automatically convert the result data from XML to object use:

<mx:HTTPService url="http://theserver.com"
                     resultFormat="object"/>

or in case you use only actionscript

var service:HTTPService;
service.resultFormat = "object";

This should be the default behaviour when no resultFormat is specified. You might also want to check the "array" result format as it behaves a bit different.

HttpService.resultFormat

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜