解析 xmldsig-core/xmldsig-core-schema.xsd 时出错

Error parsing xmldsig-core/xmldsig-core-schema.xsd

我正在从 wsdl 文件生成客户端代码。没有任何代码更改,它停止工作,现在我收到以下错误消息:

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java (generate-sources) on project myProject: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : file:/C:/myproject/src/main/resources/myservice.wsdl [ERROR] Caused by : WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema/xsd:schema): faultCode=PARSER_ERROR: Problem parsing 'http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd'.: java.io.FileNotFoundException: http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd

在此处复制架构的内容

https://archive.evolveum.com/downloads/midpoint/1.9/midpoint-xsddocs-1.9/schemas/xmldsig-core-schema_xsd/schema-overview.html#xml_source

到本地文件并将“http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd”修改为本地架构的新路径。

或将“http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd”修改为: https://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd

发生这种情况是因为引用之一再次引用此 link。默认情况下,wsdl2java 将尝试打开所有 linked xsd - 如果需要或不需要。还请检查 wsdl2java http://cxf.apache.org/docs/wsdl-to-java.html

的 -nexclude 选项