监理公司管理系统 | 工程企业管理系统 | OA系统 | ERP系统 | 造价咨询管理系统 | 工程设计管理系统 | 签约案例 | 购买价格 | 在线试用 | 手机APP | 产品资料
X 关闭

Web服务:WS-Inspection 1.0

申请免费试用、咨询电话:400-8352-114

AMTeam.org

Web服务:WS-Inspection 1.0  

 
 
作者(按字母顺序排列):

Keith Ballinger,Microsoft

Peter Brittenham,IBM

Ashok Malhotra,Microsoft

William A. Nagy,IBM

Stefan Pharies,Microsoft

2001 年 11 月

Copyright?001 International Business Machines Corporation, Microsoft

摘要

WS-Inspection 规范提供了用来帮助探察某个站点以获得可用服务的 XML 格式,以及提供了一组关于怎样使与探察相关的信息可用于消费的规则。WS-Inspection 文档提供了一种方法,来聚集对预先存在的服务描述文档的引用,这些文档已经用多种格式创建好了。然后这些探察文档就可以在服务的提供点探察服务,也可以通过可放在内容媒体(如 HTML 中)的引用来获得服务。

现状

这篇草案代表了 IBM 和 Microsoft 内部对当前关于定位和探察服务的思想。它巩固了 ADS 和 DISCO(该领域早一些的建议)中建立的观念。

1. 介绍

我们建议规范在不同级别和从不同角度描述 Web 服务。所建议的“Web 服务描 述语言”(WSDL)[1] 的目标是在功能级描述服务。通用描述、发现和集成(Universal Description, Discovery, and Integration(UDDI))[2] 模式旨在从一种更以商务为中心的角度来描述。所建议的这些标准还没有赋予这样一种能力,即在服务的提供点能够用一种既容易创建又容易使用的方式将这些不同的信息源绑在一起。WS-Inspection 规范通过定义一种 XML 语法达到这种要求,这种语法使聚集对不同类型服务描述文档的引用更方便,然后为这种语法的实例提供定义完好的使用模式。这样做,WS-Inspection 规范文档提供了一种方法,通过这种方法来探察站点以获取服务来源。

资源库已经存在,关于 Web 服务的描述信息在此集中在一起。WS-Inspection 规范提供了可用来引用和使用这些现有的资源库的机制,这样如果副本不需要,就没有必要复制其中包含的信息。

1.1 设计目标

WS-Inspection 规范的两个主要设计目标是简单性和可扩展性。WS-Inspection 文档本质上是指向描述服务文档指针的集合。结果,编写和维护 WS-Inspection 文档相当容易。因为一个 WS-Inspection 文档可能指向各种服务描述文档格式,所以可以创建这样的 WS-Inspection 文档,这些 WS-Inspection 文档允许文档消费者从可用的描述中精心挑选,并且允许只访问那些他们能理解的文档。当新的描述格式出现,能够将新的引用添加到现有的 WS-Inspection 文档,而不需要对基本的 WS-Inspection 模式进行修改。

1.2 WS-Inspection 文档示例

以下是用于单个服务(提供股票报价信息)的简单的 WS-Inspection 文档示例。该服务有一个相应的 HTTP 可访问 WSDL 文档,它描述了服务的接口。

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/">
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/stockquote.wsdl" />
  </service>
</inspection>

下一个示例展示了用于提供金融工具的两个服务的 WS-Inspection 文档。提供股票报价的第一个服务有两个可用的描述;一个用 HTTP 可访问 WSDL 文档,另一个用 UDDI 目录。提供计算器的第二个服务只由一个匿名的 FTP 可访问 WSDL 文档形式描述。WS-Inspection 文档还包含到另一个 WS-Inspection 文档的链接。

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
            xmlns:wsiluddi="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/">
  <service>
    <abstract>A stock quote service with two descriptions</abstract>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/stockquote.wsdl"/>
    <description referencedNamespace="urn:uddi-org:api">
       <wsiluddi:serviceDescription location="
http://www.example.com/uddi/inquiryapi">
         <wsiluddi:serviceKey>4FA28580-5C39-11D5-9FCF-BB3200333F79</wsiluddi:serviceKey>
       </wsiluddi:serviceDescription>
    </description>
  </service>
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
ftp://anotherexample.com/tools/calculator.wsdl"/>
  </service>
  <link referencedNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
        location="
http://example.com/moreservices.wsil"/>
</inspection>

第 2 节中提供了这两个示例中用到的元素的详细描述。

注意:对于这些示例,假设每一个引用的 WSDL 文档只包含一个 WSDL service 元素。请参阅第 3 节以获取更多的信息。

1.3 表意约定

该文档中的关键词“必须”、“一定不能”、“要求的”、“将”、“将不”、“应该”、“不应该”、“推荐的”、“可以”以及“可选的”,解释如 RFC-2119 [3] 中所述。

贯穿全文使用以下名称空间前缀:
 
该规范使用非正规的句法描述 WS-Inspection 文档的 XML 语法。

句法以 XML 实例出现,但值表示数据类型而不是实际的值。

附加在元素和属性后的字符如下:“?”(0 或 1 个)、“*”(0 或多个)、“+”(1 或多个)。

以“...叀保ū热?< element...?> 或 < element...?gt;)结尾的元素名称表示省略了与上下文无关的元素/属性。

文档中以粗体表示的语法以前没有介绍过,或者是示例中特别感兴趣的地方。

<-- extensibility element --> 是用于来自“其它”名称空间的占位符(比如 XSD 中的 ##other)。

XML 名称空间前缀(上面定义的)用来表示正被定义的元素的名称空间。

以 <?xml 开始的示例包含充足的信息,它们遵循该规范;其它示例是片断,并且为了与规范一致需要指定附加的信息。

2.0 探察文档定义

这一节描述 WS-Inspection 语言的核心元素。WSDL 和 UDDI 的绑定扩展在第 3 和第 4 节中讨论。

2.1 WS-Inspection 文 档结构

WS-Inspection 文档的根包含一个 inspection 元素,并且引用个别服务描述或链接到服务描述集合,这些服务描述或服务描述集合的链接作为其子孙元素。WS-Inspection 文档的语法如下:

<wsil:inspection>
  <wsil:abstract xml:lang=""? ... /> *
  <wsil:service> *
    <wsil:abstract xml:lang=""? ... /> *
    <wsil:name xml:lang=""? ... /> *
    <wsil:description referencedNamespace="uri" location="uri"?> *
      <wsil:abstract xml:lang=""? ... /> *
      <-- extensibility element --> ?
    </wsil:description>
  </wsil:service>
  <wsil:link referencedNamespace="uri" location="uri"?/>  *
    <wsil:abstract xml:lang=""? ... /> *
    <-- extensibility element --> ?
  </wsil:link>
</wsil:inspection>

有一个附加的约束,即 inspection 元素“必须”包含至少一个 service 子元素或 link 子元素,并且“可以”包含两者的组合。包含以上约束的语法的更准确的定义可以在“附录 2”中找到。示例中的每一个元素在下面相应的节中描述。

2.1.1 语言可扩展性和绑定

在 WS-Inspection 规范中,术语绑定是指将特定的描述格式/检索相关的信息与更抽象的 WS-Inspection 实体相关联的过程。例如,什么类型的信息可以在被引用的特定类型文档中,或者在检索这类文档有关的的信息中找到?描述这个问题的线索需要使用特定于描述格式的绑定。WS-Inspection 规范使元素能在 description 和 link 元素中代表一种特定的技术(这里指可扩展性元素)。可扩展性元素“必须”使用 XML 名称空间,与基本 WS-Inspection 语言有所不同。

可扩展性元素允许调用处理服务描述,而不必修改基本的 WS-Inspection 规范。本文档建议定义这种描述格式的规范也定义引用它们所需的任何必需的 WS-Inspection 扩展。

请参阅第 3 和第 4 节获取定义为基本 WS-Inspection 规范的部分的可扩展性元素的示例。

2.1.2 文档

WS-Inspection 规范使用可选的 abstract 元素作为可以放置小文本描述的容器。该元素的内容旨在供人消费。允许有子元素的任何基本 WS-Inspection 语言元素允许使用 abstract 元素。

可选的 xml:lang 属性(在 [5] 中定义)可以在一个元素中指定,它指出 abstract 元素是用哪一种语言编写的。具有相同 xml:lang 属性值的多个 abstract 元素“可以”作为同级元素出现。

2.2 服务

service 元素作为服务引用描述集合间的描述者。一个 inspection 元素中可以包含多个 service 元素。每一个 service 元素“可以”有一个或多个 abstract 元素以及一个或多个 name 元素,并且“必须”至少有一个 description 元素,但“可以”有多个。

2.2.1 服务的文本描述

一个或多个 abstract 元素可以用在一个 service 元素中,用来提供可放置关于该 service 的小文本描述的位置。该 abstract 的内容用来供人消费,并且只用来提供一小段关于服务的有用信息。至于接收 WS-Inspection 文档,工具可以使用这个字段来询问用户:他们是否想得到更多的关于该服务的信息,而不要求预先得到任何引用的描述。取代更完整的服务描述语言不是该元素的目的。

通过使用指向完善的描述文档的 description 元素“可以”添加更复杂的文档集。

2.2.2 服务名称

name 元素可以用来将一个名称与特殊的服务相关联。同 abstract 元素一样,name 元素只用来供人消费,并且不保证是唯一的。

可选的 xml:lang 属性可以在元素中指定,指出 name 元素是用哪一种语言编写的。具有相同 xml:lang 属性值的多个 name 元素“可以”作为同级元素出现。

2.2.3 服务描述引用

探察中最有用的部分是 description 元素中包含的信息。这些元素可以用来提供指向各种形式的服务描述文档的指针,允许消费者只处理他们觉得有用的内容。 referencedNamespace 属性标识引用文档所属的名称空间。例如,指向 WSDL 文档的 description 元素中的 referencedNamespace 属性的值将是“http://schemas.xmlsoap.org/wsdl/”。WS-Inspection 文档的消费者可以使用 referencedNamespace 属性来确定它是不是他们要检索的引用的描述文档的值。

可选的 location 属性“可以”用来提供实际的对描述的引用。location 属性的值“必须”是有效的 URL,并且使用这个 URL 中指定方案的主要访问机制,“必须”可以从 URL 检索到描述(例如,对于一个 HTTP URL,在所提供的 URL 通过执行 HTTP GET,必须可检索到文档)。如果使用主要的访问机制不能检索到文档,或者为了进行检索需要更多的信息,那么“必须”使用可扩展性机制指定该信息。

一个可扩展性元素“可以”出现在 description 元素下,提供检索或处理服务描述所需的任何附加信息,或者提供关于描述文档内容的线索(可以证明对于消费者决定是不是应该检索那个特殊服务描述是很有用的)。用到的可扩展性元素“必须”是受支持的绑定,如果存在一个可扩展元素,由父 description 元素的 referencedNamespace 属性指定文档名称空间。如果绑定的定义包含在这个规范中且作为规范的部分,或者如果绑定通过所绑定描述机制规范的控制体达成一致,那么绑定是“受支持的”。如果一个特殊的描述机制没有受支持的绑定,那么不保证互操作性。

虽然应该做每一种尝试来确保 WS-Inspection 文档中包含的信息是准确的,但文档的消费者“一定不能”假定所提供的信息正好与所引用文档的信息匹配。虽然绑定可以用来提供关于引用文档的线索,但它们“一定不能”用作最终的服务描述信息源。

WS-Inspection 文档的作者必须做每一种尝试来确保文档中包含的信息是准确的,但是文档的消费者“一定不能”假定所提供的信息正好与所引用的文档的信息匹配。必须通过检索和处理所引用的文档作出最终决定。

2.3 到其它探察文档和相关集合信息源的链接

link 元素允许 WS-Inspection 文档引用附加的服务描述集合,比如其它 WS-Inspection 文档或 UDDI 资源库。

例如,使用如下形式的 link 元素,可以创建 WS-Inspection 文档分层:

<wsil:link referencedNamespace="http://schemas.xmlsoap.org/ws/2001/10/inspection/"
           location="uri of WS-Inspection document">

因为许多服务描述只在其它信息注册中心(如 UDDI)中发布,link 元素能使服务提供者免于必须用大量 service 元素(它们只包含同一个 description 元素)创建探察文档,所有的 link 元素都指向信息注册中心中的同一位置。通过使用如下形式的 link 元素,服务提供者能够给消费者指明 WS-Inspection 链接,他们应该在所指明的位置查找附加的服务描述集合:

<wsil:link referencedNamespace="uri" location="uri"?>
  <-- extensibility element -->
</wsil:link>

这使提供者能够引用预先存在的信息,同时仍然允许通过 WS-Inspection 探察过程发现它。

link 元素“必须”只用来引用定义完好的服务描述集合,比如 WS-Inspection 文档和 UDDI businessEntitie。

link 元素中的 referencedNamespace 属性标识链接的集合源的名称空间。使用 URL 中指定方案的主要访问机制,如果源可从这个 URL 检索到,可选的 location 属性“可以”用来提供实际的到源的链接。如果使用主要的访问机制不能检索集合,那么“必须”使用可扩展性机制指定该信息。

一个可扩展性元素“可以”出现在 link 元素下,提供检索已链接的集合所需的任何附加信息。可扩展性元素“必须”是受支持的绑定,绑定由父 link 元素的 referencedNamespace 属性指定文档名称空间。请参阅第 2.2.3 节被支持绑定的定义。

WS-Inspection 规范没有为处理 link 元素指定模式:消费者“可以”使用他们所希望的链接,而服务提供者“一定不能”假定它们能完全可用。此外,WS-Inspection 规范没有将任何限制强加于由引用创建的结构,这样就由 WS-Inspection 文档的处理器来确保周期的引用不会无限制地进行下去。

下面的示例展示了包含两个到其它 WS-Inspection 文档链接的 WS-Inspection 文档:

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/">
  <link referencedNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
        location="
http://example.com/financial/services.wsil"/>
  <link referencedNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
        location="
http://example.com/purchasing/poservices.wsil"/>
</inspection>

3.0 WSDL 绑定

WS-Inspection 规范包含 WSDL 1.1 绑定,并且提供了以下的功能:

出现在引用的 WSDL 文档中的 WSDL 绑定的类型的指示

如果几个服务存在于同一文档中,正在引用哪一个 WSDL 服务的规范

特殊的引用的 WSDL 文档是不是正提供端点信息的指示

请注意如果引用的 WSDL 文档有一个或没有 service 元素,使用 WSDL 绑定是“可选的”。 在这些情况中,“可以”只用 description 元素引用 WSDL 文档。如果引用的 WSDL 文档有多个的 service 元素,那么 WSDL 绑定“必须”用来表示正在引用哪一个 service 元素。

WS-Inspection 规范允许引用任何 WSDL 文档,而不用考虑文档的内容。可以引用单个服务的 WSDL 描述的任何部分(这个描述包含在可检索单元中,比如单个文件)。唯一强制的约束是同一 WS-Inspection 服务的两个引用的 WSDL 文档“不可以”包含相冲突的信息。这种机制“一定不能”用作 WSDL import 元素的替代品;它们不是等同的。

因为 WSDL 是一种描述格式,它没有为其文档指定检索机制,这种绑定只能应用于 WS-Inspection description 元素。

3.1 WSDL 绑定怎样扩展 WS-Inspection 规范

WSDL 绑定使用以下的扩展元素扩展 WS-Inspection 规范:

<inspection xmlns:wsilwsdl="http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/ ...>
  <service ...>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="uri">
      <wsilwsdl:reference endpointPresent="boolean"?>
        <wsilwsdl:referencedService>qname</wsilwsdl:referencedService> ?
        <wsilwsdl:implementedBinding>qname</wsilwsdl:implementedBinding> *
      </wsilwsdl:reference>
    </description>
  </service>
</inspection>

在下一节中描述了包含附加限制的 WSDL 扩展的解释。

3.2 wsilwsdl:reference

WS-Inspection WSDL 绑定元素 reference 作为其余绑定信息的容器元素。reference 元素“可以”有 endpointPresent 属性、单个 referencedService 子元素和/或一个或多个 implementedBinding 子元素,但“必须”至少有三个中的一个。

endpointPresent 属性“可以”用来表示引用的文档是不是包含端点信息。如果这个属性有一个布尔值为 true(或 1),那么引用的 WSDL 文档“必须”包含 service 元素。如果该属性有一个布尔值为 false(或 0),那么引用的 WSDL 文档“一定不能”包含 service 元素。只查询服务端点信息的 WS-Inspection 消费者可以选择探察该属性来确定能不能检索到引用的 WSDL 文档。

下面的示例展示了用于股票报价服务(在第 1.2 节中出现)的 WS-Inspection 文档。在该例中,假设描述服务的文档被分成三个文件,用“main”文件导入其它两个。

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
            xmlns:wsilwsdl="
http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/">
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/stockquote/main.wsdl">
    </description>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/stockquote/bindings.wsdl">
       <wsilwsdl:reference endpointPresent="false"/>
    </description>
  </service>
</inspection>

请注意三个 WSDL 文件中只有两个创建了引用。正如前面所陈述的,WS-Inspection 规范没有将任何限制强加在引用的 WSDL 信息上。

3.2.1 wsilwsdl:referencedService

虽然 WSDL 允许在单个文档中描述多个服务,但是 WS-Inspection 引用对应于每个服务。 如果引用的 WSDL 文档包含多个的 WSDL service 元素,那么 WS-Inspection WSDL 绑定的 referencedService 元素“必须”用来指定正在引用哪一个服务。由 referencedService 元素指定的 QName“必须”是与引用的 WSDL 文档中的服务相对应的有效的 QName。

下面的示例展示了股票报价和计算器服务(在第 1.2 节中出现)的 WS-Inspection 文档。在该例中,假设 WSDL 文档包含对多个金融服务的描述。

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
            xmlns:wsilwsdl="
http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/">
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/finance.wsdl">
       <wsilwsdl:reference>
         <wsilwsdl:referencedService xmlns:ns1="
http://example.com/finance.wsdl">
            ns1:StockQuoteService<wsilwsdl:referencedService>
       </wsilwsdl:reference>
    </description>
  </service>
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/finance.wsdl">
       <wsilwsdl:reference>
         <wsilwsdl:referencedService xmlns:ns1="
http://example.com/finance.wsdl">
            ns1:CalculatorService<wsilwsdl:referencedService>
       </wsilwsdl:reference>
    </description>
  </service>
</inspection>

3.2.2 wsilwsdl:implementedBinding

implementedBinding 元素“可以”用来表示出现在引用的 WSDL 文档的绑定的类型。reference 元素“可以”有多个 implementedBinding 元素作为子元素。由 implementedBinding 元素指定的 QName“必须”是与引用 WSDL 文档中绑定相对应的有效的 QName。

下面的示例展示了股票报价和计算器服务(在第 1.2 中出现)的 WS-Inspection 文档。第一个服务有对 WSDL 描述的引用,它实现两个绑定:http://example.com/stockquote.wsdl/StockQuoteSoapBindinghttp://example.com/stockquote.wsdl/StockSymbolLookupSoapBinding。第二个服务也有对 WSDL 描述的引用,但它不提供关于该文档中所包含绑定的任何附加信息。

<?xml version="1.0"?>
<inspection xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
            xmlns:wsilwsdl="
http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/">
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/stockquote.wsdl">
     <wsilwsdl:reference>
         <wsilwsdl:implementedBinding xmlns:ns1="
http://example.com/stockquote.wsdl">
ns1:StockQuoteSoapBinding</wsilwsdl:implementedBinding>
         <wsilwsdl:implementedBinding xmlns:ns1="
http://example.com/stockquote.wsdl">
ns1:StockSymbolLookupSoapBinding</wsilwsdl:implementedBinding>
       </wsilwsdl:reference>
    </description>
  </service>
  <service>
    <description referencedNamespace="
http://schemas.xmlsoap.org/wsdl/"
                 location="
http://example.com/tools/calculator.wsdl"/>
  </service>
</inspection>

4.0 UDDI 绑定

许多服务描述将存储在 UDDI 注册中心,因此 WS-Inspection 规范为对该信息的引用提供一组使用模式。这通过使用一组 UDDI 可扩展性元素来完成,这些可扩展性元素提供对来自版本 1 和版本 2 UDDI 规范的 UDDI businessEntity 或 businessService 条目的引用。两个版本的这种绑定是同样的,除了用来代表它们的模式不同之外。引用版本 1 UDDI 文档的 link 或 description 元素中的 referencedNamespace 属性值为“urn:uddi-org:api”,而引用版本 2 文档时值为“urn:uddi-org:api_v2”。

4.1 UDDI 绑定怎样扩展 WS-Inspection 规范

UDDI 绑定使用如下的扩展元素扩展 WS-Inspection 规范:

<inspection (xmlns:wsiluddi://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/
             | xmlns:wsiluddi://schemas.xmlsoap.org/ws/2001/10/inspection/uddiv2/) ... >
  <link ... >
    <wsiluddi:businessDescription location="uri"?>
      <wsiluddi:discoveryURL useType="nmtoken"> ?
      <wsiluddi:businessKey> ?
    </wsiluddi:businessDescription>
  </link>

  <service ... >
    <description ... >
     <wsiluddi:serviceDescription location="uri"?>
        <wsiluddi:discoveryURL useType="nmtoken"> ?
        <wsiluddi:serviceKey> ?
      </wsiluddi:serviceDescription>
    </description>
  </service>
</inspection>

在下面几节中描述了这些 UDDI 扩展的解释。

4.2 wsiluddi:businessDescription

选择在 UDDI 中注册其服务描述的用户可以创建 WS-Inspection 引用,它引导消费者使用 UDDI 来发现服务描述信息。WS-Inspection link 元素,与 UDDI 可扩展性元素一起,描述了应该检索哪一个记录。对于 UDDI,link 元素将只包含 referencedNamespace 属性。当 link 元素包含 UDDI businessDescription 元素时,它不使用 location 属性。下面的示例说明了这种用法:

<?xml version="1.0"?>
<inspection targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
    xmlns:wsiluddi="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/"
    xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/">
  <link referencedNamespace="urn:uddi-org:api">
    <wsiluddi:businessDescription location="
http://www.example.com/uddi/inquiryapi">
      <wsiluddi:businessKey>3C9CADD0-5C39-11D5-9FCF-BB3200333F79</wsiluddi:businessKey>
      <wsiluddi:discoveryURL useType="businessEntity">
       
http://www.example.com/uddi?3C9CADD0-5C39-11D5-9FCF-BB3200333F79
      </wsiluddi:discoveryURL>
    </wsiluddi:businessDescription>
  </link>
</inspection>

当使用 UDDI 扩展元素时,link 元素必须包含对 UDDI 名称空间的引用。这表示由该元素包含的扩展性元素用来引用 UDDI businessEntity。使用 businessDescription 元素指定 WS-Inspection 扩展。link 元素必须包含 UDDI businessKey 元素、UDDI discoveryURL 元素,或者二者兼有。

businessKey 元素的值连同 UDDI get_businessDetail 消息一起被使用。要使用 businessKey,businessDescription 元素必须包含 location 属性。该属性的值是 UDDI 注册中心查询接口的 URL,它用来以 get_businessDetail 消息向注册中心发出 HTTP POST。 对该消息的响应是与业务关键字相关的 UDDI businessEntity 记录。

如果提供了 discoveryURL 元素,可以通过 HTTP GET(根据该元素的值指定的 URL 发出)检索 UDDI businessEntity 记录。如果 businessKey 元素和 discoveryURL 元素都提供了,那么 WS-Inspection 文档的消费者可以选择用哪一种方法检索记录。

4.3 wsiluddi:serviceDescription

也可以通过 WS-Inspection 文档对存在于 UDDI 中的单个服务描述的引用进行引用。通过使用 description 元素以及添加的可扩展性元素,可以检索到正确的记录。下面的示例说明了这种用法:

<?xml version="1.0"?>
<inspection targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
    xmlns:wsiluddi="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/"
    xmlns="
http://schemas.xmlsoap.org/ws/2001/10/inspection/">
  <service>
    <name>UDDI Service Description</name>
    <description referencedNamespace="urn:uddi-org:api">
     <wsiluddi:serviceDescription location="
http://www.example.com/uddi/inquiryapi">
        <wsiluddi:serviceKey>4FA28580-5C39-11D5-9FCF-BB3200333F79</wsiluddi:serviceKey>
        <wsiluddi:discoveryURL useType="businessEntity">
         
http://www.example.com/uddi?3C9CADD0-5C39-11D5-9FCF-BB3200333F79
        </wsiluddi:discoveryURL>
      </wsiluddi:serviceDescription>
    </description>
  </service>
</description>

WS-Inspection description 元素使用 serviceDescription 扩展元素包含对单个 UDDI 服务描述的引用。UDDI serviceKey 元素必须作为 serviceDescription 元素的子元素出现。用 serviceKey 元素的值连同 UDDI get_serviceDetail 消息来检索 UDDI 服务描述。

UDDI discoveryURL 元素也可以作为 serviceDescription 元素的子元素出现。如果提供了 discoveryURL 元素,它可以用来通过 HTTP GET 检索 UDDI businessEntity。使用指定的 serviceKey 从 UDDI businessEntity 中抽取单个服务描述。

5.0 开发附加绑定

正如第 2.2.3 节所说明的,在大多数普通的 WS-Inspection 文档中可以使用简单的 description 元素引用大多数描述文档,而不需要提供任何附加信息。但是,如前面提到的,有一些例子,比如用 UDDI,如果要检索所需要的信息,只通过 description 元素或 link 元素不能提供足够的信息。也有一些例子,比如用许多 WSDL 文档,能够提供关于所引用文档的附加信息是很有用的。虽然这个规范为两个最流行的服务描述机制(第 3.0 节中的 WSDL 和第 4.0 节中的 UDDI)创建了绑定,但是它对于所有其它预先存在的描述机制来说,这样做是行不通的。因此什么时候需要开发新的绑定,以及什么时候就其格式和用法达成协议将留给有关团体来决定。以下是一些有助于这些新的绑定设计的指导方针:

每一个绑定“可以”有一个根元素用来扩展 description 元素,一个根元素用来扩展 link 元素,但是每一种“一定不能”多于一个根元素。绑定“可以”使用相同的根元素来进行两种扩展。

绑定“必须”限制关于公开的所引用描述的信息量。取代描述文档不是 WS-Inspection 文档的目的。

绑定“可以”在合适的地方使用描述语言的元素,而绑定正是为该描述语言创建的,但是“应该”限制其相关的语义被修改的程度。

6.0 探察文档发布

至于推广服务的这个问题,WS-Inspection 语法只提供了部分解决方案。为定位和访问已创建的探察提供一致的方法要求有第二个组件。如果不能容易地定位 WS-Inspection 文档,那么这些 WS-Inspection 文档几乎不能提供什么增值。为此,WS-Inspection 规范为探察文档提供了两种使用方法,描述了它们应该放在什么地方,以及怎样找到它们。在下面的两小节中定义了这两种使用模式。

6.1 固定名称的探察文档

当 WS-Inspection 文档可用时,必须能容易地定位它。如果得到一个 URL,它不直接和 WS-Inspection 文档对应,并且可能不直接和任何一种类型的文档对应,那么使用已提供的并且仍然能够检索到任何与探察相关的文档(在该位置可以得到)的 URL 是所希望的。为此,名为 inspection.wsil 的 WS-Inspection 文档“可以”放在最通用的入口,该入口指向部署在定位的服务器上的 Web 站点和应用程序。

例如,example.com 公司将在其 Web 服务器的根部创建 inspection.wsil 文件(可以通过 http://example.com/inspection.wsil 得到)。如果他们通过 http://example.com/financialhttp://example.com/shipping 提供服务,那么他们也可以将 inspection.wsil 文件放在这些 URI 下,可以从这里访问。有可能根级的 inspection.wsil 文件可以只包含指向其它 WS-Inspection 文件的指针。

inspection.wsil 文档没有必要一定要是静态文档;它们“可以”根据请求动态地生成。

通过提供命名一致的 WS-Inspection 文件,可以容易地修改应用程序,来探察站点以获取可用的服务。

6.2 链接的探察文档

除了协助那些积极探察站点的用户,WS-Inspection 规范还考虑到提供一种机制,这种机制通过其它内容类型(比如 HTML 页面)告知用户与服务探察相关的文档。正是这种引用探察文档所采用的机制独立于内容类型,而在下面这一节中描述了 HTML 绑定。

6.2.1 在 HTML 内链接到探察文档

在 HTML 页面中,通过使用 META 标记(其 name 属性值为 serviceInspection),可以链接到 WS-Inspection 文档。标记中相应的 content 属性必须是表示 WS-Inspection 文档位置的有效 URI。典型的情况下,应该在高度可见的页面中包含该标记,如服务器的根文档。有可能通过在同一 HTML 页面内包含几个 META 标记引用多个 WS-Inspection 文档。content 属性中指定的位置上的文档“必须”是 WS-Inspection 文档;它不能是另一个 HTML 文档。

下面的示例展示了有三个对 WS-Inspection 文档引用的 HTML 代码段:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <META name="serviceInspection" content="localservices.wsil">
    <META name="serviceInspection" content="
http://www.example.com/calculators.wsil">
    <META name="serviceInspection" content="
ftp://www.anotherexample.com/translators.wsil">
  </HEAD>
  <BODY>
   ...
  </BODY>
</HTML>

7.0 参考文献

[1] Web 服务描述语言(Web Services Description Language(WSDL))1.1“http://www.w3.org/TR/2001/NOTE-wsdl-20010315”。

[2] 通用描述、发现和集成(Universal Description, Discovery, and Integration(UDDI))2.0“http://www.uddi.org”。

[3] S. Bradner 的“Key words for use in RFCs to Indicate Requirement Levels”,RFC 2119, Harvard University,1997 年 3 月。

[4] T. Berners-Lee、R. Fielding、L. Masinter 所著的“Uniform Resource Identifiers(URI):Generic Syntax”,RFC 2396,MIT/LCS,U.C. Irvine,Xerox Corporation,1998 年 8 月。

[5] 可扩展标记语言(Extensible Markup Language(XML))1.0“http://www.w3.org/TR/2001/NOTE-wsdl-20010315”。

A 1 URI 的注释

这一节没有直接对该规范进行讲述,但是提供了在实现规范时可能有用的背景资料。

A 1.1 XML 名称空间和模式位置

将 XML 模式的 targetNamespace 或者 XML 实例中的 xmln 属性的值等同于相应模式的位置,这是普遍的误解。事实上“名称空间”是 URI,并且 URI 可以是位置。因此您能够根据该位置来检索模式。但是这并不是意味着那是与名称空间相关联的唯一模式。可以有多个与一个特殊名称空间相关联的模式,并且由 XML 处理器确定在特殊的处理环境中使用哪一个模式。

A 1.2 相对 URI

贯穿该文档,您可以看到在 WS-Inspection 文档中使用了全限定 URI。使用全限定 URI 仅仅为了说明引用的概念。使用相对 URI 是完全允许的,并且在许多情况下得到保证。获取关于处理相对
URI 的信息,请参阅
http://www.normos.org/ietf/rfc/rfc2396.txt

A 2 完整的 WS-Inspection 语法

<wsil:inspection>
  <wsil:abstract xml:lang=""? ... /> *
[  <wsil:service>
     <wsil:abstract xml:lang=""? ... /> *
     <wsil:name xml:lang=""? ... /> *
     <wsil:description referencedNamespace="uri" location="uri"?> *
       <wsil:abstract xml:lang=""? ... /> *
       <-- extensibility element --> ?
     </wsil:description>
   </wsil:service>
|
   <wsil:link referencedNamespace="uri" location="uri"?/>
     <wsil:abstract xml:lang=""? ... /> *
     <-- extensibility element --> ?
   </wsil:link> ] +
</wsil:inspection>

A3 模式

A 3.1 WS-Inspection 模式

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
  xmlns:wsil="
http://schemas.xmlsoap.org/ws/2001/10/inspection/"
  xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
  xmlns="
http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified">

  <complexType name="typeOfAbstract">
    <simpleContent>
      <extension base="xsd:string">
        <attribute ref="xml:lang" use="optional"/>
      </extension>
    </simpleContent>
  </complexType>

  <complexType name="itemWithAbstracts" abstract="true">
    <sequence>
      <element name="abstract" type="wsil:typeOfAbstract" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
  </complexType>

  <complexType name="nameType">
    <simpleContent>
      <extension base="xsd:string">
        <attribute ref="xml:lang" use="optional"/>
      </extension>
    </simpleContent>
  </complexType>

  <complexType name="referenceType">
    <complexContent>
      <extension base="wsil:itemWithAbstracts">
        <attribute name="referencedNamespace" type="anyURI" use="required"/>
        <attribute name="location" type="anyURI" use="optional"/>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="descriptionType">
    <complexContent>
      <extension base="wsil:referenceType">
        <sequence>
          <any namespace="##other" minOccurs="0" processContents="lax"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="linkType">
    <complexContent>
      <extension base="wsil:referenceType">
        <sequence>
          <any namespace="##other" minOccurs="0" processContents="lax"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="serviceType">
    <complexContent>
      <extension base="wsil:itemWithAbstracts">
        <sequence>
          <element name="name" type="wsil:nameType" minOccurs="0" maxOccurs="unbounded"/>
          <element name="description" type="wsil:descriptionType" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="inspection">
    <complexType>
      <complexContent>
        <extension base="wsil:itemWithAbstracts">
          <sequence minOccurs='1' maxOccurs='unbounded'>
            <choice>
              <element name="service" type="wsil:serviceType"/>
              <element name="link" type="wsil:linkType"/>
            </choice>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

</schema>

A 3.2 WSDL 绑定模式

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/"
  xmlns:wsilwsdl="
http://schemas.xmlsoap.org/ws/2001/10/inspection/wsdl/"
  xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
  xmlns="
http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified">

  <complexType name="reference">
    <sequence>
      <element name="referencedService" type="xsd:QName" minOccurs="0"/>
      <element name="implementedBinding" type="xsd:QName" minOccurs="0" maxOccurs="unbounded" />
    </sequence>
    <attribute name="endpointPresent" type="xsd:boolean" use="optional"/>
  </complexType>

  <element name="reference" type="wsilwsdl:reference" />

</schema>

A 3.3 UDDI v1 绑定模式

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/"
  xmlns:wsiluddi="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddi/"
  xmlns:uddi="urn:uddi-org:api"
  xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
  xmlns="
http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified">

  <import namespace="urn:uddi-org:api" schemaLocation="http://www.uddi.org/schema/2001/uddi_v1.xsd"/>

  <complexType name="descriptionType">
    <sequence>
      <element name="discoveryURL" type="uddi:DiscoveryUrl" minOccurs="0"/>
    </sequence>
    <attribute name="location" type="anyURI" use="optional"/>
  </complexType>

  <!-- This element is to be used as a child of a WS-Inspection link -->
  <element name="businessDescription">
    <complexType>
      <complexContent>
        <extension base="wsiluddi:descriptionType">
          <sequence>
            <element name="businessKey" type="xsd:string" minOccurs="0"/>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <!-- This element is to be used as a child of a WS-Inspection description -->
  <element name="serviceDescription">
    <complexType>
      <complexContent>
        <extension base="wsiluddi:descriptionType">
          <sequence>
            <element name="serviceKey" type="xsd:string"/>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

</schema>

A 3.4 UDDI v2 绑定模式

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddiv2/"
  xmlns:wsiluddi="
http://schemas.xmlsoap.org/ws/2001/10/inspection/uddiv2/"
  xmlns:uddi="urn:uddi-org:api_v2"
  xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
  xmlns="
http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified">

  <import namespace="urn:uddi-org:api_v2" schemaLocation="http://www.uddi.org/schema/2001/uddi_v2.xsd"/>

  <complexType name="descriptionType">
    <sequence>
      <element name="discoveryURL" type="uddi:discoveryURL" minOccurs="0"/>
    </sequence>
    <attribute name="location" type="anyURI" use="optional"/>
  </complexType>

  <!-- This element is to be used as a child of a WS-Inspection link -->
  <element name="businessDescription">
    <complexType>
      <complexContent>
        <extension base="wsiluddi:descriptionType">
          <sequence>
            <element name="businessKey" type="uddi:businessKey" minOccurs="0"/>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <!-- This element is to be used as a child of a WS-Inspection description -->
  <element name="serviceDescription">
    <complexType>
      <complexContent>
        <extension base="wsiluddi:descriptionType">
          <sequence>
            <element name="serviceKey" type="uddi:serviceKey"/>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

</schema>

发布:2007-03-25 13:27    编辑:泛普软件 · xiaona    [打印此页]    [关闭]