Wo wsgen?

Scheinen nicht zu wissen, wo (in welchem Verzeichnis - Quelle oder-Klassen), um richtig zu verwenden wsgen gegen meine WebService-Klasse...

Erstellen Sie eine Beispiel-document /literal-basierten WebService:

package hello;

import javax.jws.WebService;

@WebService
public class HelloWorld {

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

Erstellt der Verlag so:

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());
    }
}

Mit Eclipse Helios, ich automatisch zu erstellen, die diese beiden Dateien als *.Klassen unter der entsprechenden Klassen-Verzeichnis.

So, aus dem Dateisystem, mein Projekt sieht so aus:

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

In welchem Verzeichnis würde ich laufen wsgen?

Als ich versuchte es im inneren zu:

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

Erhalten:

  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

Es tatsächlich tut, zeigen mir die WSDL-Datei in einem browser und auch, wenn ich versuchte, Sie zu Problem der wsgen-Befehl aus $MyProject/Klassen, die es tatsächlich schaffen, eine jaxws-Ordner mit der SayHelloResponse.class Dateien, aber nicht die SayHelloResponse.java Dateien?

Vielen Dank für die Zeit nehmen, dies zu Lesen.

Schreibe einen Kommentar