似乎不知道对我的WebService类正确使用wsgen的位置(哪个目录-源或类)...

创建一个基于Web的示例文档文字:

package hello;

import javax.jws.WebService;

@WebService
public class HelloWorld {

public void sayHello() {
        System.out.println("Welcome to JAX-WS 2!");
    }
}

像这样创建发布者:
package hello;

import javax.xml.ws.Endpoint;

public class Publisher {
    public static void main(String[] args) {
        Endpoint.publish("http://localhost:8080/jaxws/hello", new HelloWorld());
    }
}

使用Eclipse Helios,我自动将这两个文件都以* .classes的形式构建在相应的classes目录下。

因此,从文件系统来看,我的项目如下所示:
/code/jws_sample
          |
          src
             |
              hello
                  |
                  HelloWorld.java
                  Publisher.java
          |
           classes
                    |
                    HelloWorld.class
                    Publisher.class

我将在哪个目录中运行wsgen?

当我在里面尝试时:

/ code / jaxws_sample / src / wsgen -cp。你好。

收到:
  Class not found: "hello.HelloWorld"

  Usage: WSGEN [options] <SEI>

  where [options] include:

  -classpath <path>          specify where to find input class files

  -cp <path>                 same as -classpath &lt;path&gt;

  -d <directory>             specify where to place generated output files

  -extension
                             allow vendor extensions - functionality not specified
                             by the specification.  Use of extensions may
                             result in applications that are not portable or
                             may not interoperate with other implementations
   -help                     display help

   -keep                     keep generated files

   -r <directory>            resource destination directory, specify where to
                             place resouce files such as WSDLs

   -s <directory>            specify where to place generated source files

   -verbose                  output messages about what the compiler is doing

   -version                  print version information

   -wsdl[:protocol]          generate a WSDL file. The protocol is optional.
                             Valid protocols are [soap1.1, Xsoap1.2],
                             the default is soap1.1.
                             The non stanadard protocols [Xsoap1.2]
                             can only be used in conjunction with the
                             -extension option.

   -servicename <name>       specify the Service name to use in the generated WSDL
                             Used in conjunction with the -wsdl option.

   -portname <name>          specify the Port name to use in the generated WSDL
                             Used in conjunction with the -wsdl option.

   Examples:

   wsgen -cp . example.Stock
   wsgen -cp . example.Stock -wsdl -servicename {http://mynamespace}MyService

它实际上确实向我显示了浏览器中的WSDL,而且当我尝试从$ MyProject / classes发出wsgen命令时,实际上确实使用SayHelloResponse.class文件创建了jaxws文件夹,但没有使用SayHelloResponse.java文件创建了jaxws文件夹吗?

感谢您抽出时间来阅读。

最佳答案

看来您必须先将文件编译成类文件,然后再将它们提供给wsgen。

classpath <path>          specify where to find input **class files**

我可能是错的,但我相信我过去必须做同样的事情。

谢谢,

杰弗里·凯文·普瑞

08-03 17:17