1

我使用 Metro 2.2.1 设计了一个简单的 Web 服务界面。当我运行 Java SE(build 1.6.0_24-b07-334)附带的 wsimport 实用程序并将其指向 WSDL URL 位置时,它会生成客户端存根代码,但该代码缺少方法。我很困惑为什么会这样,并希望得到任何指示。

主要的 Web 服务类 AutoUpdateAPI 具有以下方法:

public UpdateActionWS getLatestUpdate(@WebParam(name = "application") String application,     @WebParam(name = "version")  String version,@WebParam(name = "entries") UpdateItemWS[] entries, @WebParam(name = "license") String license);

它返回具有以下定义的 UpdateActionWS 类:

public class UpdateActionWS {

protected String url;
protected String version;
protected boolean forcedInstall = false;

protected UpdateItemWS[] additions;
protected UpdateItemWS[] subtractions;
protected UpdateItemWS[] changes;

public UpdateActionWS() {

}

protected UpdateActionWS(String url, String version, boolean forcedInstall, UpdateItemWS[] additions, UpdateItemWS[] subtractions, UpdateItemWS[] changes) {
    this.additions = additions;
    this.subtractions = subtractions;
    this.changes = changes;
    this.url = url;
    this.version = version;
    this.forcedInstall = forcedInstall;
}

@WebMethod
public UpdateItemWS[] getAdditions() { return additions; }
@WebMethod
public UpdateItemWS[] getSubtractions() { return subtractions; }
@WebMethod
public UpdateItemWS[] getChanges() { return changes; }


@WebMethod
public String getUpdateURL() { return url; }

@WebMethod
public String getVersion() {
    return version;
}

@WebMethod
public boolean getForcedInstall() {
    return forcedInstall;
}
@WebMethod
public void setForcedInstall(boolean forcedInstall) {
    this.forcedInstall = forcedInstall;
}
}

现在,当生成客户端存根时,此类的输出如下:

/**
* <p>Java class for updateActionWS complex type.
* 
* <p>The following schema fragment specifies the expected content contained within this class.
* 
* <pre>
* &lt;complexType name="updateActionWS">
*   &lt;complexContent>
*     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
*       &lt;sequence>
*         &lt;element name="forcedInstall" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
*       &lt;/sequence>
*     &lt;/restriction>
*   &lt;/complexContent>
* &lt;/complexType>
* </pre>
* 
* 
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateActionWS", propOrder = {
"forcedInstall" 
})
public class UpdateActionWS {

protected boolean forcedInstall;

/**
 * Gets the value of the forcedInstall property.
 * 
 */
public boolean isForcedInstall() {
    return forcedInstall;
}

/**
 * Sets the value of the forcedInstall property.
 * 
 */
public void setForcedInstall(boolean value) {
    this.forcedInstall = value;
}

}

我的问题是:为什么它无视其他方法?我尝试使用 Apache-CXF-2.3.3 附带的 wsimport 实用程序。我尝试将最新的 JAX-WS 库添加到 Java 认可的库中,但没有运气。任何指针将不胜感激。

4

0 回答 0