Custom Serialization Issue

My remote method returns a java class and I'm trying to map that my flex class.  The remote method isn't throwing an exception.  That works fine, but on the flex end I get error message of: "faultCode:Server.Acknowledge.Failed faultString:'Didn't receive an acknowledge message' faultDetail:'Was expecting mx.messaging.messages.AcknowledgeMessage, but received null'".

I made sure the classes on both ends are Externalizable. i mapped the flex class to the java class.  Both sides read and write the correct data type. My swf does reference the class, so flex should be able to find it. i can't figure out why I'm getting the error message.

///////////Flex Class//////
package MyData
{
      import flash.utils.IDataInput;
      import flash.utils.IDataOutput;
      import flash.utils.IExternalizable;

      //[Bindable]
      [RemoteClass(alias="com.netcsd.flex.datamodel.ChatRoomData")]
      public class ChatRoom implements IExternalizable
      {
            public var chatRoomId:String;
            public var chatRoomName:String;
            public function ChatRoom()
            {
                  chatRoomId = "";
                  chatRoomName = "";
            }
            
            public function readExternal(input:IDataInput):void{
                  chatRoomId = input.readUTF();
                  chatRoomName = input.readUTF();
            }
            
            public function writeExternal(output:IDataOutput):void{
                  output.writeUTF(chatRoomId);
                  output.writeUTF(chatRoomName);
            }
      }
}

////////////////Java Class///////////
package com.netcsd.flex.datamodel;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class ChatRoomData implements Externalizable {
      private String chatRoomId;
      private String chatRoomName;
      
      public ChatRoomData(){
            chatRoomId ="";
            chatRoomName = "";
      }
      
      public String getChatRoomId(){
            return chatRoomId;
      }
      
      public String getChatRoomName(){
            return chatRoomName;
      }
      
      public void setChatRoomId(String id){      
            chatRoomId = id;
      }
      
      public void setChatRoomName(String name){
            chatRoomName = name;
      }
      
      public void readExternal(ObjectInput in) throws IOException,
    ClassNotFoundException {
            // Read in the server properties from the client representation.
            chatRoomId = in.readUTF();
            chatRoomName = in.readUTF();
    }
      
      public void writeExternal(ObjectOutput out) throws IOException{
            out.writeUTF(chatRoomId);
            out.writeUTF(chatRoomName);
      }
}
wideman1926Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dgofmanCommented:
Comment  [RemoteClass(alias="com.netcsd.flex.datamodel.ChatRoomData")]
in your AS file if you want to use IExternalizable interface,
or you have to specify correct package path if you want to serialize by AMF

[RemoteClass(alias="com.netcsd.flex.datamodel.ChatRoomData")]


0
wideman1926Author Commented:
I've never programmed in flex and am trying to get the communication up and running.  If I want my flex class to be passable as parameter to a java function and my flex code to receive the corresponding java class, do I have to use IExternalizable or can I use AMF?  Whatever the case is: how do I get java and flex to be able to receive each other's classes?
0
dgofmanCommented:
I will recommend transfer between client and server using Beans in this case you don't need to write special code in Java and Flex.
Remeber the rules of the bean.

your APIs/ Function must be public and containts setters and getters on JAVA side!!!

private String message;

public function getMessage():String{
    return message;
}
public function void setMessage(value:String){
    message = value;
}


In ActionScript you should map you java bean path in RemoteClass metatada

and implement setter/getter or use public variable

public var message;

or

private var _message:Stirng;

public function get message():String{
  return _message;
}
public function set message(value:String):void{
   _message = value;
}

Use BlazeDS library configure flex directory in Web-INI and you are set using RemoteObject in the Flex
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

wideman1926Author Commented:
I'll give that a look and get back to you. Thanks.
0
dgofmanCommented:
Hi wideman1926,
Looks like by mistake you accept your question #35245562.
The solution was posted by me #35245693
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wideman1926Author Commented:
led me in the right direction
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.