Re: custom xmlrpc marshallers



Alexander Larsson <alexl redhat com> writes:

> I added some highly magic code that lets you register marshallers and
> demarshallers for custom type for the XmlRpcHandler.
> 
> Check out ActiveTopic for an example of how to use it. With that i can
> just define xmlrpc handler methods like:
> 
>   public Vector getLiveComment(ActiveTopic topic, int commentId) {
> 
> The conversion from the topic long id (which is passed as a string due
> to 64bit ints parameters not being in xmlrpc) to the looked up
> ActiveTopic is magically handled in the lower layers.

This is really cool!!  We used it to add the chat feature today.

One issue we ran into was that it doesn't seem to recursively convert
types.  For example, we returned a class (hashtable) with a Vector as an
element.  That Vector contained classes, which were not auto marshalled.
We had to call something like:

  Vector marshalledMessages = new Vector();
  for (int i = 0; i < messages.size(); i++) {
          Message msg = (Message) messages.get(i);
          marshalledMessages.add(msg.marshalToHash());
  }

by hand to convert it over in our marshal call.  


Alex, do you think it would be a lot of work to extend it to handle
this?  Is it worth looking into?

Thanks,
-Jonathan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]