Using xmlrpc-client.lsp...

Q&A's, tips, howto's

Using xmlrpc-client.lsp...

Postby oofoe » Sat Jan 09, 2016 1:17 pm


I ran into a little problem when using %xmlrpc-client.lsp with our python/django XMLRPC server at work. It has a very strict interpretation of how many arguments it will accept for certain functions, like system.listMethods, so the default request with the single dummy argument won't work.

I wound up adding something like this to xmlrpc-client.lsp:
Code: Select all
(define (format-request method)
  "( method /arg.../ -- XML) Compose XML request."

  (let ((xml (format
         "<?xml version=\"1.0\"?><methodCall><methodName>%s</methodName><params>"
    (dolist (value (args))
      (push (format "<param><value>%s</value></param>" value) xml -1))
    (push "</params></methodCall>\n" xml -1)))

Then changing system.listMethods to:
Code: Select all
(define (system.listMethods url)
    (execute url (format-request "system.listMethods")))

Technically, format-request should also determine the type of the argument values (and encode lists and dictionaries correctly), but if you're only using string arguments, it should suffice.

Maybe someone has a better format-request they could share? ; - )
Testing can show the presence of bugs, but not their absence.
Posts: 60
Joined: Wed Sep 28, 2005 7:13 pm

Re: Using xmlrpc-client.lsp...

Postby Lutz » Sun Jan 10, 2016 6:13 pm

Thanks Oofoe, additions added to the module: ... t.lsp.html
Posts: 5276
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Using xmlrpc-client.lsp...

Postby abaddon1234 » Sat Jun 18, 2016 3:36 am

Thanks for the info
ทางเข้า gclub
Posts: 21
Joined: Mon Sep 14, 2015 3:09 am

Return to newLISP in the real world

Who is online

Users browsing this forum: joejoe and 2 guests