Properties CXF-Wsdl2java-已定义XX属性

Properties CXF-Wsdl2java-已定义XX属性,properties,jaxb,cxf,wsdl2java,defined,Properties,Jaxb,Cxf,Wsdl2java,Defined,我使用CXF生成客户端类来访问web服务服务器。web服务基于WCF(.NET) 调用wsdl2java时,出现以下错误: The id property is already defined. use <jaxb:property> to resolve this conflict. The following location matches the above error : http://*****/WcfDemandService.svc?xsd=xsd2 [0,0] i

我使用CXF生成客户端类来访问web服务服务器。web服务基于WCF(.NET)

调用wsdl2java时,出现以下错误:

The id property is already defined. use <jaxb:property> to resolve this conflict. The following location matches the above error : http://*****/WcfDemandService.svc?xsd=xsd2 [0,0]
id属性已定义。用于解决此冲突。以下位置与上述错误匹配:http://*****/WcfDemandService.svc?xsd=xsd2[0,0]
如果我询问xmlbeans数据绑定(使用“DBXMLBeans”选项),则不会出现此错误


有没有办法用JAXB数据绑定生成类?

当一个类型具有相同名称的属性和元素时,通常会出现这种类型的问题

schema.xsd


xjc schema.xsd

当我们试图从这个XML模式生成Java模型时,我们会得到以下错误

parsing a schema...
[ERROR] Property "Bar" is already defined. Use &lt;jaxb:property> to resolve this conflict.
  line 11 of file:/Users/bdoughan/Scratch/src/forum16714465/schema.xsd

[ERROR] The following location is relevant to the above error
  line 13 of file:/Users/bdoughan/Scratch/src/forum16714465/schema.xsd
binding.xml

JAXB绑定文件可用于定制生成的类。在这里,我们将使用它来重命名与
属性相对应的属性


xjc-b binding.xml schema.xsd

现在,当您生成Java类时,您将得到如下类:

package org.example.schema;
导入javax.xml.bind.annotation.XmlAccessType;
导入javax.xml.bind.annotation.XmlAccessorType;
导入javax.xml.bind.annotation.XmlAttribute;
导入javax.xml.bind.annotation.xmlement;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name=),比例={
“酒吧”
})
@XmlRootElement(name=“foo”)
公开课Foo{
@XmlElement(必需=true)
受保护的线棒;
@xmltattribute(name=“bar”)
受保护的字符串属性;
公共字符串getBar(){
返回杆;
}
公共无效收进栏(字符串值){
这个.bar=值;
}
公共字符串getBarAttribute(){
返回属性;
}
公共void setBarAttribute(字符串值){
this.barAttribute=值;
}
}

您能否帮助找到从wsdl生成java源代码的解决方案?它有相似的区域…这是一个很好的答案