CXF wsdl2java:the attribute required is undefined for the annotation type Xmlelementref

Source: Internet
Author: User
Tags wsdl

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.