I have been studying SOAP and WSDL in preparation for implementing a web service. One thing that I have encountered that puzzles me is that some of the URIs that I have seen use a trailing slash such as:
http://www.w3.org/some-namespace/
while other examples that I have studied omit this trailing slash. I really have several questions regarding this:
- What is the significance of the trailing slash?
- Is the URI, http://www.w3.org/some-namespace the same as http://www.w3.org/some-namespace/?
- If they are not the same, how do I decide when one form is warranted versus another?
- I have read the guidelines given by w3c regarding URI’s and these appear to indicate that that URI should be considered equal only if the case-sensitive comparison of the URI strings are considered equal. Is this interpretation correct?
Namespace URIs are simply meant as unique identifiers (here‘s a link to the rules for comparison). Use of a URI (versus, say ‘foo’) can be traced back (I believe) to the use of URIs in an XML DOCTYPE.
Which is also, I think where the confusion comes regarding the ‘retrievability’ of such URIs. The XML Spec requires that the SYSTEM identifier in a DOCTYPE may be used to retrieve the document’s DTD (I link to the Annotated XML Spec, rather than the W3C version, because I believe that Tim Bray’s commentary is very useful).
Although other specifications (eg, XML schema) do not require this behavior, I believe that it’s a useful habit to follow — particularly in the case of Schema target namespaces. For one thing, it makes it easy for consumers of your schema to always find the correct definition. For another, if you have the power to put the document at a public URL, then you can also ensure that the URI is unique.
Finally: Uniform Resource Identifiers (URIs) are a superset of Uniform Resource Locators (URLs). You can also have a Uniform Resource Name (URN), and I believe (but don’t have the spec handy) that there is a third form of identifier.