1 HaXR — the Haskell XML-RPC library
Christopher Milton came up with the HaXR name, thanks!
Example are available in the examples/ folder in the darcs repository. Here we talk about a couple of them.
This is a simple CGI-based server with only one method that takes two integers and returns their sum.
import Network.XmlRpc.Server add :: Int -> Int -> IO Int add x y = return (x + y) main = cgiXmlRpcServer [("examples.add", fun add)]
Note: the argument to fun can be a function that takes any number of arguments.
This is a client that calls the method implemented by the server above and prints the result.
import Network.XmlRpc.Client server = "http://localhost/~bjorn/cgi-bin/simple_server" add :: String -> Int -> Int -> IO Int add url = remote url "examples.add" main = do let x = 4 y = 7 z <- add server x y putStrLn (show x ++ " + " ++ show y ++ " = " ++ show z)
Note: the function returned by remote can be a function that takes any number of arguments.
126.96.36.199 Heterogeneous structs
188.8.131.52 XML-RPC introspection
1.1.2 API reference
Use the online copy of the API documentation.
There used to be a separate haxr-th, now everything is available in haxr.
1.2.2 Darcs repository
$ darcs get http://code.haskell.org/haxr/
1.3 Reporting bugs, requesting features
To report bugs, request features, submit patches, or ask for help, email Brent Yorgey.
Some known problems are listed in the TODO file in the source distribution. If you need any of those fixed, let me know.
HaXR is distributed under a BSD-style license.
<div class="bar" />