WSImport似乎没有使用was8.5 JAXWS

时间:2013-12-19 17:51:15

标签: websphere jax-ws

我运行以下命令

wsimport -s ..\Code\app\src\main\java http://localhost:9080/shortbus/ShortbusService/ShortbusService.wsdl 

这会运行并生成代码,但是,当我尝试编译给定新代码时,我得到了...

...\ShortbusService_Service.java:[43,8] cannot find symbol
symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.w
s.WebServiceFeature[])
location: class javax.xml.ws.Service

我尝试明确添加jaxws-api.jar和rt.jar,但似乎都没有用。有人可以帮助解决我所缺少的问题吗?

更新

如果我手动编辑(注意评论)......

public ShortbusService_Service(WebServiceFeature... features) {
    //super(__getWsdlLocation(), SHORTBUSSERVICE_QNAME, features);
    super(__getWsdlLocation(), SHORTBUSSERVICE_QNAME);
}

public ShortbusService_Service(URL wsdlLocation) {
    super(wsdlLocation, SHORTBUSSERVICE_QNAME);
}

public ShortbusService_Service(URL wsdlLocation, WebServiceFeature... features) {
    //super(wsdlLocation, SHORTBUSSERVICE_QNAME, features);
    super(wsdlLocation, SHORTBUSSERVICE_QNAME);
}

public ShortbusService_Service(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}

public ShortbusService_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
    //super(wsdlLocation, serviceName, features);
    super(wsdlLocation, serviceName);
}

它编译,但我宁愿不这样做。

1 个答案:

答案 0 :(得分:1)

由WAS 8.5 wsimport生成的代码将生成与JAX-WS 2.2兼容的代码,因为WAS 8.5支持JAX-WS 2.2。

您似乎正在尝试针对代表早期版本的JAX-WS的JAR文件编译代码,例如2.0或2.1(添加了Service构造函数接收“features” JAX-WS 2.2)。

所以,你有两个选择:

  1. 更改IDE设置(如果您使用RAD,则可能必须迁移到以后的RAD版本),以便您的项目针对WAS 8.5运行时进行编译;或

  2. 使用-target wsimport开关,提供值2.12.0。这将生成可以针对旧版本的JAX-WS进行编译的代码。