@hackage soap0.2.0.2

SOAP client tools

Tools to build SOAP clients using xml-conduit.

A mildly-complicated example:

main = do
    -- Initial one-time preparations.
    certP <- clientCert "priv/client.crt" "priv/client.key"
    transport <- initTransport "https://example.com/soap/endpoint" certP (iconv "cp-1251")

    -- Making queries
    activeStaff <- listStaff transport True
    print activeStaff

data Person = Person Text Int deriving Show

listStaff :: Transport -> Bool -> IO [Person]
listStaff t active = invokeWS t "urn:dummy:listStaff" () body parser
    where
        body = element "request" $ element "listStaff" $ do
                   element "active" active
                   element "order" $ T.pack "age"
                   element "limit" (10 :: Int)

        parser = StreamParser $ force "no people" $ tagNoAttr "people" $ Parse.many parsePerson

        parsePerson = tagName "person" (requireAttr "age") $ \age -> do
                          name <- Parse.content
                          return $ Person name (read . unpack $ age)

Changelog

  • 0.2: Switch to xml-conduit-writer for more clean serializers. Pluggable transports. Raw and streaming parsers.

  • 0.1: Initial implementation, somewhat inflexible and warty, but working with diverse services.