[英]Soap web service not getting published for Custom Object return type in Java
我正在寫一個肥皂網絡服務。 我有一個應該返回自定義對象ResultDto的方法。 當我將其添加為方法的返回類型時,wsdl文件不會生成。 但是當我將返回類型保留為String時,它可以正常工作。 這是什么問題? 如何返回自定義對象。
@WebService
public interface Transaction {
@WebMethod(action="createPurchase", operationName = "purchase")
ResultDto purchase(String partyId, String dealId); --> This does not work
String purchase(String partyId, String dealId); --> This works
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResultDto")
public class ResultDto {
public String status;
public String errorMessage;
public int errorCode;
// Getterrs and setters
}
您必須在方法之前放置@WebResult(name =“ ResultDto”)
@WebService
public interface Transaction {
@WebMethod(action="createPurchase", operationName = "purchase")
@WebResult(name="ResultDto")
ResultDto purchase(String partyId, String dealId);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.