JAX-WS/WS-Addressing WAS 8.5.5 编译错误和无法访问WSDL错误
JAX-WS/WS-Addressing WAS 8.5.5 编译错误和无法访问WSDL错误
I tried to develop a sample WS-Addressing application with WAS 8.5.5 but got failure all the times.
参照了一些例子,试着在WAS8.5.5上做了一个简单的WS-Addressing应用,几天下来,总是碰到一样的莫名其妙的错误
====== 错误1: 编译错误,W3CEndpointReference不能作为返回类型.======
仿照一些例子,写了一个简单的SEI接口
@Addressing
@WebService
public interface ICalculator {
public W3CEndpointReference getToken();
}
在Eclipse (kepler-SR2) + WAS8.5.5插件, 错误信息是这么说的 "Class javax.xml.ws.wsaddressing.W3CEndpointReference may not be used as a return type or method parameter as it has inner types that are not public and static"
为了排除代码错误,我另建了一个应用,但是选择了Tomcat 7.0作为目标运行环境.结果同样的代码编译成功。
然后再试了RAD9+WAS8.5.5,结果同样编译成功。
究竟是什么导致的错误呢?
====== 错误2: WEB服务访问错误地址 ======
因为错误1,我决定跳过SEI接口,直接写实现类。有趣的是,这回,返回类型W3CEndpointReference就不报错了。
public W3CEndpointReference getToken() {
...
return (W3CEndpointReference)ctx.get
}
Web服务代码就一个类,把它打包发布到WAS8.5.5,测试访问WSDL成功 http://localhost:9082/CalculatorWeb/CalculatorService/CalculatorService.wsdl
然后使用WAS8.5.5的wsimport工具(WAS_HOME/java/bin/wsimport)来生成客户端代码
wsimport -s .\client_src http://localhost:9082/CalculatorWeb/CalculatorService/CalculatorService.wsdl
奇怪的事情发生了,生成的客户端代码居然报错“FileNotFoundException”,生成的Proxy居然莫名其妙地试图访问一个错误的URL
http://localhost:9082/CalculatorWeb/CalculatorService/?wsdl.
这个结尾的"CalculatorService/?wsdl"而不是"CalculatorService?wsdl".
在Eclipse和RAD9中都测试过了,一样的错误。