Simple XML-RPC example - Factor talking to a Common Lisp web service
Thursday, November 30, 2006
This example makes a paste to the LispPaste service; it requires the latest Factor from darcs:
IN: lisppaste
REQUIRES: libs/xml-rpc ;
USING: arrays kernel xml-rpc ;
: url "http://www.common-lisp.net:8185/RPC2" ;
: lisppaste ( channel user title contents -- response )
4array "newpaste" swap <rpc-method> url post-rpc ;
You can use it like so:
"#concatenative" "jane_doe" "Test" "Testing testing" lisppaste
But please don’t flood our channel with useless pastes. As soon as Dan fixes some bugs in the XML-RPC code, I will extend this example to have a GUI which offers a channel list.