In the binfile folder of JDK, there is a wsimport.exe. This tool generates corresponding class files based on the WSDL file, and then uses these class files to call WebService providers like calling local classes. This tool can be used on non-Java servers, such as WebService written in C #. Java client implementation is generated through wsimport.
Run the following command in the command prompt: wsimport-keep-P com. Demo. Client http: // localhost: 8080/demo/services/myservice? WSDL
Command parameter description:-D: directory where class files of the client execution class are generated-S: directory where source files of the client execution class are stored-P: to define the package name of the build class, see: After the http://download-llnw.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html uses the wsimport command, we can get the following Code File: Current directory in the command line | -- Com | -- demo | -- client | -- Example. java | -- exampleresponse. java | -- myservice. java | -- myserviceporttype. java | -- objectfactory. java | -- The package-info.java can copy the above file to your project and use it. Test: Create a project, copy the com. Demo. Client package to the project file, and write the test. Java file. The Code is as follows: Package com. Demo. wsimport;
Public class test {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
Myservice Server = new myservice ();
Myserviceporttype SPT = server. getmyservicehttpport ();
System. Out. println (SPT. Example ("hello "));
}
}
In the binfile folder of JDK, there is a wsimport.exe. This tool generates corresponding class files based on the WSDL file, and then uses these class files to call WebService providers like calling local classes. This tool can be used on non-Java servers, such as WebService written in C #. Java client implementation is generated through wsimport.
Run the following command in the command prompt: wsimport-keep-P com. Demo. Client http: // localhost: 8080/demo/services/myservice? WSDL
Command parameter description:-D: directory where class files of the client execution class are generated-S: directory where source files of the client execution class are stored-P: to define the package name of the build class, see the following code file after the http://download-llnw.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html uses the wsimport command: Current directory in the command line | -- Com | -- demo | -- client | -- Example. java | -- exampleresponse. java | -- myservice. java | -- myserviceporttype. java | -- objectfactory. java | -- The package-info.java can copy the above file to your project and use it. Test: Create a project, copy the com. Demo. Client package to the project file, and write the test. Java file. The Code is as follows: Package com. Demo. wsimport;
Public class test {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
Myservice Server = new myservice ();
Myserviceporttype SPT = server. getmyservicehttpport ();
System. Out. println (SPT. Example ("hello "));
}
}