यह जानने के लिए प्रतीत नहीं होता है कि (वेब निर्देशिका सेवा या वर्ग) मेरे वेब सेवा वर्ग के खिलाफ wsgen का सही तरीके से उपयोग करने के लिए कहां है ...Wsgen का उपयोग कहां करें?
नमूना दस्तावेज़ बनाएं शाब्दिक आधारित वेब सेवा:
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());
}
}
ग्रहण हेलीओस का उपयोग करके, मैं स्वचालित रूप से इन दोनों फ़ाइलों को * वर्ग वर्गों के नीचे * वर्गों के रूप में बनाता हूं।
तो, फाइल सिस्टम से, मेरी प्रोजेक्ट इस तरह दिखती है:
/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 <path>
-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
यह वास्तव में मुझे ब्राउज़र में डब्लूएसडीएल दिखाता है और जब मैंने $ MyProject/वर्गों से wsgen कमांड जारी करने का प्रयास किया, तो वास्तव में यह एक जैक्सव्यू फ़ोल्डर बना रहा SayHelloResponse.class फ़ाइलें लेकिन SayHelloResponse.java फाइलें नहीं?
इसे पढ़ने के लिए समय निकालने के लिए धन्यवाद।
मैंने ऐसा किया ... ग्रहण ने संबंधित कक्षाओं को बनाया और इसे इस तरह से किया: $ MyProject/classes/wsgen -cp। हैलो.हेलोवर्ल्ड काम करता है, लेकिन यह कक्षाओं के अंदर जेनरेटेड स्टब्स रखता है। Src dir के अंदर उन्हें रखने के लिए डीडी का उपयोग कैसे कर सकता है? –