WSDL file Quickly create WebService, cxf generation client code with SOAPUI

1. Preface

Recently, the project has come into contact with many 2C interfaces, providing interface documents and WSDL files. At the beginning, the test interfaces are all code codes. Later, I learned that you can use SoapUI to run it and it will not work, and then you can change it later. Since you use the wsdl file directly Generate client code. During this period, I spent a lot of time crawling with the rolling belt. Learn to record. Link to a detailed description of WSDL.

2. SoapUI quickly create WebService

Download address: https://www.soapui.org/downloads/latest-release.html
If you install it, it’s OK to continue. Next, let’s take a look at using the wsdl file Quickly create an interface request:
< / span>
Project project name is filled in casually, WSDL address is provided by the interface party, format: request address/file.wsdl. If the project is not generated, if an error is reported, the WSDL address is wrong

Open Request1 , Modify the request parameters and request address, the operation is OK, is it very simple, haha!

3. CXF generated code

cxf download address: apache-cxf-3.1.10.zip, just download and unzip.
Open the cmd command line and enter the bin under the cxf installation directory, and use wsdl2java to generate code.

Note: The author’s wsdl file is placed in the root directory of Disk F
wsdl2java -p com.kilomob.puwernetwork -d F:\lbs -all F:\PhonePosProxy.wsdl
wsdl2java usage:
wsdl2java -p com -d src -all aa.wsdl
-p Specify the namespace of its wsdl, which is the package name of the code to be generated:
-d Specify to generate The directory where the code is located
-client generates the client-side test web service code
-server generates code for server to start web service
-impl generates we b service implementation code
-ant Generate build.xml file
-all Generate all start endpoint codes: types,service proxy,, service interface, server mainline, client mainline, implementation object, and an Ant build.xml file.

< span style="font-size:24px">

Original: http://blog.csdn.net/fjekin/article/details/62234861

Recently, the project has been exposed to many 2C interfaces, providing interface documents and WSDL files. At the beginning, the test interfaces are all code codes. , I learned later that you can use SoapUI to run it and it will not work, and then it will be more awesome, since the wsdl file is used to directly generate the client code. During this period, I spent a lot of time crawling with the rolling belt. Learn to record. Link to a detailed description of WSDL.

Download address: https://www.soapui.org/downloads/latest-release.html

If you install it, it’s OK to continue. Next, let’s take a look at using the wsdl file to quickly create an interface request:

p>

Fill in the project name at will, the WSDL address is provided by the interface party, the format: request address/file.wsdl. If the project is not generated, if an error is reported, the WSDL address is wrong


Open Request1, modify the request parameters and request address, and the operation will be OK. Isn’t it simple, haha!

cxf download address: apache-cxf-3.1.10.zip, just download and unzip it.

Open the cmd command line and enter the bin under the cxf installation directory, and use wsdl2java to generate the code.


p>

Note: The author’s wsdl file is placed in the root directory of Disk F

wsdl2java -p com.kilomob.puwernetwork -d F:\lbs -all F:\PhonePosProxy.wsdl

< p>wsdl2java usage:
wsdl2java -p com -d src -all aa.wsdl
-p Specify the namespace of its wsdl, which is the package name of the code to be generated:
-d Specify the directory where the code is to be generated
-client generation Client test web service code
-server generates the code for the server to start the web service
-impl Generate web service implementation code-impl span>
-ant Generate build.xml file
-all Generate all start endpoint codes: types,service proxy,,service interface, server mainline, c lient mainline, implementation object, and an Ant build.xml file.

Leave a Comment

Your email address will not be published.