InstantiationException in WS client for abstract complexType with jax-ws 2.0
Svein Egil Nilsen
posted 5 years ago
Short version: I need to emulate the effect of the @XmlSeeAlso annotation in a jax-ws 2.0 client application. What are my options?
Long version: I'm developing a standalone web service client, using JDK 1.6.0_18 in the development environment.
I have used wsimport (from the JDK) to generate Java classes from a wsdl, and everything works like a charm with the default options.
Unfortunately we are stuck with jax-ws 2.0 (and JDK 1.5/J2EE 1.4) in the production environment, and upgrading is not an option.
wsimport with -target 2.0 results in an InstantiationException in the client when calling the web service.
The problem seems to be an abstract complexType, which of course can't be instantiated.
With -target 2.1 or later an @XmlSeeAlso annotation in the generated WebService-interface in some way ensures that the appropriate concrete subclass is instantiated.
Are there any alternatives to using this annotation?
Is it even possible to call a webservice that returns objects containing references to an abstract complexType using jax-ws 2.0?
Answers will be greatly appreciated!
(I am relatively new to JAX-WS, and have been googling for hours without finding a solution other than upgrading.)