如何用Zend Stuido 的WSDL编辑器
File ->Other->Webservice->WSDL
选择Next
选择Finish.生成如下图所示的TestSoap.wsdl
TestSoapSoap下面填写php webService 如myservice.php
NewOption:添加方法。WebService里需要提供给别人调用的方法名
input :设置输入参数名和类型
output:设置返回值。
Add part:如果在input里添加,就是添加多个参数
示例:
看看TestSoap.wsdl代码
注意事项:在WSDL源代码里面发现wsdl:operation 标签里只有Add 方法,而其他的Sub Mul等方法都没有添加,
这个时候请跟新Bind,重新生成该节点信息。
File ->Other->Webservice->WSDL
选择Next
选择Finish.生成如下图所示的TestSoap.wsdl
TestSoapSoap下面填写php webService 如myservice.php
NewOption:添加方法。WebService里需要提供给别人调用的方法名
input :设置输入参数名和类型
output:设置返回值。
Add part:如果在input里添加,就是添加多个参数
示例:
看看TestSoap.wsdl代码
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost/test/soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test" targetNamespace="http://localhost/test/soap">
<wsdl:types>
<xsd:schema targetNamespace="http://localhost/test/soap">
<xsd:element name="Add">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="b" type="xsd:string"></xsd:element>
<xsd:element name="Add_fault" type="xsd:string"></xsd:element>
<xsd:element name="Sub">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SubResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MulResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="AddRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
<wsdl:part name="b" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="AddResponse">
<wsdl:part element="tns:AddResponse" name="AddReturn"/>
</wsdl:message>
<wsdl:message name="Add_faultMsg">
</wsdl:message>
<wsdl:message name="SubRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="SubResponse">
<wsdl:part name="SubReturn" element="tns:SubResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="MulRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
<wsdl:part name="b" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="MulResponse">
<wsdl:part name="MulReturn" element="tns:MulResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="test">
<wsdl:operation name="Add">
<wsdl:input message="tns:AddRequest"/>
<wsdl:output message="tns:AddResponse"/>
</wsdl:operation>
<wsdl:operation name="Sub">
<wsdl:input message="tns:SubRequest"></wsdl:input>
<wsdl:output message="tns:SubResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="Mul">
<wsdl:input message="tns:MulRequest"></wsdl:input>
<wsdl:output message="tns:MulResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testSOAP" type="tns:test">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Add">
<soap:operation soapAction="http://localhost/test/soap/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="test">
<wsdl:port binding="tns:testSOAP" name="testSOAP">
<soap:address location="http://localhost/test/soap/myservice.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
这就是WSDL源代码。如何引用,如何使用参考http://www.cnblogs.com/likwo/archive/2009/09/18/1569036.html<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost/test/soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="test" targetNamespace="http://localhost/test/soap">
<wsdl:types>
<xsd:schema targetNamespace="http://localhost/test/soap">
<xsd:element name="Add">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="b" type="xsd:string"></xsd:element>
<xsd:element name="Add_fault" type="xsd:string"></xsd:element>
<xsd:element name="Sub">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SubResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MulResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:int"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="AddRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
<wsdl:part name="b" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="AddResponse">
<wsdl:part element="tns:AddResponse" name="AddReturn"/>
</wsdl:message>
<wsdl:message name="Add_faultMsg">
</wsdl:message>
<wsdl:message name="SubRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="SubResponse">
<wsdl:part name="SubReturn" element="tns:SubResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="MulRequest">
<wsdl:part name="a" type="xsd:int"></wsdl:part>
<wsdl:part name="b" type="xsd:int"></wsdl:part>
</wsdl:message>
<wsdl:message name="MulResponse">
<wsdl:part name="MulReturn" element="tns:MulResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="test">
<wsdl:operation name="Add">
<wsdl:input message="tns:AddRequest"/>
<wsdl:output message="tns:AddResponse"/>
</wsdl:operation>
<wsdl:operation name="Sub">
<wsdl:input message="tns:SubRequest"></wsdl:input>
<wsdl:output message="tns:SubResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="Mul">
<wsdl:input message="tns:MulRequest"></wsdl:input>
<wsdl:output message="tns:MulResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testSOAP" type="tns:test">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Add">
<soap:operation soapAction="http://localhost/test/soap/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="test">
<wsdl:port binding="tns:testSOAP" name="testSOAP">
<soap:address location="http://localhost/test/soap/myservice.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
注意事项:在WSDL源代码里面发现wsdl:operation 标签里只有Add 方法,而其他的Sub Mul等方法都没有添加,
这个时候请跟新Bind,重新生成该节点信息。