WSDL协议简单介绍
WSDL – WebService Description Language – Web服务描述语言
通过XML形式说明服务在什么地方-地址。
通过XML形式说明服务提供什么样的方法 – 如何调用。
<wsdl:service name="MobileCodeWS"> <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><a href="http://www.webxml.com.cn/" target="_blank">WebXml.com.cn</a> <strong>国内手机号码归属地查询WEB服务</strong>,提供最新的国内手机号码段归属地数据,每月更新。<br />使用本站 WEB 服务请注明或链接本站:<a href="http://www.webxml.com.cn/" target="_blank">http://www.webxml.com.cn/</a> 感谢大家的支持!<br /> </wsdl:documentation> - <wsdl:port name="MobileCodeWSSoap" binding="tns:MobileCodeWSSoap"> <soap:address location="http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx" /> </wsdl:port>
<wsdl:binding name="MobileCodeWSSoap" type="tns:MobileCodeWSSoap">
访问:http://127.0.0.1:8088/ws/phoneSer?WSDL 查看WSDL说明:
下面的参数在发布service 的时候均已经修改为特定的名字,可读性增强了。参考:http://www.cnblogs.com/qlqwjy/p/7554647.html
<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><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://dd.ws.it.cn" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://dd.ws.it.cn" name="PhoneManager1"> <types> <xsd:schema> <xsd:import namespace="http://dd.ws.it.cn" schemaLocation="http://127.0.0.1:8088/ws/phoneSer?xsd=1"></xsd:import> </xsd:schema> </types> <message name="getMObileInfo"> <part name="parameters" element="tns:getMObileInfo"></part> </message> <message name="getMObileInfoResponse"> <part name="parameters" element="tns:getMObileInfoResponse"></part> </message> <portType name="PhoneService"> <operation name="getMObileInfo"> <input wsam:Action="http://dd.ws.it.cn/PhoneService/getMObileInfoRequest" message="tns:getMObileInfo"></input> <output wsam:Action="http://dd.ws.it.cn/PhoneService/getMObileInfoResponse" message="tns:getMObileInfoResponse"></output> </operation> </portType> <binding name="PhoneServicePortBinding" type="tns:PhoneService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding> <operation name="getMObileInfo"> <soap:operation soapAction=""></soap:operation> <input> <soap:body use="literal"></soap:body> </input> <output> <soap:body use="literal"></soap:body> </output> </operation> </binding> <service name="PhoneManager1"> <port name="PhoneServicePort" binding="tns:PhoneServicePortBinding"> <soap:address location="http://127.0.0.1:8088/ws/phoneSer"></soap:address> </port> </service> </definitions>
访问:http://127.0.0.1:8088/ws/phoneSer?xsd=1 查看XML约束文档
xsd对输入参数,输出参数均有定义
------------------一个完整的介绍-----------------------------------------
【当你用心写完每一篇博客之后,你会发现它比你用代码实现功能更有成就感!】