在php中使用wadl服务
我需要从wadl服务调用一个方法并传递一个参数在php中使用wadl服务,php,web-services,codeigniter,wadl,Php,Web Services,Codeigniter,Wadl,我需要从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('d
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'=> ''));
谢谢 您可以通过使用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();
?>
源代码示例