1

I am trying to do a simple Flex AMF call to a ColdFusion server via BlazeDS. Using a RemoteObject, I am trying to send a login request to the server, and responding with success or failure. For some reason, when the data gets to BlazeDS, the body of the message gets dropped during deserializaion(I think). Here is my ColdFusion/BlazeDS log code and the CFC and Flex ActionScript call.

Any and all help is appreciated. Thank!

[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>
mbseid
  • 1,044
  • 10
  • 18
  • It's turning those parameters into an Array. That doesn't seem right. Also the values are uppercase'd. Is that what you are passing from the Flex side? What is the "username" object on the Flex side? Just a string? – James Ward Mar 25 '11 at 15:53
  • Please provide the Flex code that sends the object. – J_A_X Mar 25 '11 at 18:40
  • @James, yeah the values being passed from flex are just two strings. For the tests I set up, I just sent the test strings "Username" and "Password" for each of the respective fields. In the RemoteObject arguments, username and password are just strings. I put them into an object because that is how I was instructed to pass variables through a RemoteObject call. Does that make sense? Thanks for the help! – mbseid Mar 25 '11 at 18:54
  • @J_A_X here is my code that sends the object: ` public function authenticate(username:String, password:String):void { remoteUserService.authenticateUser({username:username, password:password}); } ` – mbseid Mar 25 '11 at 18:55
  • It's still weird that the data is getting to the server as an Array. Try to create a typed value object in ActionScript that has those properties on it, and send that object instead of the plain object. – James Ward Mar 26 '11 at 15:38
  • Yeah, I can't quite figure out why it is doing that. I just tried to create typed value object(I think) and it is still passing it as an array. I posted the new object all related methods in a new pastebin. [link](http://pastebin.com/fVcENjgu) Let me know if this is what you meant. The same error is still occurring. Its just boggling my mind. Thanks for the continued help James. I am just stumped. Almost want to start over and just scrap it :( – mbseid Mar 26 '11 at 22:05

1 Answers1

1

Why not pass the credentials across as two strings instead of creating an object? That way they will show up in your arguments scope in CF. Alternatively you can package then in a data transfer object but that seems like overkill for this.

  • 1
    After working with Nic, We discovered that I was trying to use ColdSpring Singletons to communicate with flex. This is not possible, as each HTTP request creates a new instance of the CFC. Coldspring will not allow this and that is why the AMF fails. Now I have a remoteProxy that passes the request to the service and everything works great. Thanks! – mbseid Apr 03 '11 at 19:28