WSDL(Web Service Description Language)Web服务描述语言

################################################################################

适用于描述WebService的文档格式

下面例子是为了输入一个字符串name,返回一个SayHello的操作。

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions
    targetNamespace="http://com.liuxiang.xfireDemo/HelloService"-------------------DEFINITIONS:WSDL文档根元素,提供命名空间
    xmlns:tns="http://com.liuxiang.xfireDemo/HelloService"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
    xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:types>---------------------------------------TYPE:数据类型定义的容器,TYPE定义了两个元素,一个是sayHello,一个是sayHelloResp
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            attributeFormDefault="qualified" elementFormDefault="qualified"

onse。
            targetNamespace="http://com.liuxiang.xfireDemo/HelloService">
            <xsd:element name="sayHello">----------------------------------------sayHello
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="1"
                            name="name" nillable="true" type="xsd:string" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="sayHelloResponse">---------------------------sayHelloResponse
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="1"
                            name="out" nillable="true" type="xsd:string" />
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="sayHelloResponse">------------------------------------MESSAGE:通信消息的数据结构的抽象化定义,描述了Web服务使用消息的有效负载,

      还可描述输出或接受消息的有效负载 ,其中ELEMENT对应TYPE中的NAME。定义元素的方式取决于使用RPC样式或文档样式,此处为文档样式
        <wsdl:part name="parameters" element="tns:sayHelloResponse" />                                         
    </wsdl:message>   
    <wsdl:message name="sayHelloRequest">    
        <wsdl:part name="parameters" element="tns:sayHello" />      
    </wsdl:message>

<wsdl:portType name="HelloServicePortType">------------------------------------------PORTTYPE:对于某个访问入口点类型所支持的操
        <wsdl:operation name="sayHello">                                                                                              作的抽象集合,一个portType可定义多
            <wsdl:input name="sayHelloRequest"
     个operation,一个operation可看做一
                message="tns:sayHelloRequest" />
     个方法,请求消息是MESSAGE定义的
            <wsdl:output name="sayHelloResponse"
     sayHelloRequest,相应消息是
                message="tns:sayHelloResponse" />
     sayHelloResponse,同时包含input
        </wsdl:operation>
     /output表明这是一个请求/响应模式,
    </wsdl:portType>
     input表示传递到Web服务的有效负

载,output表示传递到客户的有效负
      载.此处TNS为DEFINITIONS中所声
      明。
    <wsdl:binding name="HelloServiceHttpBinding"--------------------------------------------BINDING:特定端口类型的具体协议和数据格式规
        type="tns:HelloServicePortType">
   
范的绑定,binding将一个抽象porType映
        <wsdlsoap:binding style="document"

射到一组具体协议(SOAP/HTTP),消息传
            transport="http://schemas.xmlsoap.org/soap/http" />
递样式,编码样式.
        <wsdl:operation name="sayHello">
            <wsdlsoap:operation soapAction="" />
            <wsdl:input name="sayHelloRequest">
                <wsdlsoap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="sayHelloResponse">
                <wsdlsoap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="HelloService">----------------------------------------------------------SERVICE:相关服务访问点的集合,一个service元
        <wsdl:port name="HelloServiceHttpPort"
    素包含多个不同的port,每个port表示
            binding="tns:HelloServiceHttpBinding">
    不同的Web服务,此例子中提供给访
            <wsdlsoap:address
    问你的地址为:http://localhost:8080/xf.
                location="http://localhost:8080/xfire/services/HelloService" />
     .....
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

IMPORT:可以让当前WSDL文档中引用其他WSDL文档中指定命名空间中的元素,通常用于WSDL模块化。

<wsdl:import namespace="http://xxx.xxx.xxx/xxx/xxx" location="http://xxx.xxx.xxx/xxx/xxx.wsdl"/>

namespace属性:必须与所导入文件的targetNameSpace名称相同.

location属性:指向wsdl文件的路径,不能为空.

附WSDL文档结构图-------

最新文章

  1. NFS网络共享服务部署
  2. Beginning Scala study note(4) Functional Programming in Scala
  3. TCP重传率高的监控
  4. 20145320《Java程序设计》第三次实验报告
  5. 购物车界面,不同section,点击增减物品,确定取消选中的逻辑判断
  6. python的各种推导式(列表推导式、字典推导式、集合推导式)
  7. 各个平台 如何安装 Ruby 和 RubyGems
  8. apache kafka系列之-监控指标
  9. Linux下修改环境终端提示符
  10. Android对话框和帧动画
  11. jQuery 文档操作方法
  12. vritualenv虚拟环境迁移
  13. python学习笔记3_抽象
  14. Web 安全之 XSS 攻击与防御
  15. mybatis 代码生成器(IDEA, Maven)及配置详解(部分配置你应该不知道)
  16. 1099 Lottery
  17. Codeforces Round #418 (Div. 2) B. An express train to reveries
  18. Linux命令之rm
  19. 经典]Linux内核中ioremap映射的透彻理解【转】
  20. centos-6.5安装部署LNMP环境

热门文章

  1. 「NOIP2007」树网的核
  2. USACO[19-20]Dec银组题解
  3. BFPRT(中位数的中位数算法)
  4. Job for nginx.service failed because the control process exited with error code. See “systemctl stat
  5. 吴裕雄--天生自然java开发常用类库学习笔记:Stack类
  6. Python基础week1
  7. Linux操作系统之Shell程序设计
  8. POJ 1256:Anagram
  9. Java8系列 (四) 静态方法和默认方法(转载)
  10. shell中取字符串子串的几种方式 截取substr