Personally, I would go with fixing a local copy of the wsdl (either via a
xsd:any or preferably actually defining schemas for the data and using those)
and regenerate the code with the fixed wsdl.
Dan
On Wednesday 24 March 2010 12:41:33 pm Jim Mochel wrote:
> Good Day Folks,
>
> Hopefully you can help me.
>
> I am consuming a wsdl that was incorrectly defined and I need to come up
> with a workaround in CXF.
>
> The server side methods return a "serialized" Dom. They used some mapping
> in axis1 to map the class they are returning to a class called XmlElement,
> which is an empty class.
>
> The end result is that the WSDL shows the methods returning an XmlElement
> class looking like this:
>
> ------------------------------
> ------------------------
> <complexType name="XmlElement">
> <sequence/>
> </complexType>
> ------------------------------------------------------
>
> The CXF code generated from the WSDL correctly creates an XmlElement class
> that is empty:
>
> ------------------------------------------------------
> package com.tt.ws.cxf;
>
> public class XmlElement {
>
> }
> ------------------------------------------------------
>
> So, when the method getLocations() is invoked it correctly returns the
> following response:
>
> ------------------------------------------------------
> <getLocationsReturn xsi:type="ns1:XmlElement" xmlns:ns1="
> http://api.service.timecommerce.timetrade.com/">
> <Locations LicenseeId="997" UserId="1" xmlns="">
> <Location>
> <LocationId>1</LocationId>
> <LocationName>JMochel Test Site</LocationName>
> <LocationURL>jmochel</LocationURL>
> </Location>
> </Locations>
> </getLocationsReturn>
> ------------------------------------------------------
>
> The client code returns the empty XmlElement object.
>
> The official WSDL willl not be changed immediately so I need to come up
> with a way of allowing the CXF code to take the incoming XML returned and
> generate a DOM Element or equivalent.
>
> After digging around I get the hint that some combination of the following
> will get me going in the direction I want
>
> 1. The xsd:any schema element (hand modify the WSDL and regenerate the code
> so that it treats XmlElement as containing xsd:any)
>
> 2. Write custom unmarshalling code and figure out how to hook it in.
>
> 3. Playing with the JAXBContext
>
> Any suggestions for the cleanest solution to this ?
>
> Thank you,
>
> Jim Mochel
--
Daniel Kulp
[email protected]
http://dankulp.com/blog