抽象クラスを書きました
import javax.xml.bind.annotation.*;
public abstract class Parent
{
@XmlAttribute(name = "one")
public String getOne() { return "one";}
}
および2つの派生クラス:
import javax.xml.bind.annotation.*;
@XmlRootElement(name="child1")
public class Child1 extends Parent
{
@XmlAttribute(name = "two")
public String getTwo() { return "2";}
}
import javax.xml.bind.annotation.*;
@XmlRootElement(name="child2")
public class Child2 extends Parent
{
@XmlAttribute(name = "three")
public String getThree() { return "3";}
}
および@webservice:
import javax.xml.ws.Endpoint;
import javax.jws.*;
import java.util.*;
@WebService(serviceName="MyServerService", name="MyServer")
public class MyServer
{
private int count=0;
@WebResult(name="test")
@WebMethod
public Parent getOne() { return ++count%2==0?new Child1():new Child2();}
public static void main(String[] args) {
Endpoint.publish(
"http://localhost:8080/path",
new MyServer());
}
}
wsgenを使用してコードを生成すると、結果のXMLスキーマには抽象クラスParentの定義のみが含まれ、 Child1またはChild2の定義は含まれません。2つの具象クラスの定義を生成するようにwsgenに指示する方法はありますか?
ありがとう、