Flex三種通信方式
表1-1
通信方式 |
通信協議 |
交互數據格式 |
HttpService |
常用的http 協議 |
XML |
WebService |
SOAP 協議 |
XML |
RemoteObject |
Flex 自定義的高效二進制 數據通訊協議:AMF |
任意(可以是數字,字符串,對象,圖片等等) |
這三種通信方式的比較如下:
表1-2
通信方式 |
優點 |
缺點 |
HttpService |
數據格式通用,便於不同應用系統間交換數據 |
1. 數據在發送前需要轉換成XML 格式,接收後要解析XML 數據。哪怕是隻發送一個簡單的的數字也要如此 2. 在處理複雜數據類型如圖片,對象的時候,非常不方便 |
WebService |
同上 |
同上 |
RemoteObject |
能夠處理各種類型的數據類型,速度快 |
需要專門的服務器端軟件LCDS (FDS )或AmfPHP 。LCDS (FDS )是收費的,價格不菲(免費版本只能支持單CPU) |
BlazeDS是Opensource,也就是就免費讓你使用,LCDS是Adobe需付費的方案,什麼情況下會需要使用LCDS呢?
想清楚得知BlazeDS的Spec可以到這裏http://opensource.adobe.com/wiki/display/blazeds/Features
而LCDS的功能列表可以從這裏看,http://www.adobe.com/products/livecycle/dataservices/features.html
下圖是Adobe官方的Blazeds與LCDS的對比
√ 代表此功能可用
Features |
BlazeDS |
LCDS |
Data management Services | ||
Client-Server synchronization | √ | |
Conflict resolution | √ | |
Data paging | √ | |
SQL adapter | √ | |
Hibernate adapter | √ | |
Document Services | ||
LiveCycle remoting | √ | |
RIA-to-PDF conversion | √ | |
Enterprise-Class Flex application services | ||
Data access/remoting | √ | √ |
Proxy service | √ | √ |
Automated testing support | √ | |
Software clustering | √ | √ |
Web tier compiler | √ | |
Enterprise Integration | ||
WSRP generation | √ | |
Ajax data services | √ | √ |
Flex-Ajax bridge | √ | √ |
Runtime configuration | √ | √ |
Open adapter architecture | √ | √ |
JMS adapter | √ | √ |
Server-side component framework integration | √ | √ |
ColdFusion integration | √ | |
Offline Application Support | ||
Offline data cache | √ | |
Local message queuing | √ | |
Real - Time Data | ||
Publish and Subscribe messaging | √ | √ |
Real -time data quality of service | √ | |
RTMP tunneling | √ |