Joined: 15 Jan 2013 |
Posts: 2 |
|
|
|
Posted: Tue Jan 15, 2013 4:28 am |
|
|
|
|
|
I have used nuSoap as vender and created a soap webservice as a cakephp controller.
route:
Router::connect('/sms_gateway', array('controller' => 'SMS', 'action' => 'receiveMO'));
Router::connect('/soap/:controller/:action/*', array('prefix'=>'soap', 'soap'=>true)); |
Server code:
App::uses('AppController', 'Controller');
App::import('Vendor','nusoap/nusoap');
class SMSController extends AppController {
public $name = 'SMS';
public $uses = array();
public $autoRender = false;
public $layout = false;
function receiveMO(){
$server = new soap_server();
$namespace = false;
$soapaction = 'http://pay.idivu.com/soap/SMS/smsIn';
$endpoint = 'http://pay.idivu.com/soap/SMS';
$server->configureWSDL('smsIn',$namespace,$soapaction);
$server->register("smsIn", array('User_Id' => 'xsd:string','Service_Id'=>'xsd:string','Request_Id'=>'xsd:string','Command_Code'=>'xsd:string','Message'=>'xsd:string','User'=>'xsd:string','Pass'=>'xsd:string'),array('ketqua' => 'xsd:int'), $namespace, $soapaction,'rpc','literal','idivu.com');
$query = isset($HTTP_RAW_POST_DATA)? $HTTP_RAW_POST_DATA : '';
$server->service($query);
exit();
}
function soap_smsIn($userId,$serviceId,$request_id,$command_code,$info,$user,$pass){
// code here
}
} |
Client code:
require_once 'nusoap/nusoap.php';
$svTest = new SoapClient("http://pay.idivu.com/sms_gateway?wsdl");
$result = $svTest->smsIn("0123456789","8888","0","KH","KH AT","user","pass");
print_r($result); |
When I run result is an xml document. But when i run client code, it returns error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in...
How to use nusoap to build webservice as a cakephp controller?
|
|
Joined: 15 Jan 2013 |
Posts: 2 |
|
|
|
Posted: Tue Jan 15, 2013 4:30 am |
|
|
|
|
|
When I run http://pay.idivu.com/sms_gateway?wsdl |
result is an xml document. But when i run client code, it returns error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in...
How to use nusoap to build webservice as a cakephp controller?
|
|