axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Daniels" <gdani...@macromedia.com>
Subject Re: Not exposing domain objects to the client
Date Mon, 29 Oct 2001 01:33:39 GMT
Hi Veerappan!

> I have a requirement where my webservice accepts domain objects as method
> parameters.
>
> An example method on the webservice would be
>
> createUser(User aUser);
>
> Can I not expose the User object to the client and still let him call this
> method. In other words, I woud like the user to pass me an xml
> representation of my User object in his client calls. On the server side I
> can convert his xml to a java object using castor xml.
>
> In short, I don't want to expose my domain objects, at the same time I
don't
> want to create a wrapper class to my webservice that accepts xml
parameters.

Sounds like you want to have your cake and eat it too. :)

There's no way to do what you want now, but I could see parts of this being
pretty simple to add.  You could even write it if you wanted (and then
contribute it back to Axis - hint hint :)).  It would just involve building
a Serializer for an org.w3c.dom.Element that writes the DOM element out to
the XML stream directly (via SerializationContext.writeDOMElement()).

That would take care of the client side (i.e. here's the XML I want you to
insert, just do it).  On the server, it sounds like what you want is a
little trickier.  Essentially it's the same pattern, but you'd need to hook
in a Deserializer for the type QName associated with your User type which
then passes off the SAX events to castor (or builds a DOM out of it and
hands that to castor) to get the actual Object.  That's doable, but hairier.

--Glen



Mime
View raw message