MDL-52209 webservice_xmlrpc: Remove Zend from webservice_xmlrpc
authorJun Pataleta <jun@moodle.com>
Wed, 9 Dec 2015 08:58:12 +0000 (02:58 -0600)
committerDan Poltawski <dan@moodle.com>
Wed, 9 Dec 2015 09:42:24 +0000 (09:42 +0000)
Additional fixes.

webservice/upgrade.txt
webservice/xmlrpc/lib.php
webservice/xmlrpc/locallib.php

index 0deb3b2..9fc8059 100644 (file)
@@ -3,6 +3,13 @@ information provided here is intended especially for developers.
 
 This information is intended for authors of webservices, not people writing webservice clients.
 
+=== 3.1 ===
+
+* Zend_XmlRpc has been dropped from webservice_xmlrpc. Fault strings that were generated by
+  Zend_XmlRpc_XXX_Exception exceptions (i.e. 'Method "[methodname]" does not exist') are no longer used
+  which may display a different error message depending on the string returned by the getMessage()
+  method of the thrown exception.
+
 === 3.0 ===
 
 * WS protocols webservice/myprotocol:use capabilities were defined with a high riskbitmask value
index 6cb9cf7..2a46887 100644 (file)
@@ -95,7 +95,7 @@ class webservice_xmlrpc_client {
         // Decode the response.
         $result = xmlrpc_decode($response);
         if (is_array($result) && xmlrpc_is_fault($result)) {
-            throw new moodle_exception($result['faultString']);
+            throw new Exception($result['faultString'], $result['faultCode']);
         }
 
         return $result;
index c97ed7d..9803b9d 100644 (file)
@@ -103,7 +103,8 @@ class webservice_xmlrpc_server extends webservice_base_server {
             if (!empty($this->function->returns_desc)) {
                 $validatedvalues = external_api::clean_returnvalue($this->function->returns_desc, $this->returns);
                 $encodingoptions = array(
-                    "encoding" => "utf-8"
+                    "encoding" => "utf-8",
+                    "verbosity" => "no_white_space"
                 );
                 // We can now convert the response to the requested XML-RPC format.
                 $this->response = xmlrpc_encode_request(null, $validatedvalues, $encodingoptions);
@@ -186,7 +187,8 @@ class webservice_xmlrpc_server extends webservice_base_server {
         );
 
         $encodingoptions = array(
-            "encoding" => "utf-8"
+            "encoding" => "utf-8",
+            "verbosity" => "no_white_space"
         );
 
         return xmlrpc_encode_request(null, $fault, $encodingoptions);