CTOCIO IT专家网

天极传媒 比特网 | 天极网 | IT专家网 | IT商网 | 52PK游戏网 | 手机天极 | IT分众 |
IT专家网搜索

您现在的位置: IT专家网 > Web服务子站 > 技巧

使用 XSLT 处理 WSDL 文档

作者: Mike Burr,  出处:developerWorks 中国, 责任编辑: 叶江, 
2006-10-23 08:55
  在 Web 服务的世界中,Web 服务描述语言(Web Services Description Language,WSDL)文档对 Web 服务提供的接口进行描述,并指示可以在网络上什么位置找到这些 Web 服务的实例。

  WSDL 文档内的关系

  虽然并不可能在此完全描述 WSDL 文档的结构,但仍然有必要说明一些 WSDL 文档的元素间较为显著的关系。正确地对 WSDL 文档进行操作取决于对这些关系的理解和保留。

  图 1. WSDL 文档元素的关系

WSDL 文档元素的关系

  每个 <wsdl:message>, <wsdl:portType> 和 <wsdl:binding> 元素均包含必需的 ncname 类型的“name”属性,但却会从 WSDL 文档中的其他地方使用 qname 进行引用。与 qname 关联的 URI 是从 <wsdl:definitions> 元素上的 targetNamespace 属性继承的。如果 <wsdl:definitions> 元素并不指定目标名称空间,将继承一个空名称空间 URI。这个隐式的名称空间通过图 1 中显示为灰色的虚线箭头来限定。

  以下为 WSDL 文档中的元素间存在的其他“重要”关系。其中每个关系在图 1 中都用一个黑色实线箭头表示。

  •   在 <wsdl:portType> 中定义的 <wsdl:operation> 内,每个 <wsdl:input>、<wsdl:output> 和 <wsdl:fault> 元素都通过其 message 属性引用一个<wsdl:message>。即: wsdl:portType/wsdl:operation/wsdl:input/@message -> wsdl:message
    wsdl:portType/wsdl:operation/wsdl:output/@message -> wsdl:message
    wsdl:portType/wsdl:operation/wsdl:fault/@message -> wsdl:message
  •   <wsdl:binding> 元素上的“type”属性引用 <wsdl:portType> 元素。即: wsdl:binding/@type -> wsdl:portType
  •   在 <wsdl:binding> 元素内,每个 <wsdl:operation> 都具有一个“name”属性,该属性与关联的 <wsdl:portType> 中的一个 <wsdl:operation> 上的“name”属性相等。 wsdl:binding/wsdl:operation/@name = wsdl:portType/wsdl:operation/@name
  •   在 <wsdl:binding> 中定义的 <wsdl:operation> 内,每个 <wsdl:input>、<wsdl:output> 和 <wsdl:fault> 元素都可以包含一个 name 属性,其值与 <wsdl:portType> 中的对应元素上的 name 属性匹配。即: wsdl:binding/wsdl:operation/wsdl:input/@name =
      wsdl:portType/wsdl:operation/wsdl:input/@name
  • wsdl:binding/wsdl:operation/wsdl:output/@name =
      wsdl:portType/wsdl:operation/wsdl:output/@name
  • wsdl:binding/wsdl:operation/wsdl:fault/@name =
      wsdl:portType/wsdl:operation/wsdl:fault/@name

  技术

  以下是一些经过证实的有用的技术 XSL 代码片段,可用于处理 WSDL 文档。这其中的很多方法都可以泛型化,以处理非 WSDL XML 文档。

  除了 XSL 代码片段外,下面描述的每项技术还包含一个简单的示例样式表,以演示相应的技术可以如何用于处理 WSDL 文档。对于每个示例样式表,还将给出对以下虚构的 WSDL 文档应用该样式表后的输出:

  清单 1. 在示例中使用的 test.wsdl

……


  阅读关于 Web服务 WSDL XML XSL Java 的全部文章
共2页。 9 1 2

网友评论

笔名 
请您注意:遵守国家有关法律、法规,尊重网上道德,承担一切因您的行为而直接或间接引起的法律责任。    IT专家网友拥有管理笔名和留言的一切权利。
  • 周排行榜
  • 月排行榜

邮件订阅

       
天极服务 | 关于我们 | 网站律师 | 加入我们 | 联系我们 | 广告业务 | 友情链接 | 我要挑错
All Rights Reserved, Copyright 2004-2008, Ctocio.com.cn
渝ICP证B2-20030003号 如有意见请与我们联系 powered by 天极内容管理平台CMS4i