Hmm..... that XmlSeeAlso annotation will actually create potential problems.
If they are "shared" so the annotation looked like:
@XmlSeeAlso({Bike.class, Car.class})
The JAXBContext created for BOTH services would know about both classes.
Potentially, that could allow a user to send in a "Car" where only a "Bike"
is expected or similar as the JAXBContext would know how to deserialize it.
Possibly not a huge deal.
Anyway, the "normal" way to do this would be to use the jaxb xjc tool to
compile all the schemas as once. Then use a jaxb binding customization file
when you run wsdl2java to tell it not to generate the classes for those
namespaces. ("schemaBinding skip=true" if I remember correctly)
Dan
On Wednesday 28 January 2009 4:16:56 pm kneumei wrote:
> I have a situation that can be represented by this scenario:
> * I have two wsdls. One contains a webservice interface for ordering
> Bikes. It references an XSD that describes my Bike object. The other
> contains a webservice interface for ordering Cars. It references an XSD
> that describes my Car object.
> * Both of my two xsds (Bike.xsd and Car.xsd) reference a third xsd that
> describes a Vehicle.
> * Bike and Car both extend Vehicle.
>
> When I use wsdl2java to generate my web service for the Bike WS, I get a
> nice object hierarchy where Bike subclasses Vehicle. The Vehicle class has
> a JAXB annotation like this:
> @XMLSeeALso({Bike.class})
>
> Similarly when I use wsdl2java on the carws.wsdl, My car object extends
> Vehicle and Vehicle has a JAXB annotation pointing to Car.class.
>
> My problem is that I want the Vehicle class to be shared between both Car
> and Bike. I know I could hand edit the file after I generate it, but I'd
> like to avoid that if possible. Is there a solution for this? I was
> originally looking for a solution where I could pass in both wsdls at the
> same time, but it didn't look like that was possible. I appreciate any
> help.
--
Daniel Kulp
[email protected]
http://dankulp.com/blog