@XmlRootElement で注釈が付けられたエンティティがあります
@XmlRootElement(name = "Customer")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = { "id", "name", "surname", "type" })
@Entity
public class Customer extends AbstractEntity {
@Id
private long id;
private String name;
private String surname;
private Type type;
public ResponseDTO() {
this("Default", "Default");
}
public ResponseDTO(String name, String surname) {
this.name = name;
this.surname = surname;
this.type = new Type("120");
}
@XmlElement(name = "id")
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@XmlElement(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement(name = "surname")
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
@XmlElement(name = "type")
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
}
Web サービス応答でエンティティを使用する場合、名前は SOAP 応答@XmlRootElement(name="Customer")
のデフォルトのルート要素をその名前でオーバーライドし<return></return>
ます@XmlRootElement(name="Customer")
。を追加する@WebResult(name="Cust")
と、名前で上書きされます。
@Remote
@WebService
public interface CustomerWS{
@WebMethod(operationName="getCustomerByNumber")
@WebResult(name = "Cust")
public Customer getCustomerByNumber(@WebParam(name="customerNumber") Long customerNumber);
}
これが起こっている理由は何ですか?