The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Control Over JAXBContext in JAX-WS RI/Metro

Posted by jitu on August 29, 2008 at 4:20 PM PDT
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.
Comments
Comments are listed in date ascending order (oldest first)

Hi , I was looking on having our own prefix for namespaces in WSDL generated request and response objects. Can we achieve this using this feature. If so ca you provide me with some study material or samples on this. Thanks.

Great! I was waiting eagerly for this feature. Thanks a lot