Search code examples
javaxmlxsdwsdlcxf-codegen-plugin

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


I am generating the client code from a wsdl file. Without any change on code, it stopped working and now I'm getting the following error message:

[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


Solution

  • Copy the contents of the schema here

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

    to a local file and amend 'http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd' to the new path of your local schema.

    or amend 'http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd' to: https://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd

    This is happening because one of the references again references this link. By default wsdl2java will try to open all linked xsd's - if they are needed or not. Please also check -nexclude option for wsdl2java http://cxf.apache.org/docs/wsdl-to-java.html