浅学soap--------3

//person.wsdl   标签
<?xml version="1.0" ?>
<definitions name="person" targetNamespace="urn:person" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:person" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types xmlns="http://schemas.xmlsoap.org/wsdl/" />

<portType name="personPort">    <!--web service 执行的操作,相当于class person-->
<operation name="name">            <!--相当于class person中的name方法-->
    <input message="tns:nameRequest" />        <!--name方法的请求,和name=nameRequest的message对应-->
    <output message="tns:nameResponse" />    <!--name方法的返回,和name=nameRequest的message对应-->
</operation>
<operation name="add">
    <input message="tns:addRequest" />
    <output message="tns:addResponse" />
</operation>
</portType>


<binding name="personBinding" type="tns:personPort">    <!--同portType中的name-->
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <!--style 属性可取值 "rpc" 或 "document",transport 属性定义了要使用的 SOAP 协议-->
<operation name="name">
    <soap:operation soapAction="urn:person#person#name" />
    <input>
        <soap:body use="encoded" namespace="urn:person" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </input>
    <output>
        <soap:body use="encoded" namespace="urn:person" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
</operation>

<operation name="add">        <!--person类中的方法名-->
    <soap:operation soapAction="urn:person#person#add" />
    <input>
        <soap:body use="encoded" namespace="urn:person" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </input>
    <output>
        <soap:body use="encoded" namespace="urn:person" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
</operation>
</binding>


<service name="person">
    <documentation />
    <port name="personPort" binding="tns:personBinding">    <!--同上方binding的name-->
        <soap:address location="http://localhost:80/test/web_service/Service.php" />
        <!--location是Service的地址-->    
    </port>
</service>
<message name="nameRequest">            <!--message,web service 使用的消息-->
</message>
<message name="nameResponse">
    <part name="name" type="xsd:string" />
</message>
<message name="addRequest">                    <!--person类中的add方法-->
    <part name="a" type="xsd:string" />        <!--person类中add方法的传入参数a-->
    <part name="b" type="xsd:string" />        <!--person类中add方法的传入参数b-->
</message>
<message name="addResponse">
    <part name="add" type="xsd:string" />    <!--person类中add方法的返回-->
</message>
</definitions>
 
原文地址:https://www.cnblogs.com/Kqingniao/p/6839797.html