To me this is not the same. There is a difference between a schema including another schema fragment explicitely and the implicit merging of 2 schemas in a WSDL file because they both have the same namespace. For example, with our Schema model the case below would result in a schema with a child that is an include - there is no merging as such. Validation can work out if there is a conflict but the schemas are not flattened into one. Logically they are as you can look up a type in either the including or included schema with the same result.

However, the idea of 2 (or more) schemas with the same namespace in WSDL is not addressed by the Schema specification because there is no explicit link between the different schemas. A schema parser is allowed to load the schema document for a given namespace locating it in whatever fashion it likes including using a document already parsed and in memory. It is perfectly valid (in my opinion) for the second schema in the WSDL to be ignored as the parser can decide it already has that schema and return the first schema as the result. It is also valid for the loading of the 2 schemas to result in completely separate schema instances, not linked together in any way.

To me a Schema is built from a root document down through includes (and imports but that is not relevant here). There is no magic gluing together of schemas just because they share a namespace - except arguably the nonamespace schema which, to me, is a mess in itself.

Again, what purpose would this serve if it was to be supported? As the implementor of our Schema support I would not like to see this being allowed.

Pete

Glen Daniels wrote:
Hi Pete:

Well, sure that would be easy, but I think this is the exact same
problem as if you had:

WSDL:
<wsdl:definitions>
 <wsdl:types>
  <wsdl:include location="xsd1"/>
 </wsdl:types>
</wsdl:definitions>

XSD1:
<xs:schema>
 <xs:element name="foo" type="xs:int"/>
 <xs:include location="xsd2"/>
<xs:schema>

XSD2:
<xs:schema>
 <xs:element name="bar" type="xs:float"/>
</xs:schema>

This wouldn't trigger your case below, but it would still result in a
"merged" schema, wouldn't it?  And if you replace "bar" in XSD2 with
"foo", you get a conflict which needs to somehow be resolved.  I think
this should have already been dealt with by the schema group, but a
cursory search hasn't yet netted me anything.  I glanced through the
somewhat dense text of
http://www.w3.org/TR/xmlschema-1/#compound-schema, but didn't see any
obvious statement about what to do if components are redefined without
an explicit <redefine> tag.

Rather than disallowing it, I think we should simply treat it as a
synonym for including the two <schema> elements, and simply be clear on
how that should resolve, with guidance from the schema WG as David
suggested.

--Glen

  
-----Original Message-----
From: Pete Hendry [mailto:peter.hendry@capeclear.com] 
Sent: Tuesday, October 05, 2004 6:50 PM
To: David Booth
Cc: Glen Daniels; Jeehong Min; WS Description List
Subject: Re: Can multiple inline schemas have same targetNamespace?

Rather than say you cannot be clear about it why not make a 
clear statement:

    It is not permitted and if it is present then it is an error.

Nothing ambiguous there and it clears up the issue. It is a 
lot easier for an implementation to detect this and error 
than it is to try to work around it merging schemas and such. 
Is there a purpose in allowing it?

Pete

David Booth wrote:

    
This is an interesting question, and I think it needs to be 
      
clarified 
    
in our spec, in case others also run into this issue.  I've just 
written to the XML Schema group for clarification from an 
      
XML Schema point of view:
    
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2
      
004OctDec/
  
0001.html

Perhaps we should suggest that WSDL authors avoid doing 
      
this, in order 
    
to avoid the issue, if we cannot be clear about whether or not it is 
permitted and what it means.


On Mon, 2004-10-04 at 11:24, Glen Daniels wrote:
 

      
Jeehong:

As long as there is no overlap between the component definitions in 
multiple schema containers for the same namespace, I think 
        
this should 
    
work just fine.  If there is overlap, we simply need to follow what 
the schema spec says about how to resolve repeated components in a 
schema (I'm not sure, though, if that's fault, first-one-wins, or 
last-one-wins...).

--Glen

   

        
-----Original Message-----
From: www-ws-desc-request@w3.org
[mailto:www-ws-desc-request@w3.org] On Behalf Of Jeehong Min
Sent: Monday, September 27, 2004 12:48 PM
To: www-ws-desc@w3.org
Subject: Can multiple inline schemas have same targetNamespace?

I would appreciate it if you could address the following 
          
issue that I 
    
have seen in WSDLs of 2 customers in the past month.

One vendor's SOAP stack is creating WSDLs with multiple inline 
schemas that have the same namespace.

Here's an example:
<wsdl:definition>
<wsdl:types>
<xs:schema targetNamespace="a">
types and elements
</xs:schema>
<xs:schema targetNamespace="a">
different types and elements
</xs:schema>
<xs:schema targetNamespace="b">
whatever
</xs:schema>
</wsdl:types>
...
<wsdl:definition>

It's not clear to me whether the above is legal or not 
          
(two schemas 
    
with the same targetNamespace="a").  Should XML parsers 
          
for WSDL be 
    
smart enough to handle the above?  Or should parsers report errors?

--
Jeehong Min
Software Engineer
SOAPtest Development
Parasoft Corporation

"We Make Software Work"