nusoap_server = new soap_server (); $this->nusoap_server->configureWSDL('messageReceiver', 'urn:messageReceiver'); $this->nusoap_server->soap_defencoding = 'UTF-8'; $this->nusoap_server->methodreturnisliteral=TRUE; $this->nusoap_server->wsdl->addComplexType( 'messageReceiver', 'simpleType', 'struct', '', 'SOAP-ENC:Array', array( 'username'=>array('name'=>'username', 'type'=>'xsd:string'), 'password'=>array('name'=>'password', 'type'=>'xsd:string'), 'requestID'=>array('name'=>'requestID', 'type'=>'xsd:string'), 'userID'=>array('name'=>'userID', 'type'=>'xsd:string'), 'receiverID'=>array('name'=>'receiverID', 'type'=>'xsd:string'), 'serviceID'=>array('name'=>'serviceID', 'type'=>'xsd:string'), 'commandCode'=>array('name'=>'commandCode', 'type'=>'xsd:string'), 'contentType'=>array('name'=>'contentType', 'type'=>'xsd:string'), 'info'=>array('name'=>'info', 'type'=>'xsd:string'), 'receiveTime'=>array('name'=>'receiveTime', 'type'=>'xsd:string') ) ); $this->nusoap_server->register ( 'MOReceiver', array( 'username' => 'xsd:string', 'password' => 'xsd:string', 'requestID' => 'xsd:string', 'userID' => 'xsd:string', 'receiverID' => 'xsd:string', 'serviceID' => 'xsd:string', 'commandCode' => 'xsd:string', 'contentType' => 'xsd:string', 'info' => 'xsd:string', 'receiveTime' => 'xsd:string') , array ('return' => 'xsd:string'),false,false ,'rpc' ); } function index() { if($this->uri->segment(3) == "wsdl") { $_SERVER['QUERY_STRING'] = "wsdl"; } else { $_SERVER['QUERY_STRING'] = ""; } function MOReceiver () { return 'Service not available!'; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA:''; $this->nusoap_server->service($HTTP_RAW_POST_DATA); } public function mo() { function MOReceiver($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime){ $msgType = '0'; //text message $errCode = '1'; //#1:error; 1:Success; $CI =& get_instance(); $mo_username = $CI->config->item('mo_username'); $mo_password = $CI->config->item('mo_password'); if (!$username) return '0|0|Username is required!'; if (!$password) return '0|0|Password is required!'; if ($username != $mo_username) return '0|0|Username is not corrected!'; if ($password != $mo_password) return '0|0|Password is not corrected!'; if (!$requestID) return '0|0|requestID is required!'; if (!$userID) return '0|0|UserID is required!'; if (!$serviceID) return '0|0|serviceID is required!'; if ($serviceID != '8062') return '0|0|serviceID is not corrected!'; $status = 0; $sentNumber = $userID; $username = !$receiverID ? $sentNumber : $receiverID; $CI->load->model('frontend/user_model', 'userModel'); $password = $CI->userModel->create_random_password(); $result = $CI->userModel->register ($sentNumber, $receiverID, $serviceID, $commandCode, $info, $receiveTime, $status); $aryAgrs = func_get_args (); $fh = fopen('register.log', 'a+'); fwrite ($fh, var_export($aryAgrs, true). "\n"); fclose($fh); $aryResult = explode ('|', $result); return $aryResult[0].'|'.$msgType.'|'.$aryResult[1]; } $this->nusoap_server->service(file_get_contents("php://input")); } } /* End of file viettel.php */ /* Location: ./application/modules/service/controllers/viettel.php */