PHP代码如下:<?php
@ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient('http://localhost:8080/hello.wsdl');
echo("<pre>");
var_dump($client->__getFunctions());
echo("</pre>");
try {
echo($client->__call('hello', array('World')));
} catch (SoapFault $exception) {
echo $exception;
}
?>运行后输出如下:
array(1) {
[0]=>
string(33) "helloResponse hello(hello $hello)"
}
SoapFault exception: [helloFault] hello() takes exactly 2 arguments (1 given) in C:\website\cosmetics\src\test02.php:11 Stack trace: #0 C:\website\cosmetics\src\test02.php(11): SoapClient->__call('hello', Array) #1 {main}请问,__call已经传入了2个参数,为何还报缺少一个参数?谢谢
@ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient('http://localhost:8080/hello.wsdl');
echo("<pre>");
var_dump($client->__getFunctions());
echo("</pre>");
try {
echo($client->__call('hello', array('World')));
} catch (SoapFault $exception) {
echo $exception;
}
?>运行后输出如下:
array(1) {
[0]=>
string(33) "helloResponse hello(hello $hello)"
}
SoapFault exception: [helloFault] hello() takes exactly 2 arguments (1 given) in C:\website\cosmetics\src\test02.php:11 Stack trace: #0 C:\website\cosmetics\src\test02.php(11): SoapClient->__call('hello', Array) #1 {main}请问,__call已经传入了2个参数,为何还报缺少一个参数?谢谢
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers import primitive as soap_typesurls = ("/hello", "HelloService",
"/hello.wsdl", "HelloService",
)
render = web.template.Template("$def with (var)\n$:var")class SoapService(SimpleWSGISoapApp):
"""Class for webservice """
message = ''
@soapmethod(soap_types.String,_returns=soap_types.String)
def hello(self,message):
""" Method for webservice"""
return "Hello world "+messageclass HelloService(SoapService):
"""Class for web.py """
def start_response(self,status, headers):
web.ctx.status = status
for header, value in headers:
web.header(header, value)
def GET(self):
response = super(SimpleWSGISoapApp, self).__call__(web.ctx.environ, self.start_response)
return render("\n".join(response))
def POST(self):
response = super(SimpleWSGISoapApp, self).__call__(web.ctx.environ, self.start_response)
return render("\n".join(response))app=web.application(urls, globals())if __name__ == "__main__":
app.run()