What is the relationship between:
the import
element in WSDL
-and-
the import
element and in XML Schema
... and in particular the relationship between the location
attribute of the former and the schemaLocation
attribute of the latter?
Though I can use a catalog file (in a JAX-WS / wsimport
toolchain) to "override" schemaLocation
attributes for the xsd:import
element it seems that I can't do the same for the location
attributes of the wsdl:import
statement.
In both cases, the import
establishes a relationship between a document (be that WSDL or XSD) and an external resource).
Barring the confusion which surrounded the wsdl:import, specifically if it could be used to import XSDs or not (in the interoperable way it shouldn't), they're both meant to do the same thing for its own kind, i.e. bring in another WSDL's (in the WSDL case), or another XSD's (in the XSD case) definitions in scope, thus allowing a modular approach to authoring.
The attributes you're referring to are meant to be equivalent, in the same way an import
in Java more or less matches a using
in C#.
However, the specifics around each are different if you consider the WSDL 1.1 note: while in XSD the schemaLocation attribute is optional for xsd:import (since an import's location may be resolved through its namespace using other means allowed by the spec), the same was not built into the WSDL 1.1 note for the location attribute.
Also, the XSD spec is explicitly allowing for an override:
The ·actual value· of the schemaLocation, if present, gives a **hint** as to where a serialization of a ·schema document·...
If you look for the same in WSDL 2.0, you will notice that now WSDL supports an include in addition to the old import, basically following the same semantics relative to the namespace associated with the directive. More so, the use of the location attribute is also consistent to that in the XSD, which in return should foster a catalog-based approach to resolve the "dangling" imports.
To round it up, given the mandatory location attribute in WSDL 1.1, it didn't make sense to talk about catalogs or overrides since it was not implied or allowed by the note.