Patch for xmlrpc module

Started by kosh, March 26, 2012, 11:05:15 AM

Previous topic - Next topic

kosh

Hello Lutz.

This patch is for correcting XML-RPC module (xmlrpc.cgi and xmlrpc-client.lsp).



example/xmlrpc.cgi:
--- newlisp-10.4.0/examples/xmlrpc.cgi.orig 2012-03-07 02:42:20.000000000 +0900
+++ newlisp-10.4.0/examples/xmlrpc.cgi 2012-03-26 14:40:35.000000000 +0900
@@ -128,7 +128,7 @@
     
 
 (define (system.methodHelp params, methodName)
-    (set 'methodName (nth (params 0 1 1 1 1)))
+    (set 'methodName (params 0 1 1 1 1))
     (case methodName
         ("system.listMethods" (format normal-response "Lists all methods implemented."))
         ("system.methodHelp" (format normal-response "Documents a method."))
@@ -138,7 +138,7 @@
 )
 
 (define (system.methodSignature params)
-    (set 'methodName (nth (params 0 1 1 1 1)))
+    (set 'methodName (params 0 1 1 1 1))
     (case methodName
         ("system.listMethods" (format normal-response
 "<array>

module/xmlrpc-client.lsp:
--- newlisp-10.4.0/modules/xmlrpc-client.lsp.orig 2012-02-14 23:51:11.000000000 +0900
+++ newlisp-10.4.0/modules/xmlrpc-client.lsp 2012-03-26 14:09:38.466104400 +0900
@@ -114,6 +114,8 @@
 ;
 (define (get-value expr)
     (if (empty? expr) nil
+
+        (list? (expr 1))
         (case (expr 1 0)
             ("i4" (int (expr 1 1)))
             ("int" (int (expr 1 1)))
@@ -126,7 +128,10 @@
                          (get-array (rest (expr 1 1)))) )
             ("struct" (get-struct (rest (expr 1))))
             ("string" (expr 1 1))
-            (true (expr 1)))) )
+            (true (expr 1)))
+
+        true (string (expr 1))       ; If no type is indicated, the type is string.
+      ))
 
 ; get contents from expr = ((value ...) (value ...) ...)
 ;


Now, http://www.newlisp.org/downloads/newlisp_manual.html#XML">XML-RPC sample will works well.
> (module "xmlrpc-client.lsp")
MAIN
> (XMLRPC:system.methodSignature "http://example.com/xmlrpc.cgi" "newLISP.evalString")
(("base64" "base64"))
; A past return value is (("m30" "m30"))

Lutz

#1
Thanks very much Kosh, files are updated here:



http://www.newlisp.org/code/modules/xmlrpc-client.lsp.html">http://www.newlisp.org/code/modules/xml ... t.lsp.html">http://www.newlisp.org/code/modules/xmlrpc-client.lsp.html



and here



http://www.newlisp.org/code/xmlrpc-cgi.txt">http://www.newlisp.org/code/xmlrpc-cgi.txt