首页 | 站长免费中心 | 新手上路 | 网站运营 | 网页制作 | 图片设计 | 动画设计 | 网页编程 | 网页特效 | 本站专题 | 虚拟主机 | 域名注册 | 网站建设 | 程序下载
       免费空间资源 | 新闻咨询 | 免费域名 | 免费网盘 | 网站推广 | 网站策划 | 建站经验 | 网站优化 | 网页代码 | 源码下载 | 音乐小偷 | 网络赚钱 | 论坛交流
网站建设
网站建设
虚拟主机
虚拟主机
域名注册
域名注册
711网络首页
站长工具
站长工具
网站源码
网站源码
站长论坛
站长论坛

 711网络 网页制作XML/XSLT

XML模式:WSDL

来源: 互联网    日期:2006-5-11
 

Web 服务描述语言(Web Services Description Language,WSDL)提供了一种描述 Web 服务(大多使用 SOAP)的简单方法。WSDL 允许您描述利用 SOAP 标准所提供的服务和接口。

比方说,可以创建描述某台服务器上提供的服务的 WSDL 文件,然后把该文件分发给需要这些服务的 Web 服务消费者。通过阅读和解析 WSDL 文件,消费者能够了解到使用这些 Web 服务需要知道的所有信息,包括可以交换的数据类型、参数以及返回的各种错误和其他信息。

再次使用来自 W3C 的例子,可以看到不同远程函数的声明和交换的数据都是通过结构的 XML 定义处理的,如清单 3 所示。


清单 3. 不同远程函数和交换数据的 XML 定义
                
<?xml version="1.0"?>

<!-- root element wsdl:definitions defines set of related services -->
<wsdl:definitions name="EndorsementSearch"
  targetNamespace="http://namespaces.snowboard-info.com"
  xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl"
  xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <!-- wsdl:types encapsulates schema definitions of communication types; 
                                                       here using xsd -->
  <wsdl:types>

    <!-- all type declarations are in a chunk of xsd -->
    <xsd:schema targetNamespace="http://namespaces.snowboard-info.com"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema">

      <!-- xsd definition: GetEndorsingBoarder [manufacturer string, 
                                                        model string] -->
      <xsd:element name="GetEndorsingBoarder">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="manufacturer" type="string"/>
            <xsd:element name="model" type="string"/>
    </xsd:sequence>
  </xsd:complexType>
      </xsd:element>

      <!-- xsd definition: GetEndorsingBoarderResponse 
[... endorsingBoarder string ...] -->
      <xsd:element name="GetEndorsingBoarderResponse">
  <xsd:complexType>
    <xsd:all>
      <xsd:element name="endorsingBoarder" type="string"/>
    </xsd:all>
  </xsd:complexType>
      </xsd:element>

      <!-- xsd definition: GetEndorsingBoarderFault 
[... errorMessage string ...] -->
      <xsd:element name="GetEndorsingBoarderFault">
  <xsd:complexType>
    <xsd:all>
      <xsd:element name="errorMessage" type="string"/>
    </xsd:all>
  </xsd:complexType>
      </xsd:element>

    </xsd:schema>
  </wsdl:types>

  <!-- wsdl:message elements describe potential transactions -->

  <!-- request GetEndorsingBoarderRequest is of type GetEndorsingBoarder -->
  <wsdl:message name="GetEndorsingBoarderRequest">
    <wsdl:part name="body" element="esxsd:GetEndorsingBoarder"/>
  </wsdl:message>

  <!-- response GetEndorsingBoarderResponse is of type 
                                       GetEndorsingBoarderResponse -->
  <wsdl:message name="GetEndorsingBoarderResponse">
    <wsdl:part name="body" element="esxsd:GetEndorsingBoarderResponse"/>
  </wsdl:message>

  <!-- wsdl:portType describes messages in an operation -->
  <wsdl:portType name="GetEndorsingBoarderPortType">

    <!-- the value of wsdl:operation eludes me -->
    <wsdl:operation name="GetEndorsingBoarder">
      <wsdl:input message="es:GetEndorsingBoarderRequest"/>
      <wsdl:output message="es:GetEndorsingBoarderResponse"/>
      <wsdl:fault message="es:GetEndorsingBoarderFault"/>
    </wsdl:operation>
  </wsdl:portType>

  <!-- wsdl:binding states a serialization protocol for this service -->
  <wsdl:binding name="EndorsementSearchSoapBinding"
                type="es:GetEndorsingBoarderPortType">

    <!-- leverage off soap:binding document style ...(no wsdl:foo pointing at 
the soap binding) -->
    <soap:binding style="document"
                  transport="http://schemas.xmlsoap.org/soap/http"/>

    <!-- semi-opaque container of network transport details classed by 
soap:binding above ... -->
    <wsdl:operation name="GetEndorsingBoarder">

      <!-- again bind to SOAP? ... -->
      <soap:operation soapAction="http://www.snowboard-info.com/
EndorsementSearch"/>

      <!-- further specify that the messages in the wsdl:operation 
"GetEndorsingBoarder" use SOAP? ... -->
      <wsdl:input>
        <soap:body use="literal"
       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"
       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </wsdl:output>
      <wsdl:fault>
        <soap:body use="literal"
       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>

  <!-- wsdl:service names a new service "EndorsementSearchService" -->
  <wsdl:service name="EndorsementSearchService">
    <wsdl:documentation>snowboarding-info.com Endorsement Service</
wsdl:documentation> 

    <!-- connect it to the binding "EndorsementSearchSoapBinding" above -->
    <wsdl:port name="GetEndorsingBoarderPort"
               binding="es:EndorsementSearchSoapBinding">

      <!-- give the binding an network address -->
      <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/>
    </wsdl:port>
  </wsdl:service>

 </wsdl:definitions>
 

WSDL 声明了消息类型、默认数据类型和内容以及交换的数据结构。

访问服务器上 SOAP 结构需要使用的一切信息都可以在这个 WSDL 中找到。大多数语言和环境都提供一种阅读和解析 WSDL 的机制,以确定可用的函数和数据交换。

WSDL 不仅定义了用于交换信息的 SOAP 接口,通过适当的 WSDL 生成程序,还可用于创建发送请求、生成并格式化响应所需要的代码。

WSDL 和 SOAP 组成了一个强大的远程过程调用系统。



更多的XML模式:WSDL请到论坛查看: http://BBS.TC711.COM



【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】 来源: 互联网    日期:2006-5-11   

上一篇:XML模式:SOAP..
下一篇:XML模式:RDF..
发 表 评 论
查看评论

  您的大名:
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
认证编码: 刷新验证码
点评内容: 字数0
  精品推荐  
  本月推荐  
  友情赞助  

关于我们 | 联系我们 | 广告投放 | 留言反馈 | 免费程序 | 虚拟主机 | 网站建设 |  网站推广 |  google_sitemap baidu_sitemap RSS订阅
本站所有资源均来自互联网,如有侵犯您的版权或其他问题,请通知管理员,我们会在最短的时间回复您
Copyright © 2005-2015 Tc711.Com All Rights Reserved 版权所有·711网络   蜀ICP备05021915号
110网监备案 信息产业备案 不良信息举报