Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » JAX-WS and type substitution
JAX-WS and type substitution [message #990642] Thu, 13 December 2012 09:56 Go to next message
Daniel Mühlemann is currently offline Daniel Mühlemann
Messages: 2
Registered: December 2012
Junior Member
Dear all

I generated a WebService consumer from WSDL in Scout. The WebMethod I call returns a list of "Vehicle"-objects. When I iterate over the result list and try to cast its elements to the subclass "Car" I get a ClassCastException. I can't even check the type with instanceof.

I could solve the problem in adding the annotation @XmlSeeAlso({Car.class}) to the generated WebService Stub. Unfortunately I lose my changes when I rebuild the WebService Stub.

Is it possible to handle this type substitution automatically?

Best Regards
Daniel
Re: JAX-WS and type substitution [message #990978 is a reply to message #990642] Sat, 15 December 2012 19:42 Go to previous messageGo to next message
Daniel Wiehl is currently offline Daniel Wiehl
Messages: 21
Registered: April 2010
Junior Member
Your are right, the annotation @XmlSeeAlso allows you type substitution for types that are neither directly nor indirectly referenced by the service endpoint.

As this annotation is on only available from JAX-WS 2.1 compliance level and by default Scout SDK generates 2.0 JAX-WS artifacts (meaning that the generated code is compliant for JAX-WS 2.0 specification), you are missing this annotation in your webservice stub.

You can change this version easily on the webservice node in Scout SDK. Simply click on your webservice consumer or provider and open the link 'Edit build properties' in the 'Stub properties' section of your service property page.
There you find the option 'target' with the default value '2.0'. Change this to 2.1 and the @XmlSeeAlso annotation will be generated the next time you rebuild your webservice stub. By the way, those properties directly correspond to the WsImport options used to generate the webservice stub and are stored in the build-jaxws.xml file. So the next time you generate your stub, those options are remembered and you do not have to set them again.
Re: JAX-WS and type substitution [message #991029 is a reply to message #990978] Mon, 17 December 2012 01:30 Go to previous message
Daniel Mühlemann is currently offline Daniel Mühlemann
Messages: 2
Registered: December 2012
Junior Member
Thank you for your reply, it works!
Previous Topic:AbstractSqlService.getSequenceNextval() specific to Oracle
Next Topic:ScoutInfoForm
Goto Forum:
  


Current Time: Thu Apr 17 23:44:28 EDT 2014

Powered by FUDForum. Page generated in 0.01737 seconds