1

I'm trying to upload a schema that imports another existing schema in the registry, and I want to upload it without having to pack in a zip the two schemas, but always result in the error "Could not read the XML Schema Definition file. this.schema.needs".

As a proof of concept, I've uploaded a commons.xsd that gets stored in the registry as: /_system/governance/trunk/schemas/_1/commons/commons.xsd, under "urn:commons:1" namespace.

Now, I want to upload an example.xsd that has this import:

<xsd:import namespace="urn:commons:1" schemaLocation="../commons/commons.xsd"/>

If I pack the two schemas in a zip and upload them, it works as expected, but what I want is to upload only the example.xsd schema as commons.xsd is already in the registry, and it fails:

[2015-08-23 16:24:49,310] ERROR {org.wso2.carbon.registry.resource.ui.processors.AddResourceProcessor} -  File upload failed.
org.apache.axis2.AxisFault: Failed to add resource /_system/governance/example.xsd. Could not read the XML Schema Definition file. this.schema.needs
        at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
        at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:367)
        at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:413)
        at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:224)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.wso2.carbon.registry.resource.stub.ResourceAdminServiceStub.addResource(ResourceAdminServiceStub.java:4818)
        at org.wso2.carbon.registry.resource.ui.clients.ResourceServiceClient.addResource(ResourceServiceClient.java:679)
        at org.wso2.carbon.registry.resource.ui.processors.AddResourceProcessor.execute(AddResourceProcessor.java:179)
        at org.wso2.carbon.ui.transports.fileupload.AbstractFileUploadExecutor.executeGeneric(AbstractFileUploadExecutor.java:104)
        at org.wso2.carbon.ui.transports.fileupload.FileUploadExecutorManager$CarbonXmlFileUploadExecHandler.execute(FileUploadExecutorManager.java:392)

As I see, if the uploader had put the new file under /_system/governance/trunk/schemas/_1/example/example.xsd respecting its namespace "urn:example:1" it had found the commons.xsd on the specified relative path, but seems to put it at the root governance folder.

Is it a bug?

Do you know any workaraound to achieve that?

WSO2 Governance registry Version is 4.6.0

Community
  • 1
  • 1
AlexCG
  • 126
  • 1
  • 8

1 Answers1

0
  1. One workaround for this is to zip all schemas together and upload which you have already tried
  2. Other workaround is to give the absolute path when you specify the import: ex: schemaLocation="http://www.example.com/commons/commons.xsd"
shashika
  • 94
  • 4