在我的日常工作过程中,我正在尝试使用本文中的 WSDL 和 XSD:
http://www.ibm.com/developerworks/webservices/library/ws-restwsdl/
作为从中生成一些java代码的模板。我的愿望是使用生成的 java 代码以某种方式验证我的(将要)手动编写的 WSDL 和模式是否合理。问题是,当我运行时(类似):
...WSDL2Java --noBuildXML --unpack-classes -uri booklist.wsdl -wv 2.0
我得到这个例外:
[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:159)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
[java] Caused by: java.lang.NullPointerException
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.setFeature(Unknown Source)
[java] at org.apache.xerces.parsers.BasicParserConfiguration.<init>(BasicParserConfiguration.java:261)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.<init>(Unknown Source)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:340)
[java] at org.apache.xerces.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:347)
[java] at org.apache.xerces.impl.xs.XMLSchemaValidator.<init>(XMLSchemaValidator.java:1086)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.configurePipeline(StandardParserConfiguration.java:673)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.reset(StandardParserConfiguration.java:627)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:502)
[java] at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
[java] at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
[java] at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:221)
[java] at org.apache.woden.internal.DOMWSDLReader.getDocument(DOMWSDLReader.java:735)
[java] at org.apache.woden.internal.DOMWSDLReader.retrieveSchema(DOMWSDLReader.java:629)
[java] at org.apache.woden.internal.DOMWSDLReader.parseSchemaImport(DOMWSDLReader.java:380)
[java] at org.apache.woden.internal.BaseWSDLReader.parseTypes(BaseWSDLReader.java:573)
[java] at org.apache.woden.internal.BaseWSDLReader.parseDescription(BaseWSDLReader.java:429)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:185)
[java] at org.apache.woden.internal.DOMWSDLReader.readWSDL(DOMWSDLReader.java:158)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1225)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.readInTheWSDLFile(WSDL20ToAxisServiceBuilder.java:1176)
[java] at org.apache.axis2.description.WSDL20ToAxisServiceBuilder.<init>(WSDL20ToAxisServiceBuilder.java:153)
[java] at org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder.<init>(WSDL20ToAllAxisServicesBuilder.java:53)
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:102)
[java] ... 2 more
我不能仅从当前目录中的文件生成代码吗?(我以前做过,但它是一个没有外部支持模式文件的 WSDL 1.1 文件)
此示例 WSDL 是否存在已知问题?
Axis2(1.5 版)WSDL2Java 中是否存在错误?(显然,最好有关于一些丢失数据的错误消息,而不是抛出空指针/引用)