فهرست منبع

Use correctly soap_defencoding

jmontoyaa 8 سال پیش
والد
کامیت
66ea956015
2فایلهای تغییر یافته به همراه12 افزوده شده و 10 حذف شده
  1. 11 9
      main/inc/lib/nusoap/class.soap_server.php
  2. 1 1
      main/inc/lib/nusoap/class.wsdl.php

+ 11 - 9
main/inc/lib/nusoap/class.soap_server.php

@@ -1,8 +1,5 @@
 <?php
 
-
-
-
 /**
 *
 * nusoap_server allows the user to create a SOAP server
@@ -209,15 +206,17 @@ class nusoap_server extends nusoap_base {
 		}
 
 		// wsdl
-		if($wsdl){
+		if ($wsdl){
 			$this->debug("In nusoap_server, WSDL is specified");
 			if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
 				$this->wsdl = $wsdl;
+                $this->wsdl->soap_defencoding = $this->soap_defencoding;
 				$this->externalWSDLURL = $this->wsdl->wsdl;
 				$this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
 			} else {
 				$this->debug('Create wsdl from ' . $wsdl);
 				$this->wsdl = new wsdl($wsdl);
+                $this->wsdl->soap_defencoding = $this->soap_defencoding;
 				$this->externalWSDLURL = $wsdl;
 			}
 			$this->appendDebug($this->wsdl->getDebug());
@@ -284,8 +283,9 @@ class nusoap_server extends nusoap_base {
               }
 			} elseif ($this->wsdl) {
 				$this->debug("In service, serialize WSDL");
-				header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
+				header("Content-Type: text/xml; charset=".$this->soap_defencoding."\r\n");
 				print $this->wsdl->serialize($this->debug_flag);
+
 				if ($this->debug_flag) {
 					$this->debug('wsdl:');
 					$this->appendDebug($this->varDump($this->wsdl));
@@ -293,7 +293,7 @@ class nusoap_server extends nusoap_base {
 				}
 			} else {
 				$this->debug("In service, there is no WSDL");
-				header("Content-Type: text/html; charset=ISO-8859-1\r\n");
+				header("Content-Type: text/html; charset=".$this->soap_defencoding."\r\n");
 				print "This service does not provide WSDL";
 			}
 		} elseif ($this->wsdl) {
@@ -845,7 +845,7 @@ class nusoap_server extends nusoap_base {
 	* @param	array	$headers	The HTTP headers
 	* @param	string	$data		unprocessed request data from client
 	* @return	mixed	value of the message, decoded into a PHP type
-	* @access   private
+	* @access   privatet
 	*/
     function parseRequest($headers, $data) {
 		$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:');
@@ -1092,7 +1092,8 @@ class nusoap_server extends nusoap_base {
             $schemaTargetNamespace = $namespace;
         }
 
-		$this->wsdl = new wsdl;
+		$this->wsdl = new wsdl();
+        $this->wsdl->soap_defencoding = $this->soap_defencoding;
 		$this->wsdl->serviceName = $serviceName;
         $this->wsdl->endpoint = $endpoint;
 		$this->wsdl->namespaces['tns'] = $namespace;
@@ -1123,5 +1124,6 @@ class nusoap_server extends nusoap_base {
 /**
  * Backward compatibility
  */
-class soap_server extends nusoap_server {
+class soap_server extends nusoap_server
+{
 }

+ 1 - 1
main/inc/lib/nusoap/class.wsdl.php

@@ -889,7 +889,7 @@ class wsdl extends nusoap_base {
 	*/
 	function serialize($debug = 0)
 	{
-		$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
+		$xml = '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>';
 		$xml .= "\n<definitions";
 		foreach($this->namespaces as $k => $v) {
 			$xml .= " xmlns:$k=\"$v\"";