我正在尝试开发 JAX WS Web 服务,但在运行 WSGEN 实用程序的 ant 工具时出现错误,我的 Web 服务仅包含一种方法添加,下面是我的一段代码..
界面 :-
package Demo;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style = Style.DOCUMENT) //optional
public interface Calculator {
@WebMethod
public int add(int a ,int b);
}
其次是服务端点类
package Demo;
import javax.jws.WebService;
//Service Implementation
@WebService(endpointInterface = "Demo.Calculator")
public class CalculatorImpl implements Calculator {
@Override
public int add(int a ,int b) {
return a+b;
}
}
build.xml 是..
<target name="wsgen" >
<exec executable="wsgen">
<arg line="-cp ./bin -keep -s ./src -d ./bin Demo.CalculatorImpl"/>
</exec>
</target>
</project>
但是在执行 build.xml 得到以下错误是..
Buildfile: D:\saralworkspace\aa\build.xml
wsgen:
BUILD FAILED
D:\saralworkspace\aa\build.xml:5: Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2, The system cannot find the file specified
请告知其中出了什么问题以及如何克服它..!!