JAX-WS and annotation overload

I have been utilizing JAX-WS to generate web service clients in my current Grails project. It is the best I have found so far in consuming SOAP-based web services within a Grails project. I do have one beef with the library though: annotation overload! I am not a huge fan of the overuse of annotations that has happened over the last few years. JAX-WS seems to want to take this to a new level. For the most part the annotations do seem to stay out of the way, except for one scenario which we have in many of our XSD schemas: <xsd:any>.

For example, you have defined a complex type where one of the elements is defined to be <xsd:any>, so that different XML documents can be inserted at that element. The problem is that JAX-WS wants to know all of the possible types at compile-time via annotations! If you don’t provide the run-time classe during compile-time, you will end up with a message liek this when you attempt to marshall the XML:


class example.package.MyType nor any of its super class is known to this context

This breaks all of the abstraction and defining the implementation at run-time. I have not found a simple way to get around this and still add classes to the JAXBContext like I used to be able to do. We have been able to work with it for the most part, but if anyone know of an easy way to add classes to the JAX-WS JAXBContext at run-time, feel free to let me know!

This entry was posted in Grails and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.