3
我認爲這應該很容易,但我真的無法使它工作。返回Pojo WebService JaxWS。重命名<return>節點
我回一個POJO,從一個WebMethod:
@WebMethod
public SubCategoria getSubCategorias() throws JAXBException {
SubCategoria a = subCategoriaEJB.getAllSubCategorias().get(1);
return a;
}
我只是在第一個,試試。
我使用soapUI來測試我的Ws。
的迴應是:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getSubCategoriasResponse xmlns:ns2="http://webService/">
<return>
<categoria>
<descripcion>Categoria Unica</descripcion>
<idCategoria>1</idCategoria>
</categoria>
<descripcion>asd123213</descripcion>
<idSubCategoria>2</idSubCategoria>
</return>
</ns2:getSubCategoriasResponse>
</S:Body>
</S:Envelope>
我想要的 「迴歸」 節點被稱爲 「SubCategoria」。我無法真正使它與XmlRootElement註釋一起工作。
這裏我POJO的(SubCategoria)
package ejb.Entidades;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@XmlRootElement(name="SubCategoria")
public class SubCategoria {
@Id
private Integer idSubCategoria;
@ManyToOne
private Categoria categoria;
private String descripcion;
public Integer getIdSubCategoria() {
return idSubCategoria;
}
public void setIdSubCategoria(Integer idSubCategoria) {
this.idSubCategoria = idSubCategoria;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Categoria getCategoria() {
return categoria;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
}
有人有線索?
在此先感謝。
Tibtof,THX。對不起,回答這麼晚。我正在旅行並停止在這個項目中工作。乾杯。 –