我现在只是在自学 Web 服务并尝试运行一个 helloWorld。我认为要设置我需要运行 apt 的所有 Web 服务。
我这样运行它:
apt HelloImpl.java -classpath /<path>/jsr181-api.jar
但我收到警告(见下文)。我是否也需要指定注释处理器?我认为 apt 命令应该生成几个文件,但这并没有发生(只是生成一个 .class 文件)。谢谢您的帮助。
警告:
warning: No annotation processors found but annotations present.
1 warning
代码:
package server;
import javax.jws.WebService;
@WebService
public class HelloImpl {
/**
* @param name
* @return Say hello to the person.
*/
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
额外问题:apt 做什么?我假设它调用javac?它还应该调用注释处理器吗?
更新:我正在关注的教程说:
The next step is to run apt on the above Java code, resulting in several artifacts:
HelloServiceImpl.wsdl
schema1.xsd
classes/server/HelloImpl.class
classes/server/jaxrpc/SayHello.class
classes/server/jaxrpc/SayHelloResponse.class
classes/server/jaxrpc/SayHello.java
classes/server/jaxrpc/SayHelloResponse.java
我认为这是 apt 应该产生的(假设我传递了正确的论点)。但是我认为我需要向它传递一个注释处理器(?)。不过,我真的只想使用默认的(Web 服务注释处理器)。
更新 2:也许我应该使用 asant 或 wsgen?我看了看,但我的机器上没有这些。。需要研究的东西。。也许我正在/正在使用的教程是错误的。这是指向 asant 参考的链接:http: //java.sun.com/webservices/docs/2.0/tutorial/doc/JAXWS3.html