繁体   English   中英

Soap Web服务未发布为Java中的“自定义对象”返回类型

[英]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 

}

ResultDto

 @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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM