As the project is serviced, the use of WebService is common in some large projects, and here are two ways to generate client code based on the service address provided.
Note: You need to configure the environment variables when using both of these methods. CXF Configuration and JDK configuration is roughly the same, here is not explained, not configured a good Baidu.
(1) The JDK provides a wsimport.exe command that is used to generate client code for WebService and then invoke WebService.
Wsimport is based on jdk1.6.0_21 and above the generated local code, it can only resolve the server-side SOAP protocol is 1.1, can not resolve the SOAP1.2 protocol. If parsing SOAP1.2 will parse incomplete.
Syntax: wsimport-s file Address-P custom class package URL path
-S to specify the path to the build file, the-P custom class package URL is http://localhost:8888/hello?wsdl is the path to the WSDL
Usage: JDK configuration for PATH environment variable c:\aflyun>wsimport-s f:\-P com.aflyun.client.jdk.wsimporthttp://localhost:8888/hello?wsdl
(2) CXF provides the Wsdl2java.exe command to generate client code, and then invoke WebService.
Wsdl2java is a command provided by CXF to generate client code based on WSDL. It is based on the local code generated by jdk1.7, so you need to make a little change to the generated code.
It can support the SOAP1.1 and SOAP1.2 protocols. The premise is that you have already downloaded the Apache CXF and configured the Wsdl2java.exe for the PATH environment variable.
Syntax: wsdl2java-d file Address-P custom class package URL path
-d Specifies the path to the build file, and the-P custom class package http://localhost:8888/hello?wsdl is the path to the WSDL.
Usage: c:\aflyun>wsdl2java-d f:\-P com.aflyun.client.cxf http://localhost:8888/hello?wsdl