Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Must an XML namespace name URI be retrievable?

I have the following tags on my WSDL:

<?xml version='1.0' encoding='UTF-8'?>
<definitions name="" targetNamespace="http://xxxxx/ws"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:s0="http://xxxxx/ws"
             xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema attributeFormDefault="qualified" 
                elementFormDefault="qualified"
                targetNamespace="http://xxxxx/ws/comments" 
                xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                xmlns:s0="http://xxxxx/ws" 
                xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/" 
                xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                xmlns:tns="http://xxxxx/ws" 
                xmlns:tnsc="http://xxxxx/ws/comments" 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                xmlns:y="http://new.webservice.namespace">

The types are thereafter qualified to a be in the s0,s1... namespaces.

The question is whether the namespace end-point(="http://xxxxx/ws") needs to be a valid url?
If the endpoint no longer exists - does it mean that we need to re-generate the stub proxy for the Web Service again?

Note: The endpoint of the Web Service itself is different from that of the namespaces and does still exist.

like image 297
IUnknown Avatar asked Dec 23 '14 04:12

IUnknown


People also ask

What is URI in XML namespace?

A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource. The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address. Another, not so common type of URI is the Uniform Resource Name (URN).

What is an XML namespace A set of names?

What Is an XML Namespace? An XML namespace is a collection of names that can be used as element or attribute names in an XML document. The namespace qualifies element names uniquely on the Web in order to avoid conflicts between elements with the same name.

Why is XML namespace needed?

One of the primary motivations for defining an XML namespace is to avoid naming conflicts when using and re-using multiple vocabularies. XML Schema is used to create a vocabulary for an XML instance, and uses namespaces heavily.

Can XML have multiple namespaces?

When you use multiple namespaces in an XML document, you can define one namespace as the default namespace to create a cleaner looking document. The default namespace is declared in the root element and applies to all unqualified elements in the document. Default namespaces apply to elements only, not to attributes.


1 Answers

Namespaces are URIs that need not be retrievable

From @jww question:

The question is whether the namespace end-point(="http://xxxxx/ws") needs to be a valid url?

No, an XML namespace takes the lexical form of a URI but does not have to be retrievable according to W3C Recommendation: Namespaces in XML 1.0 (Third Edition):

The attribute's normalized value MUST be either a URI reference — the namespace name identifying the namespace — or an empty string. The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists).

Why are URIs used if they need not be retrievable?

From @jww follow-up in comments:

What is the purpose of http: if its not retrievable? Shouldn't they use something like null: to signal its private? Otherwise, how do folks like me know when it's private, and when it's deprecated or withdrawn? I guess what I am asking is, what is the signalling mechanism?

Many, including myself, do indeed recommend that the namespace URI be retrievable as a document or as the governing XSD itself. However, as shown above it is not required. Further, a conformant, validating XML processor need not even report when a namespace name is not a URI:

To conform to this specification, a processor MUST report violations of namespace well-formedness, with the exception that it is not REQUIRED to check that namespace names are URI references [RFC3986].

For this reason, you'll sometimes see non-URI used in namespace names, especially for quick, throw-away examples. (However, it's probably better to use http://www.example.org/topic in such cases to be proper.)

URIs are used because they are a convenient mechanism for expressing uniqueness of a resource with a built-in authority specification -- the owner of the domain is the one responsible for namespaces defined using the domain.

Namespaces as endpoints

From @jww follow-up in comments:

If the endpoint no longer exists - does it mean that we need to re-generate the stub proxy for the webservice again?

No, and you should not even refer to the namespace as an endpoint. The retrievability of the namespace name URI has no bearing at anytime on the specification or operation of your Web Service.

like image 176
kjhughes Avatar answered Oct 05 '22 01:10

kjhughes