当前位置: 代码迷 >> PHP >> 请给小弟我解释下这个服务器描述语言是什么意思?
  详细解决方案

请给小弟我解释下这个服务器描述语言是什么意思?

热度:287   发布时间:2016-04-28 18:58:51.0
请给我解释下这个服务器描述语言是什么意思??
本帖最后由 wkhegx 于 2014-06-18 15:15:03 编辑
在php的一个项目里面,有一个wsdl格式的文件,打开里面的代码是这样的,虽然看得懂英文的意思,但是我看不懂这个代码有什么用,放在项目的根目录下起什么作用,它如何运行的?请给我详细说下,谢谢。。
<?xml version='1.0' encoding='UTF-8'?>

<!-- WSDL file generated by Zend Studio. -->

<definitions name="soap" targetNamespace="urn:soap" xmlns:typens="urn:soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="auth">
<part name="email" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="authResponse">
<part name="authReturn" type="xsd:boolean"/>
</message>
<message name="latest">
<part name="date" type="xsd:integer"/>
</message>
<message name="latestResponse">
<part name="latestReturn" type="xsd:string"/>
</message>
<message name="send">
<part name="email" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="message" type="xsd:string"/>
</message>
<message name="sendResponse">
<part name="sendReturn" type="xsd:boolean"/>
</message>
<portType name="chatPortType">
<operation name="auth">
<input message="typens:auth"/>
<output message="typens:authResponse"/>
</operation>
<operation name="latest">
<input message="typens:latest"/>
<output message="typens:latestResponse"/>
</operation>
<operation name="send">
<input message="typens:send"/>
<output message="typens:sendResponse"/>
</operation>
</portType>
<binding name="chatBinding" type="typens:chatPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="auth">
<soap:operation soapAction="urn:chatAction"/>
<input>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="latest">
<soap:operation soapAction="urn:chatAction"/>
<input>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="send">
<soap:operation soapAction="urn:chatAction"/>
<input>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:soap" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="soapService">
<port name="chatPort" binding="typens:chatBinding">
<soap:address location=""/>
</port>
</service>
</definitions>

------解决方案--------------------
这是 Web Service 使用的,与客户沟通用说明文件
他告知用户,本 Web Service 提供了如下方法:
    [0] => boolean auth(string $email, string $password)
    [1] => string latest(integer $date)
    [2] => boolean send(string $email, string $password, string $message)

------解决方案--------------------
Web Service 是服务器,使用 SOAP 协议
服务端使用 SoapServer 类形成服务
客户端通过 SoapClient 类进行访问
解析 WSDL 可由
SoapClient::__getFunctions
SoapClient::__getTypes
方法进行

相关文件你的项目应该都提供了,你可以通过搜索包含“WSDL”字样的文件,找到他们

  相关解决方案