The Source for Java Technology Collaboration
User: Password:



Jitendra Kotamraju

Jitendra Kotamraju's Blog

Control Over JAXBContext in JAX-WS RI/Metro

Posted by jitu on August 29, 2008 at 04:20 PM | Comments (0)

Finally, this RFE Issue 282 : Control Over JAXBContext Creation is resolved. This means an application can configure its own JAXBRIContext for an endpoint or a proxy and JAX-WS RI runtime uses that context for (un)marshalling, WSDL generation etc. It is implemented as a custom WebServiceFeature. See Rama's blog on using custom feature. Looks like, I cannot live without this extension. All the features like SchemaValidation, StreamingAttachment etc. are exposed using this extension.

Thanks to Kohsuke who created @UsesJAXBContext feature(after many reminders!! yeah, yeah he is busy with many other things like hudson, Brazil trip!!). Basically, this feature provides a JAXBRIContext that needs to be used in the runtime. Here is an endpoint sample that uses this feature:

@WebService
@UsesJAXBContext(ServerJAXBContextFactory.class)
public class EchoImpl {
    ...
}

public class ServerJAXBContextFactory implements JAXBContextFactory {
    public JAXBRIContext createJAXBContext(...) throws JAXBException {
    ...
    }
}
I added two test cases: custom_client_jaxbcontext, custom_server_jaxbcontext. Both these test cases create their own JAXBRIContext to do type substitution(but doesn't use @XmlSeeAlso). I think that it is also possible to influence (Un)Marshallers that are used by JAX-WS RI runtime using this feature. Try the 2.1.x nightly and let us know your feedback. The feature will be part of JAX-WS RI 2.1.5/Metro 1.4.

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds