WebService 学习(3)
来源:互联网 发布:时代精神 知乎 编辑:程序博客网 时间:2024/06/05 15:30
WSDL
WSDL(网络服务描述语言,Web Services Description Language)是一门基于 XML 的语言,用于描述 Web Services 以及如何对它们进行访问。
WSDL 文档结构
基本格式:
<definitions><types> definition of types........</types><message> definition of a message....</message><portType> definition of a port.......</portType><binding> definition of a binding....</binding></definitions>
示例:
WSDL 端口
<portType> 元素是最重要的 WSDL 元素。它可描述一个 web service、可被执行的操作,以及相关的消息。可以把 <portType> 元素比作传统编程语言中的一个函数库(或一个模块、或一个类)。
操作类型
WSDL 消息
<message> 元素定义一个操作的数据元素。每个消息均由一个或多个部件组成。可以把这些部件比作传统编程语言中一个函数调用的参数。
WSDL types
<types> 元素定义 web service 使用的数据类型。为了最大程度的平台中立性,WSDL 使用 XML Schema 语法来定义数据类型。
WSDL Bindings
<binding> 元素为每个端口定义消息格式和协议细节。
完整的WSDL实例:
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://person.service.yang" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://person.service.yang/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://person.service.yang"> <wsdl:documentation>PersonService</wsdl:documentation> <wsdl:types> <xs:schema xmlns:ax22="http://person.service.yang/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://person.service.yang"> <xs:import namespace="http://person.service.yang/xsd"/> <xs:element name="UpdatePersonByNum"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="num" type="xs:int"/> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="sex" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="UpdatePersonByNumResponse"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:Person"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Queryall"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="query" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="QueryallResponse"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:Person"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="QueryPersonByNum"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="num" type="xs:int"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="QueryPersonByNumResponse"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:Person"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="QueryPersonByName"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="QueryPersonByNameResponse"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:Person"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="DelPersonByNum"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="num" type="xs:int"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="DelPersonByNumResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="DelPersonAll"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="del" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="DelPersonAllResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="AddPerson"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="num" type="xs:int"/> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="sex" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="AddPersonResponse"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax21:Person"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://person.service.yang/xsd"> <xs:complexType name="Person"> <xs:sequence> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="num" type="xs:int"/> <xs:element minOccurs="0" name="sex" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="QueryallRequest"> <wsdl:part name="parameters" element="ns:Queryall"/> </wsdl:message> <wsdl:message name="QueryallResponse"> <wsdl:part name="parameters" element="ns:QueryallResponse"/> </wsdl:message> <wsdl:message name="DelPersonAllRequest"> <wsdl:part name="parameters" element="ns:DelPersonAll"/> </wsdl:message> <wsdl:message name="DelPersonAllResponse"> <wsdl:part name="parameters" element="ns:DelPersonAllResponse"/> </wsdl:message> <wsdl:message name="DelPersonByNumRequest"> <wsdl:part name="parameters" element="ns:DelPersonByNum"/> </wsdl:message> <wsdl:message name="DelPersonByNumResponse"> <wsdl:part name="parameters" element="ns:DelPersonByNumResponse"/> </wsdl:message> <wsdl:message name="QueryPersonByNameRequest"> <wsdl:part name="parameters" element="ns:QueryPersonByName"/> </wsdl:message> <wsdl:message name="QueryPersonByNameResponse"> <wsdl:part name="parameters" element="ns:QueryPersonByNameResponse"/> </wsdl:message> <wsdl:message name="AddPersonRequest"> <wsdl:part name="parameters" element="ns:AddPerson"/> </wsdl:message> <wsdl:message name="AddPersonResponse"> <wsdl:part name="parameters" element="ns:AddPersonResponse"/> </wsdl:message> <wsdl:message name="QueryPersonByNumRequest"> <wsdl:part name="parameters" element="ns:QueryPersonByNum"/> </wsdl:message> <wsdl:message name="QueryPersonByNumResponse"> <wsdl:part name="parameters" element="ns:QueryPersonByNumResponse"/> </wsdl:message> <wsdl:message name="UpdatePersonByNumRequest"> <wsdl:part name="parameters" element="ns:UpdatePersonByNum"/> </wsdl:message> <wsdl:message name="UpdatePersonByNumResponse"> <wsdl:part name="parameters" element="ns:UpdatePersonByNumResponse"/> </wsdl:message> <wsdl:portType name="PersonServicePortType"> <wsdl:operation name="Queryall"> <wsdl:input message="ns:QueryallRequest" wsaw:Action="urn:Queryall"/> <wsdl:output message="ns:QueryallResponse" wsaw:Action="urn:QueryallResponse"/> </wsdl:operation> <wsdl:operation name="DelPersonAll"> <wsdl:input message="ns:DelPersonAllRequest" wsaw:Action="urn:DelPersonAll"/> <wsdl:output message="ns:DelPersonAllResponse" wsaw:Action="urn:DelPersonAllResponse"/> </wsdl:operation> <wsdl:operation name="DelPersonByNum"> <wsdl:input message="ns:DelPersonByNumRequest" wsaw:Action="urn:DelPersonByNum"/> <wsdl:output message="ns:DelPersonByNumResponse" wsaw:Action="urn:DelPersonByNumResponse"/> </wsdl:operation> <wsdl:operation name="QueryPersonByName"> <wsdl:input message="ns:QueryPersonByNameRequest" wsaw:Action="urn:QueryPersonByName"/> <wsdl:output message="ns:QueryPersonByNameResponse" wsaw:Action="urn:QueryPersonByNameResponse"/> </wsdl:operation> <wsdl:operation name="AddPerson"> <wsdl:input message="ns:AddPersonRequest" wsaw:Action="urn:AddPerson"/> <wsdl:output message="ns:AddPersonResponse" wsaw:Action="urn:AddPersonResponse"/> </wsdl:operation> <wsdl:operation name="QueryPersonByNum"> <wsdl:input message="ns:QueryPersonByNumRequest" wsaw:Action="urn:QueryPersonByNum"/> <wsdl:output message="ns:QueryPersonByNumResponse" wsaw:Action="urn:QueryPersonByNumResponse"/> </wsdl:operation> <wsdl:operation name="UpdatePersonByNum"> <wsdl:input message="ns:UpdatePersonByNumRequest" wsaw:Action="urn:UpdatePersonByNum"/> <wsdl:output message="ns:UpdatePersonByNumResponse" wsaw:Action="urn:UpdatePersonByNumResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="PersonServiceSoap11Binding" type="ns:PersonServicePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <wsdl:operation name="Queryall"> <soap:operation soapAction="urn:Queryall" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonAll"> <soap:operation soapAction="urn:DelPersonAll" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonByNum"> <soap:operation soapAction="urn:DelPersonByNum" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByName"> <soap:operation soapAction="urn:QueryPersonByName" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="AddPerson"> <soap:operation soapAction="urn:AddPerson" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByNum"> <soap:operation soapAction="urn:QueryPersonByNum" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="UpdatePersonByNum"> <soap:operation soapAction="urn:UpdatePersonByNum" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="PersonServiceSoap12Binding" type="ns:PersonServicePortType"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <wsdl:operation name="Queryall"> <soap12:operation soapAction="urn:Queryall" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonAll"> <soap12:operation soapAction="urn:DelPersonAll" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonByNum"> <soap12:operation soapAction="urn:DelPersonByNum" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByName"> <soap12:operation soapAction="urn:QueryPersonByName" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="AddPerson"> <soap12:operation soapAction="urn:AddPerson" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByNum"> <soap12:operation soapAction="urn:QueryPersonByNum" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="UpdatePersonByNum"> <soap12:operation soapAction="urn:UpdatePersonByNum" style="document"/> <wsdl:input> <soap12:body use="literal"/> </wsdl:input> <wsdl:output> <soap12:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="PersonServiceHttpBinding" type="ns:PersonServicePortType"> <http:binding verb="POST"/> <wsdl:operation name="Queryall"> <http:operation location="Queryall"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonAll"> <http:operation location="DelPersonAll"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="DelPersonByNum"> <http:operation location="DelPersonByNum"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByName"> <http:operation location="QueryPersonByName"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="AddPerson"> <http:operation location="AddPerson"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="QueryPersonByNum"> <http:operation location="QueryPersonByNum"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="UpdatePersonByNum"> <http:operation location="UpdatePersonByNum"/> <wsdl:input> <mime:content type="text/xml" part="parameters"/> </wsdl:input> <wsdl:output> <mime:content type="text/xml" part="parameters"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="PersonService"> <wsdl:port name="PersonServiceHttpSoap11Endpoint" binding="ns:PersonServiceSoap11Binding"> <soap:address location="http://localhost:8080/axis2/services/PersonService.PersonServiceHttpSoap11Endpoint/"/> </wsdl:port> <wsdl:port name="PersonServiceHttpSoap12Endpoint" binding="ns:PersonServiceSoap12Binding"> <soap12:address location="http://localhost:8080/axis2/services/PersonService.PersonServiceHttpSoap12Endpoint/"/> </wsdl:port> <wsdl:port name="PersonServiceHttpEndpoint" binding="ns:PersonServiceHttpBinding"> <http:address location="http://localhost:8080/axis2/services/PersonService.PersonServiceHttpEndpoint/"/> </wsdl:port> </wsdl:service></wsdl:definitions>
自己发布的Webservice,并不一定符合标准规范,仅供参考
- WebService 学习(3)
- webservice学习笔记(3)--调用天气
- 学习WebService(一)
- WebService 学习(1)
- WebService 学习(2)
- WebService 学习(4)
- WebService学习(一)
- webService学习(二)
- WebService学习(1)
- webservice学习(一)
- Webservice学习(二)
- WebService学习(一)
- WebService学习(二)
- webService学习3----axis发布webService
- webService学习3:客户端生成webservice代码
- WebService学习总结(3)——使用java JDK开发WebService
- android Webservice 学习(记录)
- WebService学习笔记(一)
- 暴雪:免费转服会毁掉WOW 新机制消灭鬼服
- 支持向量机SVM(Support Vector Machine)算法初解
- 《web前端黑客技术揭密》阅读笔记step1
- dojox.charting和dojox.timing构造Dojo动态图表
- VC连接SQL SERVER数据库
- WebService 学习(3)
- smb 共享文件夹设置
- 怎样做好一个产品(产品经理须知)
- python 编码心得
- 使用 Scalable Performance Monitor 监控 和分析 solr的运行状况
- php header功能的使用
- Android自动化测试解决方案
- 修改android 浏览器的默认主页
- 我的程序人生之——考研(未完待续)