WebService 学习(3)
发布时间:2020-12-17 00:02:25 所属栏目:安全 来源:网络整理
导读:WSDL WSDL(网络服务描述语言,Web Services Description Language)是一门基于 XML 的语言,用于描述 Web Services 以及如何对它们进行访问。 WSDL 文档结构 元素 定义 portType web service 执行的操作 message web service 使用的消息 types web service
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,并不一定符合标准规范,仅供参考 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- Angular2组件选择器:类似'[ui-components]’
- twitter-bootstrap-3 – 你能嵌套Bootstrap容器吗
- angularJS中$apply()方法详解
- 【开源插件】Bootstrap-Table 实现表格的查询、分
- vim中的’:源文件’和’:运行时文件’有什么区
- bash – emacs中的术语::如何关闭“自动换行”
- webservice客户端调用(一:客户端调用代码的生成
- 调用Https WebService发布后使用时报“基础连接已
- 如何缓存angularjs partials?
- scala – akka stream asyncBoundary vs mapAsyn
热点阅读