membrane / soa-model

Toolkit and Java API for WSDL, WADL and XML Schema.
http://www.membrane-soa.org/soa-model/
Apache License 2.0
94 stars 73 forks source link

Added testcases demonstrating wrong behavior with nested WSDLs. #244

Closed apechinsky closed 8 years ago

apechinsky commented 8 years ago

Created two sets of WSDLs (new and old):

soa-model/core/src/test/resources/wsdl/multiple-files-same-namespace-nested

Structure:

TestParent.wsdl
  Test.wsdl
     *.xsd

Differences:

  1. new: Test.wsdl imports City.xsd
  2. new: Branch.xsd declares 'newField'

Cases:

  1. compare(old/Test.wsdl, new/Test.wsdl) sees diff 2 but misses diff 1
  2. compare(old/TestParent.wsdl, new/TestParent.wsdl) see NO diffs at all
predic8 commented 8 years ago

Thanks for the test. We will merge the request when there is a fix for it.

apechinsky commented 8 years ago

Just noticed that Test.wsdl imports different xsd files using the same namespace.

<xsd:import namespace="http://TestEngineLib" schemaLocation="Branch.xsd"/>
<xsd:import namespace="http://TestEngineLib" schemaLocation="City.xsd"/>

Some parsers allows such declarations but others not. E.g. xmllint issues validation error:

Element '{http://www.w3.org/2001/XMLSchema}import': Skipping import of schema located at 'City.xsd' for the namespace 'http://TestEngineLib', since this namespace was already imported with 

the schema located at 'Branch.xsd'. If you change namespace of the second import then DiffGenerator works as expected.

I believe that such declaration (several imports with the same namespace) is not correct but I can't find explicit confirmation. Could you clarify?

Anyway, since responsibility of DiffGenerator is to generate difference may be it's better to relax comparison rules and allow to compare such imports? What do you think?

predic8 commented 8 years ago

Hi @apechinsky, I think that you can include several schemas sharing the same namespace. The imports must have a unique namespace. But I am not sure since recently we are more involved in the JSON and YAML formats.

Today we only fix errors in the DiffGenerator cause the interest is SOAP is not that big anymore. But contributions are welcome.

apechinsky commented 8 years ago

I've read spec once more and now almost sure that import directives should have unique namespaces because main purpose of import is to declare namespace. schemaLocation is just a hint which may be omitted. So second testcase (Test.wsdl) may be removed while first testcase (TestParent.wsdl) still make sense. DiffGenerator doesn't compare WSDL imports