Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/moservice.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/moservice.php	(revision 483)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/moservice.php	(revision 483)
@@ -0,0 +1,74 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * Moservice Class
+ * 
+ * @author dzungnv02
+ *
+ */
+
+class Moservice extends MX_Controller 
+{
+	private $_wsdl = 'http://210.211.97.53/mo.wsdl';
+	private $_server = null;
+		
+	public function __construct() 
+	{
+		parent::__construct();
+		ini_set("soap.wsdl_cache_enabled","1");		
+		$this->_server = new SoapServer(NULL,
+					array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'uri' => 'http://tempuri.org/')
+				);
+		
+	}
+	
+	public function index () 
+	{
+		function messageReceiver()
+		{
+			$aryArgs = func_get_args();
+			list($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime) = $aryArgs;
+			return '1|0|'.$commandCode.$serviceID;
+		}
+		
+		$this->_server->addFunction('messageReceiver');		
+
+		try {
+			ob_start();
+			$soapOutput = '';
+			$this->_server->handle();
+			
+			if (ob_get_length() > 0) {
+				$soapOutput = ob_get_clean();
+			}			
+			
+			if ($soapOutput != '') { 
+				$pattern = '/<[^>]*[^\/]>/i';
+				$aryOutput = preg_split ($pattern, $soapOutput, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
+				
+				$xml = '<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+						   <S:Body>
+						      <messageReceiverResponse xmlns="http://tempuri.org/">
+						         <return>'.$aryOutput[1].'</return>
+						      </messageReceiverResponse>
+						   </S:Body>
+						</S:Envelope>';
+				
+				header('Content-Type: text/xml; charset: utf-8');
+				echo $xml;
+			}
+			else {
+				header('Content-Type: text/html; charset: utf-8');
+				echo 'See service <a href="'.base_url().'services/moservice/wsdl">WSDL page</a>';
+			}
+		}
+		catch (Exception $e) {
+		    $this->_server->fault('Sender', $e->getMessage());
+		}		
+	}
+	
+	public function wsdl ()
+	{
+		header('Content-Type: text/xml; charset: utf-8');
+		echo file_get_contents($this->_wsdl);
+	}
+}
Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 470)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/viettel.php	(revision 483)
@@ -9,46 +9,13 @@
 class Viettel extends MX_Controller 
 {
+	
+	private $_server = null;
+	
 	function __construct() {
 		parent::__construct ();
-		
-		$this->nusoap_server = new soap_server ();
-		$this->nusoap_server->configureWSDL('messageReceiverWSDL','urn:messageReceiverWSDL');
-
-		$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')
-				)
+		ini_set("soap.wsdl_cache_enabled","1");
+		$this->_server = new SoapServer(NULL,
+				array('soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'uri' => 'http://tempuri.org/')
 		);
-		
-		$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'),
-				'urn:messageReceiverWSDL',"urn:messageReceiverWSDL#MOReceiver","rpc","encoded");
 	}
 
@@ -56,14 +23,18 @@
 	{
 		if($this->uri->segment(4) == "wsdl") {
-			$_SERVER['QUERY_STRING'] = "wsdl";
+			header('Content-Type: text/xml; charset: utf-8');
+			$this->load->view('mowsdl');
 		} else {
-			$_SERVER['QUERY_STRING'] = "";
-		}
-		$this->nusoap_server->service(file_get_contents("php://input"));
+			header('Content-Type: text/html; charset: utf-8');
+			echo 'See service <a href="'.base_url().'violetservice/soanbai/mo/wsdl">WSDL page</a>';
+		}			
 	}
 	
 	public function mo() 
 	{	
-		function MOReceiver($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime){
+		function messageReceiver(){
+			$aryArgs = func_get_args();
+			list($username, $password, $requestID, $userID, $receiverID, $serviceID, $commandCode, $contentType ,$info, $receiveTime) = $aryArgs;
+			
 			$msgType = '0'; //text message
 			$errCode = '1'; //#1:error; 1:Success;
@@ -78,4 +49,5 @@
 			if ($password != $mo_password) return '0|0|Password is not corrected!';
 			if (!$requestID) return '0|0|requestID is required!';
+			if ((int)$requestID != 4) return '0|0|requestID is not corrected!';
 			if (!$userID) return '0|0|UserID is required!';
 			if (!$serviceID) return '0|0|serviceID is required!';
@@ -96,5 +68,37 @@
 		}
 		
-		$this->nusoap_server->service(file_get_contents("php://input"));
+		$this->_server->addFunction('messageReceiver');
+		try {
+			ob_start();
+			$soapOutput = '';
+			$this->_server->handle();
+				
+			if (ob_get_length() > 0) {
+				$soapOutput = ob_get_clean();
+			}
+				
+			if ($soapOutput != '') {
+				$pattern = '/<[^>]*[^\/]>/i';
+				$aryOutput = preg_split ($pattern, $soapOutput, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
+		
+				$xml = '<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
+						   <S:Body>
+						      <messageReceiverResponse xmlns="http://tempuri.org/">
+						         <return>'.$aryOutput[1].'</return>
+						      </messageReceiverResponse>
+						   </S:Body>
+						</S:Envelope>';
+		
+				header('Content-Type: text/xml; charset: utf-8');
+				echo $xml;
+			}
+			else {
+				header('Content-Type: text/html; charset: utf-8');
+				echo 'See service <a href="'.base_url().'violetservice/soanbai/mo/wsdl">WSDL page</a>';
+			}
+		}
+		catch (Exception $e) {
+			$this->_server->fault('Sender', $e->getMessage());
+		}
 	}
 }
Index: pro-violet-viettel/sourcecode/application/modules/services/views/mowsdl.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/views/mowsdl.php	(revision 483)
+++ pro-violet-viettel/sourcecode/application/modules/services/views/mowsdl.php	(revision 483)
@@ -0,0 +1,59 @@
+<?php echo "<?xml version='1.0' encoding='UTF-8'?>";?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
+  <wsdl:types>
+    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
+      <s:element name="messageReceiver">
+        <s:complexType>
+          <s:sequence>
+            <s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="requestID" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="userID" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="receiverID" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="serviceID" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="commandCode" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="contentType" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="info" type="s:string"/>
+            <s:element minOccurs="0" maxOccurs="1" name="receiveTime" type="s:string"/>
+          </s:sequence>
+        </s:complexType>
+      </s:element>
+      <s:element name="messageReceiverResponse">
+        <s:complexType>
+          <s:sequence>
+            <s:element minOccurs="0" maxOccurs="1" name="return" type="s:string"/>
+          </s:sequence>
+        </s:complexType>
+      </s:element>
+    </s:schema>
+  </wsdl:types>
+  <wsdl:message name="messageReceiverSoapIn">
+    <wsdl:part name="parameters" element="tns:messageReceiver"/>
+  </wsdl:message>
+  <wsdl:message name="messageReceiverSoapOut">
+    <wsdl:part name="parameters" element="tns:messageReceiverResponse"/>
+  </wsdl:message>
+  <wsdl:portType name="MOReceiver">
+    <wsdl:operation name="messageReceiver">
+      <wsdl:input message="tns:messageReceiverSoapIn"/>
+      <wsdl:output message="tns:messageReceiverSoapOut"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="MOReceiver" type="tns:MOReceiver">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="messageReceiver">
+      <soap:operation soapAction="http://tempuri.org/messageReceiver" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="MOReceiver">
+    <wsdl:port name="MOReceiver" binding="tns:MOReceiver">
+      <soap:address location="<?php echo base_url();?>violetservice/soanbai/mo"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
