目录
什么时候使用webservice
系统语言不一致
SOAP(simple object access protocal简单对象访问协议)
http+xml
webservice通过http协议发送和接收请求时, 发送的内容(请求报文)和接收的内容(响应报文)都是采用xml格式进行封装
这些特定的HTTP消息头和XML内容格式就是SOAP协议
- 一种简单、基于HTTP和XML的协议
- soap消息:请求和响应消息
- http+xml报文
WSDL(web service definition language webservice 定义语言)
webservice服务需要通过wsdl文件来说明自己有什么服务可以对外调用。并且有哪些方法、方法里面有哪些参数
wsdl基于XML(可扩展标记语言)去定义的
- 对应一个.wsdl的文件类型
- 定义了webservice的服务器端和客户端应用进行交互的传递数据和响应数据格式和方式
- 一个webservice对应唯一一个wsdl文档
SEI(webservice endpoint interface webservice的终端接口)
webservice服务端用来处理请求的接口,也就是发布出去的接口
分析WSDL
基于上一篇提供的webservice服务:http://localhost:8888/ws/hello?wsdl
具体参考博客地址:https://blog.csdn.net/dengjili/article/details/86024334
各个元素
<!--
Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e.
-->
<!--
Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e.
-->
<definitions
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://webservice.distributed_s1.dengjili.priv/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservice.distributed_s1.dengjili.priv/" name="SayHelloImplService">
<types>
<xsd:schema>
<xsd:import namespace="http://webservice.distributed_s1.dengjili.priv/" schemaLocation="http://localhost:8888/ws/hello?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="SayHelloImpl">
<operation name="sayHello">
<input wsam:Action="http://webservice.distributed_s1.dengjili.priv/SayHelloImpl/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://webservice.distributed_s1.dengjili.priv/SayHelloImpl/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="SayHelloImplPortBinding" type="tns:SayHelloImpl">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="SayHelloImplService">
<port name="SayHelloImplPort" binding="tns:SayHelloImplPortBinding">
<soap:address location="http://localhost:8888/ws/hello"/>
</port>
</service>
</definitions>
分析