haxr-3000.11.6: XML-RPC client and server library.

Copyright | (c) Bjorn Bringert 2003
License | BSD-style
Maintainer | bjorn@bringert.net
Stability | experimental
Portability | non-portable (requires extensions and non-portable libraries)
Safe Haskell | None
Language | Haskell2010

Network.XmlRpc.Server

Description

This module contains the server functionality of XML-RPC. The XML-RPC specifcation is available at http://www.xmlrpc.com/spec.

A simple CGI-based XML-RPC server application:

    import Network.XmlRpc.Server

    add :: Int -> Int -> IO Int
    add x y = return (x + y)

    main = cgiXmlRpcServer [("examples.add", fun add)]

Synopsis

- type XmlRpcMethod = (MethodCall -> ServerResult, Signature)
- type ServerResult = Err IO MethodResponse
- fun :: XmlRpcFun a => a -> XmlRpcMethod
- handleCall :: (MethodCall -> ServerResult) -> String -> IO ByteString
- methods :: [(String, XmlRpcMethod)] -> MethodCall -> ServerResult
- cgiXmlRpcServer :: [(String, XmlRpcMethod)] -> IO ()

# Documentation

type XmlRpcMethod = (MethodCall -> ServerResult, Signature) Source #

The type of XML-RPC methods on the server.

type ServerResult = Err IO MethodResponse Source #

fun :: XmlRpcFun a => a -> XmlRpcMethod Source #

Turns any function `(XmlRpcType t1, ..., XmlRpcType tn, XmlRpcType r) => t1 -> ... -> tn -> IO r` into an `XmlRpcMethod`

handleCall :: (MethodCall -> ServerResult) -> String -> IO ByteString Source #

Reads a method call from a string, uses the supplied method to generate a response and returns that response as a string

methods :: [(String, XmlRpcMethod)] -> MethodCall -> ServerResult Source #

An XmlRpcMethod that looks up the method name in a table and uses that method to handle the call.

cgiXmlRpcServer :: [(String, XmlRpcMethod)] -> IO () Source #

A CGI-based XML-RPC server. Reads a request from standard input and writes some HTTP headers (Content-Type and Content-Length), followed by the response to standard output. Supports introspection.