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&#61;"http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns&#61;"http://localhost/test/soap" xmlns:wsdl&#61;"http://schemas.xmlsoap.org/wsdl/" xmlns:xsd&#61;"http://www.w3.org/2001/XMLSchema" name&#61;"test" targetNamespace&#61;"http://localhost/test/soap">
<wsdl:types>
<xsd:schema targetNamespace&#61;"http://localhost/test/soap">
<xsd:element name&#61;"Add">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"in" type&#61;"xsd:string"/>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int"/>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"b" type&#61;"xsd:string">xsd:element>
<xsd:element name&#61;"Add_fault" type&#61;"xsd:string">xsd:element>
<xsd:element name&#61;"Sub">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"in" type&#61;"xsd:string">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"SubResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"MulResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
xsd:schema>
wsdl:types>
<wsdl:message name&#61;"AddRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
<wsdl:part name&#61;"b" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"AddResponse">
<wsdl:part element&#61;"tns:AddResponse" name&#61;"AddReturn"/>
wsdl:message>
<wsdl:message name&#61;"Add_faultMsg">
wsdl:message>
<wsdl:message name&#61;"SubRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"SubResponse">
<wsdl:part name&#61;"SubReturn" element&#61;"tns:SubResponse">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"MulRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
<wsdl:part name&#61;"b" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"MulResponse">
<wsdl:part name&#61;"MulReturn" element&#61;"tns:MulResponse">wsdl:part>
wsdl:message>
<wsdl:portType name&#61;"test">
<wsdl:operation name&#61;"Add">
<wsdl:input message&#61;"tns:AddRequest"/>
<wsdl:output message&#61;"tns:AddResponse"/>
wsdl:operation>
<wsdl:operation name&#61;"Sub">
<wsdl:input message&#61;"tns:SubRequest">wsdl:input>
<wsdl:output message&#61;"tns:SubResponse">wsdl:output>
wsdl:operation>
<wsdl:operation name&#61;"Mul">
<wsdl:input message&#61;"tns:MulRequest">wsdl:input>
<wsdl:output message&#61;"tns:MulResponse">wsdl:output>
wsdl:operation>
wsdl:portType>
<wsdl:binding name&#61;"testSOAP" type&#61;"tns:test">
<soap:binding style&#61;"document" transport&#61;"http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name&#61;"Add">
<soap:operation soapAction&#61;"http://localhost/test/soap/NewOperation"/>
<wsdl:input>
<soap:body use&#61;"literal"/>
wsdl:input>
<wsdl:output>
<soap:body use&#61;"literal"/>
wsdl:output>
wsdl:operation>
wsdl:binding>
<wsdl:service name&#61;"test">
<wsdl:port binding&#61;"tns:testSOAP" name&#61;"testSOAP">
<soap:address location&#61;"http://localhost/test/soap/myservice.php"/>
wsdl:port>
wsdl:service>
wsdl:definitions>
这就是WSDL源代码。如何引用&#xff0c;如何使用参考http://www.cnblogs.com/likwo/archive/2009/09/18/1569036.html<wsdl:definitions xmlns:soap&#61;"http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns&#61;"http://localhost/test/soap" xmlns:wsdl&#61;"http://schemas.xmlsoap.org/wsdl/" xmlns:xsd&#61;"http://www.w3.org/2001/XMLSchema" name&#61;"test" targetNamespace&#61;"http://localhost/test/soap">
<wsdl:types>
<xsd:schema targetNamespace&#61;"http://localhost/test/soap">
<xsd:element name&#61;"Add">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"in" type&#61;"xsd:string"/>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"AddResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int"/>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"b" type&#61;"xsd:string">xsd:element>
<xsd:element name&#61;"Add_fault" type&#61;"xsd:string">xsd:element>
<xsd:element name&#61;"Sub">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"in" type&#61;"xsd:string">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"SubResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
<xsd:element name&#61;"MulResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name&#61;"out" type&#61;"xsd:int">xsd:element>
xsd:sequence>
xsd:complexType>
xsd:element>
xsd:schema>
wsdl:types>
<wsdl:message name&#61;"AddRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
<wsdl:part name&#61;"b" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"AddResponse">
<wsdl:part element&#61;"tns:AddResponse" name&#61;"AddReturn"/>
wsdl:message>
<wsdl:message name&#61;"Add_faultMsg">
wsdl:message>
<wsdl:message name&#61;"SubRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"SubResponse">
<wsdl:part name&#61;"SubReturn" element&#61;"tns:SubResponse">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"MulRequest">
<wsdl:part name&#61;"a" type&#61;"xsd:int">wsdl:part>
<wsdl:part name&#61;"b" type&#61;"xsd:int">wsdl:part>
wsdl:message>
<wsdl:message name&#61;"MulResponse">
<wsdl:part name&#61;"MulReturn" element&#61;"tns:MulResponse">wsdl:part>
wsdl:message>
<wsdl:portType name&#61;"test">
<wsdl:operation name&#61;"Add">
<wsdl:input message&#61;"tns:AddRequest"/>
<wsdl:output message&#61;"tns:AddResponse"/>
wsdl:operation>
<wsdl:operation name&#61;"Sub">
<wsdl:input message&#61;"tns:SubRequest">wsdl:input>
<wsdl:output message&#61;"tns:SubResponse">wsdl:output>
wsdl:operation>
<wsdl:operation name&#61;"Mul">
<wsdl:input message&#61;"tns:MulRequest">wsdl:input>
<wsdl:output message&#61;"tns:MulResponse">wsdl:output>
wsdl:operation>
wsdl:portType>
<wsdl:binding name&#61;"testSOAP" type&#61;"tns:test">
<soap:binding style&#61;"document" transport&#61;"http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name&#61;"Add">
<soap:operation soapAction&#61;"http://localhost/test/soap/NewOperation"/>
<wsdl:input>
<soap:body use&#61;"literal"/>
wsdl:input>
<wsdl:output>
<soap:body use&#61;"literal"/>
wsdl:output>
wsdl:operation>
wsdl:binding>
<wsdl:service name&#61;"test">
<wsdl:port binding&#61;"tns:testSOAP" name&#61;"testSOAP">
<soap:address location&#61;"http://localhost/test/soap/myservice.php"/>
wsdl:port>
wsdl:service>
wsdl:definitions>
注意事项&#xff1a;在WSDL源代码里面发现wsdl:operation 标签里只有Add 方法&#xff0c;而其他的Sub Mul等方法都没有添加&#xff0c;
这个时候请跟新Bind&#xff0c;重新生成该节点信息。