我运行以下命令
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);
}
它编译,但我宁愿不这样做。
答案 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)。
所以,你有两个选择:
更改IDE设置(如果您使用RAD,则可能必须迁移到以后的RAD版本),以便您的项目针对WAS 8.5运行时进行编译;或
使用-target
wsimport
开关,提供值2.1
或2.0
。这将生成可以针对旧版本的JAX-WS进行编译的代码。