Davy De Durpel created AXIS2-5471:
-------------------------------------

             Summary: SchemaCompilationException when generating java code in 
case of 2 identical child xsd's with different namespace
                 Key: AXIS2-5471
                 URL: https://issues.apache.org/jira/browse/AXIS2-5471
             Project: Axis2
          Issue Type: Bug
          Components: adb, codegen
    Affects Versions: 1.6.2, 1.6.1, 1.6.0
            Reporter: Davy De Durpel


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to