WSDL
WSDL是WebService的一种描述语言,定义了webService的一些重要信息
- 描述可公开使用的全部功能的信息
- 这些功能的请求和响应消息的数据类型信息
- 用于调用特定web服务的协议的绑定信息
- 用于查找指定的web服务的地址的信息
构成元素
- WSDL文档是一组定义,全部都是在 元素内部进行定义的,是WSDL文档的根元素
- 描述web服务与服务用户之间交换消息的所有数据类型
- 表示web服务与服务用户之间传递的数据的逻辑定义,包含0或多个消息元素,元素主要指请求参数或响应返回值
- 该元素通过组合由定义的各种请求和响应消息,定义了web服务支持的各项操作的抽象定义,各操作均为输入消息和输出消息
- 该元素指定用于表示通信中的特定元素定义的操作和消息的具体协议和数据格式
- 该元素指定与web服务的绑定地址
- 该元素聚集一组相关的元素,这些元素分别唯一指定web服务的绑定信息,包含多个元素的元素表示需通过多个绑定调用的服务功能
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| <?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions targetNamespace="http://com.study.demo/HelloService" <!-- wsdl实例特定的命名空间 --> xmlns:tns="http://com.study.demo/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> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://com.study.demo/HelloService"> <xsd:element name="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"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="return" nillable="true" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="sayHelloResponse"> <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"> <wsdl:operation name="sayHello"> <wsdl:input name="sayHelloRequest" message="tns:sayHelloRequest" /> <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse" /> </wsdl:operation> </wsdl:portType>
<wsdl:binding name="HelloServiceHttpBinding" type="tns:HelloServicePortType"> <wsdlsoap:binding style="document" 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"> <wsdl:port name="HelloServiceHttpPort" binding="tns:HelloServiceHttpBinding"> <wsdlsoap:address location="http://localhost:8080/demo/services/HelloService" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
|