This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

netbeans wsgen ignoring jaxb annotations

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

I am trying to implement a web service that accepts a list of abstract class, and specify the concrete classes with @XmlSeeAlso:

public abstract class Base() {}
public class Phone extends SubClass1() {}
public class Computer extends SubClass2() {}

@WebService(serviceName = "UtbOrder")
@XmlSeeAlso({SubClass1.class, SubClass2.class})
public class UtbOrder
{

/**
* This is a sample web service operation
*/
@WebMethod(operationName = "orderCreate")
public OrderCreateRequest orderCreate(@WebParam() List<Base> orders)
{
return null;
}
}

But the generated WSDL/schema does not include SubClass1, SubClass2, just Base

It looks like wsgen is ignoring these annotations.

What am I doing wrong?

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

I just tried this with a completely clean new web project and got the same result.

package test;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.xml.bind.annotation.XmlSeeAlso;

@WebService(serviceName = "NewWebService")
@XmlSeeAlso({Sub1.class, Sub2.class})
public class NewWebService {

/**
* This is a sample web service operation
*/
@WebMethod(operationName = "hello")
public Base hello() {
return new Sub2();
}
}

public abstract class Base { };


public class Sub1 extends Base{

private String sub1Str;

public String getSub1Str() {
return sub1Str;
}

public void setSub1Str(String sub1Str) {
this.sub1Str = sub1Str;
}
}


public class Sub2 extends Base {

private String sub2String;

public String getSub2String() {
return sub2String;
}

public void setSub2String(String sub2String) {
this.sub2String = sub2String;
}
}





 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And here is the generated code:

package test.jaxws;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import test.Base;

@XmlRootElement(name = "helloResponse", namespace = "http://test/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "helloResponse", namespace = "http://test/")
public class HelloResponse {

@XmlElement(name = "return", namespace = "")
private Base _return;

/**
*
* @return
* returns Base
*/
public Base getReturn() {
return this._return;
}

/**
*
* @param _return
* the value for the _return property
*/
public void setReturn(Base _return) {
this._return = _return;
}

}

 
John Farrel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For those who care:

To get this to work I have had to remove the xendorsed='true' option off the wsgen ant action.

 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic