You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jim Mochel <ji...@gmail.com> on 2010/03/24 15:24:17 UTC
Using slightly broken WSDL
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
Re: Using slightly broken WSDL
Posted by Jim Mochel <ji...@gmail.com>.
Daniel,
It worked like a charm.
I ran into trouble doing that with Axis 2 so I didn't try the same solution
in CXF.
Thank you for responding quickly and for all of the work you do on the CXF
stack!
- Jim
On Wed, Mar 24, 2010 at 5:25 PM, Daniel Kulp <dk...@apache.org> wrote:
>
> 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
> dkulp@apache.org
> http://dankulp.com/blog
>
Re: Using slightly broken WSDL
Posted by Daniel Kulp <dk...@apache.org>.
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
dkulp@apache.org
http://dankulp.com/blog
Using slightly broken WSDL
Posted by Jim Mochel <ji...@gmail.com>.
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