我正在尝试为基于.NET
的第三方Web服务生成代理。我看到类似的错误,并意识到自定义绑定将在这里有所帮助。我尝试了-autoNameResolution
和jaxb:globalBindings underscoreBinding="asCharInWord"
,但它无效。不幸的是,“wsdl2java”没有显示模式文件中的行号。添加它作为新线程的主要原因是错误是模糊的。我无法根据[0,0]的有限信息错误预测问题。
我正在使用Apache CXF version 2.6.11
绑定文件
控制台输出:
C:\codegen>wsdl2java -verbose -b C:\codegen\bindings.xml https://mydomain.com:10011/UniversalInterface2012/EOS1?wsdl
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -verbose -b C:\codegen\bindings.xml https://mydomain.com:10011/UniversalInterface2012/EOS1?wsdl
wsdl2java - Apache CXF 2.6.11
WSDLToJava Error: https://mydomain.com:10011/UniversalInterface2012/EOS1?xsd=xsd2 [0,0]: Two declarations cause a collision in the ObjectFacto
ry class.
https://mydomain.com:10011/UniversalInterface2012/EOS1?xsd=xsd2 [0,0]: (Related to above error) This is the other declaration.
org.apache.cxf.tools.common.ToolException: https://mydomain.com:10011/UniversalInterface2012/EOS1?xsd=xsd2 [0,0]: Two declarations cause a col
lision in the ObjectFactory class.
https://mydomain.com:10011/UniversalInterface2012/EOS1?xsd=xsd2 [0,0]: (Related to above error) This is the other declaration.
at org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:166)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
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)
/tSuppressed: java.lang.NoSuchMethodException: org.apache.cxf.tools.common.ToolException.addSuppressed(java.lang.Throwable)
/t at java.lang.Class.getMethod(Class.java:1581)
/t at org.apache.cxf.tools.common.ToolException.addSuppressedThrowable(ToolException.java:143)
/t at org.apache.cxf.tools.common.ToolException.<init>(ToolException.java:52)
/t at org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:166)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
/t at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
/tSuppressed: java.lang.NoSuchMethodException: org.apache.cxf.tools.common.ToolException.addSuppressed(java.lang.Throwable)
/t at java.lang.Class.getMethod(Class.java:1581)
/t at org.apache.cxf.tools.common.ToolException.addSuppressedThrowable(ToolException.java:143)
/t at org.apache.cxf.tools.common.ToolException.<init>(ToolException.java:52)
/t at org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:166)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
/t at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
/tCaused by: org.apache.cxf.tools.common.ToolException: https://mydomain.com:10011/UniversalInterface2012/EOS1?xsd=xsd2 [0,0]: Two declaration
s cause a collision in the ObjectFactory class.
/t at org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:166)
/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
/t at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
/t at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
/t/tCaused by: com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory class.
/t/t at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
/t/t at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:191)
/t/t at com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:59)
/t/t at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:267)
/t/t at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:166)
/t/t at com.sun.tools.xjc.model.Model.generateCode(Model.java:290)
/t/t at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:283)
/t/t at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:94)
/t/t at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:461)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:715)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
/t/t at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
/t/t at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)