我需要从wadl服务调用一个方法并传递一个参数
wadl: http://domain.com/application.wadl
method: checkInfo
我该怎么做?
//Wsdl - Soap: I need to do this but with a wadl service
$wsdl = new SoapClient('http://domain.com/application?wsdl');
$wsdl->__call('checkInfo',array('data'=> ''));
//or
$wsdl->checkInfo(array('data'=> ''));
谢谢!!!!
答案 0 :(得分:0)
您可以使用SOAP服务器执行此操作:
class MyClass{
function checkInfo() {
return "Hello";
}
}
//when in non-wsdl mode the uri option must be specified
$options=array('uri'=>'http://localhost/');
//create a new SOAP server
$server = new SoapServer(NULL,$options);
//attach the API class to the SOAP Server
$server->setClass('MyClass');
//start the SOAP requests handler
$server->handle();
然后使用它:
<?php
/*
* PHP SOAP - How to create a SOAP Server and a SOAP Client
*/
$options = array('location' => 'http://localhost/server.php',
'uri' => 'http://localhost/');
//create an instante of the SOAPClient (the API will be available)
$api = new SoapClient(NULL, $options);
//call an API method
echo $api->checkInfo();
?>
来自here
的代码示例