The soap package

[Tags:library, mit, test]

Tools to build SOAP clients using xml-conduit.

A mildly-complicated example:

 import Network.SOAP
 import Network.SOAP.Transport.HTTP

 import Text.XML.Writer
 import Text.XML.Stream.Parse as Parse
 import           Data.Text (Text)
 import qualified Data.Text as T

 main :: IO ()
 main = do
     -- Initial one-time preparations.
     transport <- initTransport "" id (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
         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 . T.unpack $ age)

Notice: to invoke HTTPS services you need to initialize a transport from soap-tls or soap-openssl.

Full examples available at source repo:


Versions,,,,,,,,,,,,,,,,,,,,,,,, (info)
Change log changelog
Dependencies base (==4.*), bytestring, conduit, configurator, data-default, exceptions, http-client (>=0.2), http-types, iconv, mtl, resourcet, text, unordered-containers, xml-conduit, xml-conduit-writer, xml-types [details]
License MIT
Copyright (c) 2013-2017 Alexander Bondarenko
Author Alexander Bondarenko
Category Web
Home page
Uploaded Mon May 29 21:36:13 UTC 2017 by AlexanderBondarenko
Distributions LTSHaskell:, NixOS:, Stackage:, Tumbleweed:
Downloads 4218 total (42 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-05-29 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees