• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JAXWS can not add additional classes

 
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to generate a webservice client in eclipse. I have developed a Web Service with jax ws and everything works fine except for the following.

My dto are inherited like this.

class Block
class Image extends Block
class Table extends Block
....
....

The web service method returns Block and I check instance of in my client. The problem is that the Image class is not included in the wsdl since the webservice method returns the class Block. How can I include the Image, Table in the generated classes.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried

@XmlSeeAlso({Image.class, Table.class}) but that does not work.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tjena!
Have you tried to define all the types in the XML schema and use XML inheritance, like in the following example:

In the example, the type Policeman extends the type Person. If you then use the JAXB binding compiler (XJC), which is automagically used when you invoke wsimport to generate client artifacts, then you will get a Policeman class that extends a Person class.
Best wishes!
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!

But I thought that I could do this without the wsdl. I use jax-ws annotations.
I use the spring-xfire to make the magic happen. Is there anyway I can include classes with annotations?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mathias Nilsson wrote:
But I thought that I could do this without the wsdl. I use jax-ws annotations.
I use the spring-xfire to make the magic happen. Is there anyway I can include classes with annotations?



XML schemas can still be used, without having to be included in a WSDL, to generate JAXB bean classes for the request and response.
I personally prefer to write an XML schema and generate the JAXB classes using XJC, but of course you can do it the other way too, but I have no experience with that approach.
Here is what I would do if I were in your situation (if I wanted to do bean-classes-first development):
- Write an XML schema that comes relatively close to the data model you have now.
- Use XJC to generate JAXB bean classes from the XML schema.
- See how the JAXB bean classes are annotated with JAXB annotations and try to apply this to my existing classes.
- Annotate the method(s) I want to use my custom request and/or response beans with RequestWrapper and/or ResponseWrapper annotations.
Best wishes!
 
We can walk to school together. And we can both read this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic