1.server.php
<?php
class Result{
function add($a,$b){
return $a+$b;
}
}
?>
class Result{
function add($a,$b){
return $a+$b;
}
}
?>
2.kobetest.wsdl
<?
xml
version
='1.0'
encoding
='UTF-8'
?>
<!-- WSDL file generated by Zend Studio. -->
< definitions name ="kobetest" targetNamespace ="urn:kobetest" xmlns:typens ="urn:kobetest" 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 ="add" >
< part name ="a" type ="xsd:string" />
< part name ="b" type ="xsd:string" />
</ message >
< message name ="addResponse" >
< part name ="addReturn" type ="xsd:string" />
</ message >
< portType name ="ResultPortType" >
< operation name ="add" >
< input message ="typens:add" />
< output message ="typens:addResponse" />
</ operation >
</ portType >
< binding name ="ResultBinding" type ="typens:ResultPortType" >
< soap:binding style ="rpc" transport ="http://schemas.xmlsoap.org/soap/http" />
< operation name ="add" >
< soap:operation soapAction ="urn:ResultAction" />
< input >
< soap:body namespace ="urn:kobetest" use ="encoded" encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" />
</ input >
< output >
< soap:body namespace ="urn:kobetest" use ="encoded" encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" />
</ output >
</ operation >
</ binding >
< service name ="kobetestService" >
< port name ="ResultPort" binding ="typens:ResultBinding" >
< soap:address location ="http://192.168.1.55/server.php" />
</ port >
</ service >
</ definitions >
<!-- WSDL file generated by Zend Studio. -->
< definitions name ="kobetest" targetNamespace ="urn:kobetest" xmlns:typens ="urn:kobetest" 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 ="add" >
< part name ="a" type ="xsd:string" />
< part name ="b" type ="xsd:string" />
</ message >
< message name ="addResponse" >
< part name ="addReturn" type ="xsd:string" />
</ message >
< portType name ="ResultPortType" >
< operation name ="add" >
< input message ="typens:add" />
< output message ="typens:addResponse" />
</ operation >
</ portType >
< binding name ="ResultBinding" type ="typens:ResultPortType" >
< soap:binding style ="rpc" transport ="http://schemas.xmlsoap.org/soap/http" />
< operation name ="add" >
< soap:operation soapAction ="urn:ResultAction" />
< input >
< soap:body namespace ="urn:kobetest" use ="encoded" encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" />
</ input >
< output >
< soap:body namespace ="urn:kobetest" use ="encoded" encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" />
</ output >
</ operation >
</ binding >
< service name ="kobetestService" >
< port name ="ResultPort" binding ="typens:ResultBinding" >
< soap:address location ="http://192.168.1.55/server.php" />
</ port >
</ service >
</ definitions >
3.在VS2005中“添加web引用”,然后在代码里调用webservice就OK了。
PS:这里只是简单的写了基本过程。有些细节的地方没注明,需要的朋友可以留言联系我。
转载于:https://blog.51cto.com/yardan/60025