title: Explicity mapping between ActionScript and Java objects for the BlazeDS Messaging Service
body: <p>The BlazeDS documentation shows how to explicitly map between ActionScript and Java objects. For example, this works fine for RPC services, e.g.</p>
  
  <pre><code>import flash.utils.IExternalizable;
  import flash.utils.IDataInput;
  import flash.utils.IDataOutput;
  
  [Bindable]
  [RemoteClass(alias="javaclass.User")]
  public class User implements IExternalizable {
  
      public var id : String;
      public var secret : String;
  
      public function User() {
      }
  
      public function readExternal(input : IDataInput) : void {
          id = input.readObject() as String;
      }
  
      public function writeExternal(output : IDataOutput) : void {
          output.writeObject(id);
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>import java.io.Externalizable;
  import java.io.IOException;
  import java.io.ObjectInput;
  import java.io.ObjectOutput;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.Set;
  
  public class User implements Externalizable {
  
      protected String id;
      protected String secret;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getSecret() {
          return secret;
      }
  
      public void setSecret(String secret) {
          this.secret = secret;
      }
  
      public void readExternal(ObjectInput in) throws IOException,
              ClassNotFoundException {
          id = (String) in.readObject();
      }
  
      public void writeExternal(ObjectOutput out) throws IOException {
          out.writeObject(id);
      }
  }
  </code></pre>
  
  <p>If I called an RPC service that returns a <code>User</code>, the <code>secret</code> is not sent over the wire.</p>
  
  <p>Is it also possible to do this for the messaging service? That is, if I create a custom messaging adapter and use the function below, can I also prevent <code>secret</code> from being sent?</p>
  
  <pre><code>MessageBroker messageBroker = MessageBroker.getMessageBroker(null);
  AsyncMessage message = new AsyncMessage();
  message.setDestination("MyMessagingService");
  message.setClientId(UUIDUtils.createUUID());
  message.setMessageId(UUIDUtils.createUUID());
  User user = new User();
  user.setId("id");
  user.setSecret("secret");
  message.setBody(user);
  messageBroker.routeMessageToService(message, null);
  </code></pre>