webService的wsdl文档结构

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38323645/article/details/86320377

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

wsdl文件分析 :

			<?xml version='1.0' encoding='UTF-8'?>
			<!-- 
				wsdl的作用:定义了web service的服务器端与客户端应用
				交互传递请求和响应数据的格式和方式
					请求的url
			-->
			<wsdl:definitions 
				xmlns:xsd="http://www.w3.org/2001/XMLSchema"
				xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
				xmlns:tns="http://ws.java.atguigu.net/"
				xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
				xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
				name="HelloWSImplService" 
				targetNamespace="http://ws.java.atguigu.net/">
				<!-- 
					定义当前wsdl文档中所使用的标签,
					很重要的一部分为soap消息中xml片断所包含的一些标签
					<sayHello>
						<arg0>文本</arg0>
					</sayHello>
						===>soap请求的请求体的一部分
					<sayHelloResponse>
						<return></return>
					</sayHelloResponse>
						===>soap响应的请求体的一部分
				 -->
				<wsdl:types>
					<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
						xmlns:tns="http://ws.java.atguigu.net/" 
						elementFormDefault="unqualified"
						targetNamespace="http://ws.java.atguigu.net/" 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="arg0" 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>
				
				<!-- 
					定义请求消息,它的个数为SEI方法个数的2倍
						message name 指定消息的名称
							part element 指定消息的组成,依赖<types>中定义的某个element 
				 -->
				<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>
				
				<!-- 
					定义SEI接口
						portType name 指定SEI接口名
							operation 接口的操作,也就是其方法
								input message 服务器端接收的消息,依赖指定的<message>,也就是将哪个消息
		作为请求消息对应方法的参数
							output message 指定服务器返回的消息,
						依赖指定的<message>,也就是将哪个消息作为响应消息对应方法
						的返回值
				 -->
				<wsdl:portType name="HelloWS">
					<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>
				<!-- 
					定义服务器端处理请求的SEI实现类对象
						binding type :参照<portType>所定义的SEI
							soap:binding : 绑定的方式,也就数据传递的方式 为文档(即xml)
								input : 指定请求消息(与<portType>中的input对应)
								output:指定响应消息(与<portType>中的output对应)
									body use="literal" 消息体为文本
				 -->
				<wsdl:binding name="HelloWSImplServiceSoapBinding" type="tns:HelloWS">
					<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>
				<!-- 定义客户端调用web service的入口
						service name :生产客户端的SEI接口实现的工厂类
							port binding :处理请求的服务器端的SEI接口实现类对象
								address location :web service的请求url	
				-->
				<wsdl:service name="HelloWSImplService">
					<wsdl:port binding="tns:HelloWSImplServiceSoapBinding" name="HelloWSImplPort">
						<soap:address location="http://192.168.1.104/ws_server/helloWS" />
					</wsdl:port>
				</wsdl:service>
			</wsdl:definitions>

猜你喜欢

转载自blog.csdn.net/weixin_38323645/article/details/86320377