什么是WsDL WSDL将Web服务描述为一组端点,这些端点会处理包含 面向文档或面向过程的(RPC)的消息。 操作和消息都是被抽象描述的,然后被绑定到一个具体的网 络协议和消息格式,用来定义端点。相关的具体端点被合并 到抽象的端点或服务中。 WSDL可以扩展为允许端点和其消息的描述,目前经过描 述的绑定只能用于SoAP11、 Http Post以及多用途因 特网邮件扩展( Multipurpose Internet Mail Extensions, MME)
什么是WSDL ◼ WSDL将 Web 服务描述为一组端点,这些端点会处理包含 面向文档或面向过程的(RPC)的消息。 ◼ 操作和消息都是被抽象描述的,然后被绑定到一个具体的网 络协议和消息格式,用来定义端点。相关的具体端点被合并 到抽象的端点或服务中。 ◼ WSDL 可以扩展为允许端点和其消息的描述,目前经过描 述的绑定只能用于 SOAP 1.1、HTTP POST 以及多用途因 特网邮件扩展(Multipurpose Internet Mail Extensions, MIME)
WSDL 基本服务描述 基本的服务描述分成了两部分:服务接口和服务实现。 Service Service Implementation Port Definition Binding Service PortType Opertions Interface Message Definition Types
WSDL ◼ 基本服务描述 ◼ 基本的服务描述分成了两部分:服务接口和服务实现。 Service Interface Definition Service Opertions Message Types PortType Port Binding Service Implementation Definition
WSDL文档结构 <definitions> i npor ≤ types <schema </schema>* pes <message> ≤ part </part> ≤ message> <PortType> <operation> s < input ≤ output>< output> <faults/fault> x S/operation> ≤/ PortType <binding <operation* <input s/input ≤ output>< output> s/operation> binding <service> ≤port</port> </service> <definitions>
WSDL文档结构
WSDL文档示例 <?xml version=1.0> <definitions name="urn: Address Fetcher2 <types> ∥)定义服务使用的任何复杂数据类型 </types> <message name="Add EntryRequest"> /一个 message对应在调用者和服务之间传递的一条消息,要用到前面定义的数据类型 </message> <portType name="AddressBook"> ∥′定义服务提供什么操作,要用到前面定义的消息 /portType> <binding name="AddressBooksoAPBinding ∥′定义服务如何被调用 </binding> <service name="AddressBookservice> (述服务位于哪里 </service> </definitions>
WSDL文档示例 <?xml version="1.0"> <definitions name="urn:AddressFetcher2" ... </definitions> <types> //定义服务使用的任何复杂数据类型 </types> <message name="AddEntryRequest"> //一个message对应在调用者和服务之间传递的一条消息,要用到前面定义的数据类型 </message> ... <portType name="AddressBook"> //定义服务提供什么操作,要用到前面定义的消息 </portType> <binding name="AddressBookSOAPBinding" //定义服务如何被调用 </binding> <service name="AddressBookService"> //描述服务位于哪里 </service>
WSDL— definitions元素 < definitions>元素 在WSDL文档中作为服务描述的容器提供名称空间的全 局声明 <definitions targetNamespace="urn: 3950 xmlns="http://schemas.xmlsoap.org/wsdl/ xmlns:xsd=http://www.w3.org/2001/xmlschema xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/ xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/ xmlns: tns="urn: 3950
WSDL——definitions元素 ◼ <definitions>元素 ◼ 在WSDL文档中作为服务描述的容器.提供名称空间的全 局声明