Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5471

SchemaCompilationException when generating java code in case of 2 identical child xsd's with different namespace

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.0, 1.6.1, 1.6.2
    • None
    • adb, codegen

    Description

      We have a wsdl that compiles without issues with Axis2 1.4.x and 1.5.x but no longer with Axis2 1.6.x

      We get following exception:
      Caused by: org.apache.axis2.schema.SchemaCompilationException: The referenced element '

      {urn:v1.psdvalues.rosy.objects.bgc}

      BandList' was not found!

      This BandList element is located in 2 different xsd's. Both are in fact identical, but they have a unique namespace.

      I have imported the 1.6.2 source code in eclipse and I managed to locate the code where things seem to wrong.

      It is located in the org.apache.axis2.schema.SchemaCompiler.isComponetExists(...) method. This method checks if a certain element exists in an xsd. It does not however check the namespace so it will always return the first schema containing the element. But later on a check is done on the namespace which results in above error.

      I'm not sure what the best way is to fix this issue. I did it by adding below code to the beginning of the method:

      if (!schema.getTargetNamespace().equals(componentQName.getNamespaceURI())) {
      return false;
      }

      This seem to have worked for me (though I'm not 100% sure as the implementation of this generated code still has to be done). At least it allowed me to generate the code without schema compilation errors.

      I will attach (or at least do an attempt as it is my first time on Jira) a simplified version of our wsdl and a small java project that simulates the issue.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            davy.de.durpel@isencia.be Davy De Durpel

            Dates

              Created:
              Updated:

              Slack

                Issue deployment