Apache Cxf Wsdl2java创建Web服务客户端编码错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Apache Cxf Wsdl2java创建Web服务客户端编码错误相关的知识,希望对你有一定的参考价值。

我试图创建Web服务客户端,然后我看到编码错误。

我更改了eclipse编码属性,JVM编码属性和文件编码属性并设置了UTF-8,但这并没有改变任何东西!

    WSDLToJava Error: Schema Error : s4s-att-invalid-value: Invalid attribute value for 'attributeFormDefault' in element 'schema'. Recorded reason: cvc-enumeration-valid: Value 'unqualıfıed' is not facet-valid with respect to enumeration '(qualified | unqualified)'. It must be a value from the enumeration.

org.apache.cxf.tools.common.ToolException: Schema Error : s4s-att-invalid-value: Invalid attribute value for 'attributeFormDefault' in element 'schema'. Recorded reason: cvc-enumeration-valid: Value 'unqualıfıed' is not facet-valid with respect to enumeration '(qualified | unqualified)'. It must be a value from the enumeration.
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java:911)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:588)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:391)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:589)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:242)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:139)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:286)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute value for 'attributeFormDefault' in element 'schema'. Recorded reason: cvc-enumeration-valid: Value 'unqualıfıed' is not facet-valid with respect to enumeration '(qualified | unqualified)'. It must be a value from the enumeration.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.reportSchemaError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDocumentInfo.<init>(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
    at javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
    at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java:906)
    ... 10 more

谢谢。

答案
  • 从wsdl删除attributeFormDefault =“unqualified”elementFormDefault =“unqualified”行
  • 更改您的所有区域设置美国/王国
  • 导入WSDL时,从Apache CXF向导中选择Develop Client

以上是关于Apache Cxf Wsdl2java创建Web服务客户端编码错误的主要内容,如果未能解决你的问题,请参考以下文章

apache cxf wsdl2java命令

apache CXF wsdl2java工具的使用

列表中的 Cxf Wsdl2java 空条目消失

使用Apache CXF根据wsdl文件生成代码

怎么用cxf的wsdl2java解析wcf生成的wsdl

Maven CXF wsdl2Java 给指定全名空间设置包名