作者:沙楽33 | 来源:互联网 | 2023-08-26 12:25
转WSDL(WebServiceDescriptionLanguage)Web服务描述语言################################################
转
WSDL(Web Service Description Language)Web服务描述语言
################################################################################
适用于描述WebService的文档格式
下面例子是为了输入一个字符串name,返回一个SayHello的操作。
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/">
---------------------------------------TYPE:数据类型定义的容器,TYPE定义了两个元素,一个是sayHello,一个是sayHelloResp
attributeFormDefault="qualified" elementFormDefault="qualified" onse。
targetNamespace="http://com.liuxiang.xfireDemo/HelloService">
----------------------------------------sayHello
name="name" nillable="true" type="xsd:string" />
---------------------------sayHelloResponse
name="out" nillable="true" type="xsd:string" />
------------------------------------MESSAGE:通信消息的数据结构的抽象化定义,描述了Web服务使用消息的有效负载,
还可描述输出或接受消息的有效负载 ,其中ELEMENT对应TYPE中的NAME。定义元素的方式取决于使用RPC样式或文档样式,此处为文档样式
------------------------------------------PORTTYPE:对于某个访问入口点类型所支持的操
作的抽象集合,一个portType可定义多
message="tns:sayHelloRequest" /> 个方法,请求消息是MESSAGE定义的
message="tns:sayHelloResponse" /> sayHelloResponse,同时包含input
/output表明这是一个请求/响应模式,
input表示传递到Web服务的有效负
载,output表示传递到客户的有效负 载.此处TNS为DEFINITIONS中所声 明。
type="tns:HelloServicePortType"> 范的绑定,binding将一个抽象porType映
transport="http://schemas.xmlsoap.org/soap/http" /> 递样式,编码样式.
----------------------------------------------------------SERVICE:相关服务访问点的集合,一个service元
binding="tns:HelloServiceHttpBinding"> 不同的Web服务,此例子中提供给访
location="http://localhost:8080/xfire/services/HelloService" /> .....
IMPORT:可以让当前WSDL文档中引用其他WSDL文档中指定命名空间中的元素,通常用于WSDL模块化。
namespace属性:必须与所导入文件的targetNameSpace名称相同.
location属性:指向wsdl文件的路径,不能为空.
附WSDL文档结构图-------