The method of automatically generating a file webservice

Steps:
 First, the environment to prepare 
1, JDK environment 
2, download apache-cxf release package, the latest version is 3.1.7, unzip the release package, set CXF_HOME, and add% CXF_HOME% / bin to your path environment variable. 
3, CMD command line input wsdl2java -help, normal environment has prompted instructions properly configured.

 

 

Second, the command uses  
this command is mainly generated webservice client code, the server can be self-developed service, may also be required docking service interface, the easiest command is as follows: 
WSDL2Java wsdlurl 
which wsdlurl service release access address, No default write parameters are generated client-side code, which is the most used -encoding parameter specified java code encoding format, for example: 
WSDLURL WSDL2Java -encoding 
other parameters and detailed description or may be wsdl2java -help wsdl2java -h Get, set the parameters according to the actual demand. Third, the simple case of 
common interfaces: IP address of the source search WEB Service 
1, generate client code 
WSDL address: 
http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl 
use wsdl2java tool to directly generate client code in the eclipse project where, eclipse project address is: E: \ workspace \ webservice, the following command: 
WSDL2Java the -encoding UTF-8 -d E: / Workspace / WebService / src http://www.webxml.com.cn/WebServices /IpAddressSearchWebService.asmx?wsdl 
-encoding represented generated Java files coding format utf8, -d represents code generation path E: / workspace / webservice / src .
 
Finished, do not report any errors on the implementation of a successful     
 
Fourth, the test method webservice
eclipse built-in tools, soupui, postman

  

 

Guess you like

Origin www.cnblogs.com/4king/p/11779007.html