Page 1 of 1

About Question enthuware.ocejws.v6.2.83 :

Posted: Fri Oct 03, 2014 3:01 pm
by jaderss
I would like some more explanation about the error in the last option, with JAXBContext. Thanks

Re: About Question enthuware.ocejws.v6.2.83 :

Posted: Sun Oct 05, 2014 2:21 am
by fjwalraven
Hi,

Thank you for your question. Although the last option seems logical to create a JAXB context out of a SOAPMessage:

Code: Select all

 JAXBContext jaxbcontext = JAXBContext.newInstance("SOAPMessage");
it doesn't work out of the box.

The problem here is that the SOAPMessage class doesn't have the JAXB annotation @XmlRootElement. Apart from that the JAXBContext.newInstance() method should be used like this:

Code: Select all

// The JAXBContext instance is initialized from a list of colon separated Java package names. 
// Each java package contains JAXB mapped classes, schema-derived classes and/or user annotated classes.
JAXBContext.newInstance( "com.acme.foo:com.acme.bar" ) 

// The JAXBContext instance is intialized with class(es) passed as parameter(s) and classes 
// that are statically reachable from these class(es)
JAXBContext.newInstance( com.acme.foo.Foo.class ) 
Regards,
Frits

Re: About Question enthuware.ocejws.v6.2.83 :

Posted: Wed Nov 26, 2014 10:07 pm
by blacksnow666
is there a sample full method with JAXBContext?

Re: About Question enthuware.ocejws.v6.2.83 :

Posted: Thu Nov 27, 2014 4:09 pm
by fjwalraven
This thread viewtopic.php?f=40&t=2500&hilit=jaxbcontext describes the example with the jaxbcontext.