Assuming calling the same ColdFusion web service and all other factors are identical, is there a difference in performance/speed between using the following two tags?
<s:RemoteObject id="MyService" destination="ColdFusion" source="MyWSFolder.MyService"/>
and
<s:WebService id="MyService" wsdl="http开发者_如何学运维://www.myDomain.com/MyWSFolder/MyService.cfc?wsdl"/>
Thanks in advance,
Monte
How do you quantify performance?
The WebService tag is used for calling a SOAP WebService. SOAP requests are very wordy, causing a larger amount of data to be passed back and forth than if you were using AMF. IF using WebService, you'll also have to write parsing code in the Flex client to make the data useful.
The RemoteObject tag is used for making AMF calls over a Flash Remoting gateway. AMF is a binary fomat and has shown to give much smaller file sizes for data transport between the server and Flash. AMF also provides some built in conversion of server side data types (CFCs) to client side data types (AS3 objects).
You should check out James Ward's census application for some performance comparisons.
If you're using ColdFusion as your backend, it would be foolish to use WebService instead of RemoteObject for a flex front end. I you need to support SOAP clients with your services, the very same CF code can be used to expose a SOAP Web Service as a RemoteObject interface w/o any code changes on your end.
If I remember correctly (and you'll want to confirm this, because I may be wrong) a WebService is specifically designed to work over HTTP with SOAP. It's like a strictly-typed HTTPRequest.
RemoteObject, however, uses AMF for its transfer - meaning you're not sending headers back and forth, you're essentially creating a binary stream of whatever you're transferring. This is supposed to be much faster, if I remember correctly. I tend to work with RemoteObject over WebService whenever I can because then I don't need to mess with SOAP. Plus with RemoteObject you can do Class mapping, so for instance you have strongly typed value objects coming back from PHP and your application can know exactly what time your data conforms to.
精彩评论