我想通過BlazeDS做一個簡單的Flex AMF調用到ColdFusion服務器。使用RemoteObject時,我試圖向服務器發送登錄請求,並以成功或失敗的方式進行響應。出於某種原因,當數據到達BlazeDS時,消息正文在反序列化過程中被丟棄(我認爲)。這是我的ColdFusion/BlazeDS日誌代碼以及CFC和Flex ActionScript調用。AMF正文下降反序列化
任何和所有的幫助表示讚賞。謝謝!
[BlazeDS]Channel endpoint my-cfamf received request.
[BlazeDS]Deserializing AMF/HTTP request
Version: 3
(Message #0 targetURI=null, responseURI=/3)
(Array #0)
[0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
source = "service.UserService"
operation = "authenticateUser"
destination = "ColdFusion"
timestamp = 0
headers = (Object #1)
DSEndpoint = "my-cfamf"
DSId = "883A97CF-4A08-0B8E-9056-1BF562A40EB4"
body = (Array #2)
[0] = "Username"
[1] = "Password"
clientId = null
messageId = "D1743AB9-54B8-E73C-85C7-E990DE7F1ECE"
timeToLive = 0
[BlazeDS]Before invoke service: remoting-service
incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage)
operation = authenticateUser
clientId = 883AAF5D-900B-410A-1E8B-3B3FBD6552A6
destination = ColdFusion
messageId = D1743AB9-54B8-E73C-85C7-E990DE7F1ECE
timestamp = 1300998708880
timeToLive = 0
body = null
hdr(DSId) = 883A97CF-4A08-0B8E-9056-1BF562A40EB4
hdr(DSEndpoint) = my-cfamf
-- Flex
remoteUserService = new RemoteObject;
remoteUserService.destination = "ColdFusion";
remoteUserService.source = "service.UserService";
remoteUserService.authenticateUser.addEventListener("result", authenticate_requestComplete);
remoteUserService.authenticateUser.addEventListener("fault", authenticate_requestFailure);
remoteUserService.authenticateUser({username:username, password:password});
-- ColdFusion
<cffunction name="authenticateUser" access="remote" returnType="Struct">
<cfargument name="username" type="string">
<cfargument name="password" type="string">
<cfset ret = getAuthenticationService().authenticate(username, password) />
<cfreturn ret>
</cffunction>
它將這些參數變成一個數組。這看起來不正確。這些值也是大寫的。這是你從Flex方面傳遞的嗎?什麼是Flex端的「用戶名」對象?只是一個字符串? – 2011-03-25 15:53:05
請提供發送該對象的Flex代碼。 – 2011-03-25 18:40:08
@詹姆斯,是從flex傳遞的值只是兩個字符串。對於我設置的測試,我只是爲每個相應的字段發送測試字符串「用戶名」和「密碼」。在RemoteObject參數中,用戶名和密碼只是字符串。我把它們放到一個對象中,因爲這是我被指示通過RemoteObject調用傳遞變量的方式。那有意義嗎?謝謝您的幫助!這裏 – mbseid 2011-03-25 18:54:43