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定义了两个元
xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 素,一个是sayHello,一个是sayHelloResp
attributeFormDefault="qualified" elementFormDefault="qualified" onse。
targetNamespace="http://com.liuxiang.xfireDemo/HelloService">
xsd:element name="sayHello">----------------------------------------sayHello
xsd:complexType
xsd:sequence
maxOccurs="1" minOccurs
name="name" nillable="true" type="xsd:string" /></xsd:element="sayHelloResponse"---------------------------sayHelloResponse="out"xsd:schema
wsdl:types>
<wsdl:message name="sayHelloResponse">----------------------------------------------MESSAGE:通信消息的数据结构的抽象化定义,描
wsdl:part ="parameters" element="tns:sayHelloResponse" /> 述了Web服务使用消息的有效负载,
</wsdl:message 还可描述输出或接受消息的有效负载="sayHelloRequest"> ,其中ELEMENT对应TYPE中的NAME。定义元="tns:sayHello"/> 素的方式取决于使用RPC样式或文档样式,此处wsdl:message 为文档样式
<wsdl:portType name="HelloServicePortType">------------------------------------------PORTTYPE:对于某个访问入口点类型所支持的操
wsdl:operation ="sayHello"> 作的抽象集合,一个portType可定义多
wsdl:input ="sayHelloRequest" 个operation,一个operation可看做一
message="tns:sayHelloRequest"/>个方法,请求消息是MESSAGE定义的wsdl:output ="sayHelloResponse" sayHelloRequest,相应消息是="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" @H_404_496@射到一组具体协议(SOAP/HTTP),消息传
transport="http://schemas.xmlsoap.org/soap/http"/>@H_404_496@递样式,编码样式.wsdl:operation ="sayHello">
wsdlsoap:operation soapAction=""/>wsdl:input ="sayHelloRequest"
wsdlsoap:body use="literal"wsdl:inputwsdl:output ="sayHelloResponse"wsdl:outputwsdl:operationwsdl:bindingwsdl:service ="HelloService">----------------------------------------------------------SERVICE:相关服务访问点的集合,一个service元wsdl:port ="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名称相同.
附WSDL文档结构图-------
以上这些就是基本的一些要点,,,如果有误,请各位大爷批评指正,,,
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。