• Post Reply Bookmark Topic Watch Topic
  • New Topic

netbeans wsgen ignoring jaxb annotations  RSS feed

 
John Farrel
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • 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: 93
  • Mark post as helpful
  • send pies
  • 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: 93
  • Mark post as helpful
  • send pies
  • 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: 93
  • Mark post as helpful
  • send pies
  • 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.

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!