📄 rfc3367.txt
字号:
While there is no exact algorithm for loop detection that clients are
encouraged to support, these status messages can be used by the
server to be clear about what Services and Datasets it considers to
have been queried. It is up to the client to decide what to do with
these messages and how closely it attempts to do loop detection.
4.2.6 Discoverability: ServiceQuery and Schema
A subclass of Query, the ServiceQuery object supports the dynamic
discovery of a specific CNRP service's characteristics. Note that
CNRP compliance does not require that a service fully implements
discoverability. In particular, returning the Service object with
its serviceuri constitutes a minimal yet sufficient compliant
implementation. Nevertheless, we expect that advanced CNRP services
will choose to return a full description of their supported
interfaces.
The complete response to a servicequery returns the Service object
described in section 5.3.2 with the following schema information:
1. The base and custom properties used by the CNRP service (Property
schema),
2. The properties used to describe the Service object (Service
schema),
3. The properties that belong to the query interface (Query schema),
4. The properties that belong to a resource within the results
(Resource schema).
These leads to the following new object definitions:
o propertyschema -- A property schema describes all the custom
properties that are part of the service.
o propertydeclaration -- A property declaration describes a base or
custom property used by the CNRP service. A property declaration
has a name and a type (the name and the type of the property that
it refers to). Note that as part of the property schema, one MUST
declare both existing and newly defined properties.
o propertyreference -- A property reference is a reference to a
property declaration so that a given schema (a service, query or
resource schema) can declare the property within its interface.
Note that a property reference specify whether the use of the
property is required or optional only.
Popp, et. al. Standards Track [Page 24]
RFC 3367 Common Name Resolution Protocol (CNRP) August 2002
o serviceschema -- The service schema defines the properties used to
describe the service.
o queryschema -- A query schema describes the structure of a query
handled by the CNRP service. The properties referred within the
query schema are part of the query interface of the resolution
service.
o resourcedescriptorschema -- A ResourceDescriptor schema describes
the resource returned as a result by the CNRP service.
For example, a CNRP query to discover a service's capabilities will
be in the form:
<cnrp> <servicequery/> </cnrp>
And for a CNRP service for cocktail recipes in French, the
corresponding response would be:
<service>
<serviceuri>http://cnrp.recipe.com</serviceuri>
<propertyschema>
<propertydeclaration id="i1">
<propertyname>language</propertyname>
<propertytype>rfc1766</propertytype>
</propertydeclaration>
<propertydeclaration id="i2">
<propertyname>cocktailrecipe</propertyname>
<propertytype>freeform</propertytype>
</propertydeclaration>
</propertyschema>
<queryschema>
<propertyreference required="yes" ref="i1"/>
</queryschema>
<resourcedescriptorschema>
<propertyreference required="yes" ref="i1"/>
<propertyreference required="yes" ref="i2"/>
</resourcedescriptorschema>
</service>
This response stipulates that the service accepts the property
language as part of the query interface and returns
resourcedescriptors that contain both the language and cocktailRecipe
properties.
Popp, et. al. Standards Track [Page 25]
RFC 3367 Common Name Resolution Protocol (CNRP) August 2002
5. XML DTD for CNRP
<!-- The document tag -->
<!ELEMENT cnrp (query|results|servicequery)>
<!-- Used to request a Service object -->
<!ELEMENT servicequery EMPTY>
<!-- A query can either request a schema, a specific record by -->
<!-- id, or a common-name with a set of properties (or -->
<!-- assertions) about the entity doing the query. -->
<!ELEMENT query (id|(commonname,property*))>
<!ELEMENT id (#PCDATA)>
<!ELEMENT commonname (#PCDATA)>
<!-- NOTE: CNRP defines several well known properties -->
<!-- and types. See Appendix A for details. -->
<!ELEMENT property (#PCDATA)>
<!-- The name of the property -->
<!ATTLIST property name CDATA #REQUIRED>
<!-- The type of the property -->
<!ATTLIST property type CDATA "freeform">
<!ELEMENT results (status? |
( service+,
( status | resourcedescriptor | referral )*
)*
)>
<!ELEMENT resourcedescriptor (commonname,id,resourceuri,
serviceref, datasetref?,
description,
property*)>
<!ATTLIST resourcedescriptor id ID #IMPLIED>
<!-- The entire point of all this... -->
<!ELEMENT resourceuri (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT referral (serviceref, datasetref?)>
<!ATTLIST referral id ID #IMPLIED>
<!ELEMENT status (#PCDATA)>
<!ATTLIST status code CDATA #REQUIRED>
<!ATTLIST status ref IDREF #IMPLIED>
<!-- serviceRef is used to point to one of a set of provided -->
<!-- service objects. This is so that a resource can point to -->
Popp, et. al. Standards Track [Page 26]
RFC 3367 Common Name Resolution Protocol (CNRP) August 2002
<!-- which service it came from. We could include the entire -->
<!-- service object but then we would be repeating large -->
<!-- amounts of information. -->
<!ELEMENT serviceref EMPTY>
<!ATTLIST serviceref ref IDREF #IMPLIED>
<!ELEMENT service (serviceuri, dataset*,
servers?,
description?,
property*,propertyschema?,queryschema?,resourcedescriptorschema?,
serviceschema?)>
<!-- The time to live of the schema in seconds since it was -->
<!-- retrieved -->
<!ATTLIST service ttl CDATA "0">
<!ATTLIST service id ID #IMPLIED>
<!ELEMENT serviceuri (#PCDATA)>
<!ELEMENT servers (server+)>
<!ELEMENT server (serveruri, property*)>
<!ELEMENT serveruri (#PCDATA)>
<!ELEMENT dataset (property*)>
<!ATTLIST dataset id ID #IMPLIED>
<!ELEMENT datasetref EMPTY>
<!ATTLIST datasetref ref IDREF #IMPLIED>
<!ELEMENT propertyschema (propertydeclaration*)>
<!ELEMENT propertydeclaration (propertyname, propertytype*)>
<!ATTLIST propertydeclaration id ID #IMPLIED>
<!ELEMENT propertyname (#PCDATA)>
<!ELEMENT propertytype (#PCDATA)>
<!-- This specifies if the type is meant to be the default -->
<!-- type. This is usually reserved for "freeform". -->
<!ATTLIST propertytype default (no|yes) "no">
<!-- The properties you can use in a query -->
<!ELEMENT queryschema (propertyreference*)>
<!-- The properties you can expect to see in an Resource -->
<!ELEMENT resourcedescriptorschema (propertyreference*)>
<!-- The properties you can expect to find in a Service -->
<!-- definition -->
<!ELEMENT serviceschema (propertyreference*)>
<!ELEMENT propertyreference EMPTY>
Popp, et. al. Standards Track [Page 27]
RFC 3367 Common Name Resolution Protocol (CNRP) August 2002
<!-- This specifies if a property is required as part of -->
<!-- the query. -->
<!ATTLIST propertyreference ref IDREF #REQUIRED>
<!ATTLIST propertyreference required (no|yes) "no">
6. Examples
6.1 Service Description Request
This is what the client sends when it is requesting a servers schema.
<?xml version="1.0"?>
<!DOCTYPE cnrp PUBLIC "-//IETF//DTD CNRP 1.0//EN"
"http://ietf.org/dtd/cnrp-1.0.dtd">
<cnrp>
<servicequery />
</cnrp>
This is the result. Notice how the Service tag is used to allow the
service to describe itself in its own terms.
<?xml version="1.0"?>
<!DOCTYPE cnrp PUBLIC "-//IETF//DTD CNRP 1.0//EN"
"http://ietf.org/dtd/cnrp-1.0.dtd">
<cnrp>
<results>
<service ttl="43200">
<serviceuri>urn:foo:bar</serviceuri>
<servers>
<server>
<serveruri>http://host1.acmecorp.com:4321/foo?</serveruri>
</server>
<server>
<serveruri>smtp://host2.acmecorp.com:4321/foo?</serveruri>
</server>
</servers>
<description>This is the Acme CNRP Service</description>
<!-- This property means that Acme specializes in
tradename services -->
<property name="category" type="naics">544554</property>
<property name="BannerAdServer" type="uri">
http://adserver.acmecorp.com/
</property>
<propertyschema>
<propertydeclaration id="i1">
<propertyname>workgroupID</propertyname>
<propertytype default="yes">freeform</propertytype>
<propertytype default="no">domainname</propertytype>
Popp, et. al. Standards Track [Page 28]
RFC 3367 Common Name Resolution Protocol (CNRP) August 2002
</propertydeclaration>
<propertydeclaration id="i2">
<propertyname>BannerAdServer</propertyname>
<propertytype default="yes">URI</propertytype>
</propertydeclaration>
</propertyschema>
<queryschema>
<propertyreference ref="i1" required="yes" />
</queryschema>
<resourcedescriptorschema>
<propertyreference ref="i1" required="yes" />
</resourcedescriptorschema>
<serviceschema>
<propertyreference ref="i2" required="yes" />
</serviceschema>
</service>
</results>
</cnrp>
6.2 Sending A Query and Getting A Response
This is the query that is sent from the client to the server:
<?xml version="1.0"?>
<!DOCTYPE cnrp PUBLIC "-//IETF//DTD CNRP 1.0//EN"
"http://ietf.org/dtd/cnrp-1.0.dtd">
<cnrp>
<query>
<commonname>Fido</commonname>
<property name="geography" type="iso3166-2">
CA-QC</property>
<property name="geography" type="iso3166-1">CA</property>
<property name="language" type="rfc1766">fr-CA</property>
</query>
</cnrp>
This is the result set. It is sent back in response to the query.
This result set includes a referral and a non-fatal error.
<?xml version="1.0"?>
<!DOC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -