Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
632 views
in Technique[技术] by (71.8m points)

xsd - 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.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...