The XmlSeeAlso was definitely designed for this. That said, we do have a "legacy" way to add classes to the JAXBContext that we use left over from JAXB 2.0 days (XmlSeeAlso was added in 2.1).
If you look in: https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml You can see some spring config for adding some additional classes to the JAXB context. You could probably do something similar to get your additional packages and stuff added in. Dan On Wednesday 13 August 2008 8:09:02 am Jack Nuzbit wrote: > Thanks for your replies. > > Or is the problem that you're trying to provide raw XML and CXF is > escaping it instead including it? For the later, I think that you might > need more traffic with JAXB or Aegis. > > This was exactly the problem. I thought you couldn't provide raw xml in a > string element. Surely this makes it invalid? > > I tried the @XmlSeeAlso which was exactly what i was looking for, although > i'm using cxf to generate my service so I ended up adding the xsds as > imports to the original wsdl. Unfortunately here I ran into another > problem. It turns out the the xsds use the same namespace and have > conflicting elements. aaaarggghh. > > I've come across a solution of sorts but it's far from ideal. I'm now > setting the processContents="skip" attribute which means i can provide an > Element to my Request object and manually marshal the object to a dom > element. > > <xs:element name="Request"> > <xs:complexType> > <xs:sequence> > <xs:any processContents="skip"></s:any> > </xs:sequence> > </xs:complexType> > </xs:element> > > And the marshalling code: > > JAXBContext context = JAXBContext.newInstance("some.package"); > Marshaller marshaller = context.createMarshaller(); > > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); > dbf.setNamespaceAware(true); > Document doc = dbf.newDocumentBuilder().newDocument(); > marshaller.marshal( innerRequest, doc ); > > Request request = new Request(); > request.setAny(doc.getDocumentElement()); > > My innerRequest object is generated from the xsd using jaxb by the way, > this way i can seperate the various xsd objects into different packages but > keep the namespaces. > > As i said, I think this solution is far from ideal so any pointers would be > great. The reason I'm using cxf is for the wsdl2java maven plugin. > > Cheers, > > > Jack > > On Tue, Aug 12, 2008 at 8:40 PM, Daniel Kulp <[EMAIL PROTECTED]> wrote: > > With the JAXB 2.1/JAX-WS 2.1 stuff, you should be able to add something > > like: > > > > @XmlSeeAlso({some.package.Request.class}) > > > > to the SEI or Impl and that would add that class to the JAXBContext. > > Actually, if that package has an ObjectFactory, it's best to do: > > @XmlSeeAlso({some.package.ObjectFactory.class}) > > > > > > Dan > > > > On Tuesday 12 August 2008 3:25:31 pm Jack Nuzbit wrote: > > > Hi Folks, > > > > > > I have a wsdl with some top level string elements. I've also got a heap > > > > of > > > > > xsd's defining the the rest of the service which are supposed to go in > > > these top level string elements. > > > Cxf does exactly what it should do when i give the raw xml to the top > > > > level > > > > > string elements and replaces the characters with valid xml entities, > > > > which > > > > > the service won't accept. > > > > > > So I'm modifying the wsdl to create a valid service and I've switched > > > the string elements to xs:any elements but now i'm running into the > > > > Marshalling > > > > > error. > > > org.apache.cxf.interceptor.Fault: Marshalling Error: class > > > some.package.Request nor any of its super class is known to this > > > context. > > > > > > > > > Does anyone know how i provide cxf with the details to marshal the > > > > objects > > > > > created in the seperate xsds (which are in seperate packages)? > > > Manually using a JAXBContext i can do this but i don't know how to > > > > provide > > > > > the package details to cxf. > > > > > > JAXBContext context = JAXBContext.newInstance("some.package"); > > > Marshaller marshaller = context.createMarshaller(); > > > > > > > > > Any ideas would be greatly welcomed? > > > > > > Cheers, > > > > > > > > > Jack > > > > -- > > Daniel Kulp > > [EMAIL PROTECTED] > > http://www.dankulp.com/blog -- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog
