users@jax-ws.java.net

Marshalling custom classes

From: Kaleb Pederson <kibab_at_icehouse.net>
Date: Thu, 20 Jul 2006 15:20:17 -0700

Hello,

I'm just starting out with web services using JWSDP and am trying to
figure out how to marshall data that JAXB doesn't recognize by default.
I guess that this really falls into two different questions.

1) How can I tell the web service that this object type has a custom
marshaller?

2) Are there any restrictions that I need to be aware of when I write
the marshaller?

Here is an example of (1):

import java.security.SecureRandom;
public class MyObject {
        public SecureRandom r;
}

Now, say that I want to send this across the to the client after it's
been marshalled.

I can probably come up with a mapping from the SecureRandom object to
XML (maybe just carry the seed across or something) and vice-versa, but
I'm not sure how to integrate that directly with JAX-WS (or do I have to
send it across as a string and then have the client stub manually
unmarshall it)?

I hope I'm not too far off on the wrong track, but if I am, please point
me in the right direction.

Thanks.

--Kaleb