CXF Generating client Java classes based on WSDL files
Download: apache-cxf-2.7.5
1. Open cmd to enter Apache-cxf-2.7.5\bin
2. Enter Wsdl2java-p "Generate class Package name"-Client "WSDL address"
For example: (wsdl2java.bat-frontend jaxws21-p "com.test"-client "http://192.168.3.105/services/Msp?wsdl")
The class with the name client in Com.test is the test class, and you can modify the parameters inside and then call the method to get the return value.
Creating a project in Eclipse: adding a Package
If there is a problem: The attribute required is undefined for the annotation type Xmlelementref
Workaround:
First, the following processing is required:
1. Copy the endorsed folder under the Apache-cxf-2.7.0\lib directory (contains Geronimo-jaxws_2.2_spec-1.1.jar and Jaxb-api-2.2.6.jar two jar packages) ;
2. Copy the above copied folder to the%java_home%\jre\lib directory
3. Restart Eclipse.
Second, add "-frontend jaxws21" when you execute Wsdl2java.
This allows the program to be used normally @xmlelementref
For example:
Wsdl2java.bat-frontend jaxws21-p "Com.test"-client "http://192.168.3.105/services/Msp?wsdl"
CXF wsdl2java:the attribute required is undefined for the annotation type Xmlelementref