.. Does Work Like You Think It Does In (Some) URIs

Paul Brown @ 2007-06-17T18:09:00Z

I recently came across a WSDL import statement of the following form:

<wsdl:import namespace="some://uri"
             location="../a/relative/path.wsdl" />

My first thought was that this is wrong, but I found out that it is actually standard behavior according to RFC 2396:

Within a relative-path reference, the complete path segments "." and ".." have special meanings: "the current hierarchy level" and "the level above this hierarchy level", respectively. Although this is very similar to their use within Unix-based filesystems to indicate directory levels, these path components are only considered special when resolving a relative-path reference to its absolute form (Section 5.2).

The RFC also specifies a sensible set of fallbacks for determining the base URI, rendered in ASCII art:

.----------------------------------------------------------.
|  .----------------------------------------------------.  |
|  |  .----------------------------------------------.  |  |
|  |  |  .----------------------------------------.  |  |  |
|  |  |  |  .----------------------------------.  |  |  |  |
|  |  |  |  |       <relative_reference>       |  |  |  |  |
|  |  |  |  `----------------------------------'  |  |  |  |
|  |  |  | (5.1.1) Base URI embedded in the       |  |  |  |
|  |  |  |         document's content             |  |  |  |
|  |  |  `----------------------------------------'  |  |  |
|  |  | (5.1.2) Base URI of the encapsulating entity |  |  |
|  |  |         (message, document, or none).        |  |  |
|  |  `----------------------------------------------'  |  |
|  | (5.1.3) URI used to retrieve the entity            |  |
|  `----------------------------------------------------'  |
| (5.1.4) Default Base URI is application-dependent        |
`----------------------------------------------------------'

Nonetheless, this can still be a bit confusing. In this case, the WSDL that I was looking at was in a source code download, and the referenced resources were not. The best practice should be to specify an xml:base in every WSDL document that uses a relative wsdl:import location. (The WS-I Basic Profile doesn't say anything about relative wsdl:import locations.)

Meta

Tags: (tag) (tag) (tag) (tag) (tag)

(comment bubbles) 0 comments
618 direct views