从wsdl生成Java客户端时,出现上述错误。 我已经使用绑定文件解决了重复的名称错误和丢失的架构声明错误
gradle task
cxf version is 3.0.0
task wsdl2java3(type: JavaExec) {
ext {
outputDir = file("$jaxbOutputDir")
}
systemProperties = ['javax.xml.accessExternalSchema': 'file' , 'file.encoding':'UTF8']
outputs.upToDateWhen { false }
outputs.dir outputDir
main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
classpath = project.configurations.cxf
args '-d', outputDir
ar`enter code here`gs '-client'
args '-verbose'
args '-mark-generated'
args '-p',"com.niloosoft.directorymanagementservice"
args "https://hunterdirectory.hunterhrms.com/DirectoryManagementService.svc?wsdl"
doLast {
println "----- cxf jaxb2 files generated -----"
}
}
已使用绑定文件
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc"
jaxb:version="2.0">
<jaxb:bindings schemaLocation="https://huntercards.hunterhrms.com/HunterCards.svc?xsd=xsd2" node="/xs:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Type" />
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation=" https://huntercards.hunterhrms.com/HunterCards.svc?xsd=xsd13" node="/xs:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Type" />
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation=" https://huntercards.hunterhrms.com/HunterCards.svc?xsd=xsd3" node="/xs:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Type" />
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
<globalBindings>
<xjc:simple />
</globalBindings>
<jaxb:bindings scd="~xsd:complexType">
<class name="ComplexTypeType"/>
</jaxb:bindings>
<jaxb:bindings scd="~xsd:simpleType">
<class name="SimpleTypeType"/>
</jaxb:bindings>
<jaxb:bindings scd="~xsd:group">
<class name="GroupType"/>
</jaxb:bindings>
<jaxb:bindings scd="~xsd:attributeGroup">
<class name="AttributeGroupType"/>
</jaxb:bindings>
<jaxb:bindings scd="~xsd:element">
<class name="ElementType"/>
</jaxb:bindings>
<jaxb:bindings scd="~xsd:attribute">
<class name="attributeType"/>
</jaxb:bindings>
</jaxb:bindings>
感谢您的帮助