Где использовать wsgen?

Кажется, не знаю, где (какой каталог - источник или классы) правильно использовать wsgen против моего класса WebService ...

Создайте образец документа на основе литерала WebService:

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 в соответствующем каталоге классов.

Итак, из файловой системы мой проект выглядит так:

/code/jws_sample
          |
          src
             |
              hello
                  |
                  HelloWorld.java
                  Publisher.java
          |
           classes
                    |
                    HelloWorld.class
                    Publisher.class

В в каком каталоге запустить wsgen?

Когда я попробовал его внутри:

/ code / jaxws_sample / src / wsgen -cp. hello.HelloWorld

Получено:

  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 в браузере, а также когда я пытался выполнить команду wsgen из $ MyProject / classes, он действительно создал папку jaxws с файлами SayHelloResponse.class, но а не файлы SayHelloResponse.java?

Спасибо, что нашли время прочитать это.

7
задан PacificNW_Lover 23 June 2011 в 20:29
поделиться