
25 Mar
2010
25 Mar
'10
6:48 a.m.
Yves Parès wrote:
Okay, well, apparently I have to rely on an external HTTP server. This is not very simple, is there another more suitable way to get RPC working in haskell?
Apparently it is possible to use Happstack as webserver, here's example I came up with: import Network.XmlRpc.Server import Happstack.Server.SimpleHTTP import Control.Monad.Trans import Data.ByteString.Lazy.Char8 add :: Int -> Int -> IO Int add x y = return (x + y) handler = do Body body <- rqBody `fmap` askRq liftIO $ handleCall (methods [("examples.add", fun add)]) (unpack body) main = simpleHTTP (Conf 8080 Nothing) handler