相关历史文章(阅读本文之前,您可能需要先看下之前的系列 )
WebService SOAP概述 - 第275篇
WSDL是什么“Lese” - 第276篇
Spring boot webservice怎么玩? - 第277篇
Spring boot cxf构建webservice服务 - 第278篇
Spring boot cxf调用webservice服务 - 第279篇
一、前言
在前面文章中,对于WebService、SOAP的一些概念进行了讲解,也提出了WSDL的概念。在调用WSDL文档的时候,那么首先要先会解读这个文档,才知道文档提供了什么方法,需要什么参数,返回值是什么。
二、WSDL是什么货色
以下是一个通过CXF生成的xsd文件:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.demo.kfit.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="helloService" targetNamespace="http://ws.demo.kfit.com"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.demo.kfit.com" elementFormDefault="unqualified" targetNamespace="http://ws.demo.kfit.com" version="1.0"> <xs:element name="sayHello" type="tns:sayHello" /> <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> <xs:complexType name="sayHello"> <xs:sequence> <xs:element minOccurs="0" name="userName" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="sayHelloResponse"> <xs:sequence> <xs:element minOccurs="0" name="return" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="sayHelloResponse"> <wsdl:part element="tns:sayHelloResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="sayHello"> <wsdl:part element="tns:sayHello" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="HelloService"> <wsdl:operation name="sayHello"> <wsdl:input message="tns:sayHello" name="sayHello"> </wsdl:input> <wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="helloServiceSoapBinding" type="tns:HelloService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="sayHello"> <soap:operation soapAction="" style="document" /> <wsdl:input name="sayHello"> <soap:body use="literal" /> </wsdl:input> <wsdl:output name="sayHelloResponse"> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="helloService"> <wsdl:port binding="tns:helloServiceSoapBinding" name="CxfServicesImplPort"> <soap:address location="http://127.0.0.1:8080/cxf/cxfServices" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
讯享网

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/35999.html