NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Error when use nusoap to build webservice as a cakephp contr


Joined: 15 Jan 2013
Posts: 2
Reply with quote
I have used nuSoap as vender and created a soap webservice as a cakephp controller.

route:

Code:
Router::connect('/sms_gateway', array('controller' => 'SMS', 'action' => 'receiveMO'));
Router::connect('/soap/:controller/:action/*', array('prefix'=>'soap', 'soap'=>true));


Server code:

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:

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?
View user's profileFind all posts by amor_nguyenSend private message


Joined: 15 Jan 2013
Posts: 2
Reply with quote
When I run
Code:
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?
View user's profileFind all posts by amor_nguyenSend private message


Joined: 02 Jun 2013
Posts: 1
Reply with quote
I run today into the same error message

Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in...

What have you done to solve the problem? Assuming you did.
View user's profileFind all posts by zazaSend private message
Error when use nusoap to build webservice as a cakephp contr
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic