soap: SOAP client tools

[ library, mit, web ] [ Propose Tags ]

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 "http://example.com/soap/endpoint" 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
    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 . 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: https://bitbucket.org/dpwiz/haskell-soap/src/HEAD/soap/examples/

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.3, 0.1.0.4, 0.2.0.0, 0.2.0.2, 0.2.0.3, 0.2.0.4, 0.2.1.1, 0.2.1.2, 0.2.1.3, 0.2.2.0, 0.2.2.1, 0.2.2.2, 0.2.2.3, 0.2.2.4, 0.2.2.5, 0.2.2.6, 0.2.2.7, 0.2.3.0, 0.2.3.1, 0.2.3.2, 0.2.3.3, 0.2.3.4, 0.2.3.5, 0.2.3.6 (info)
Change log changelog
Dependencies base (>=4.8 && <5.0), bytestring (>=0.10.6 && <0.12), conduit (>=1.2.6.6 && <1.4), configurator (>=0.3 && <1.0), data-default (>=0.5.3 && <1.0), exceptions (>=0.8.2.1 && <0.11), http-client (>=0.2 && <1.0), http-types (>=0.9 && <1.0), iconv (>=0.4.1.3 && <0.5), mtl (>=2.2.1 && <3.0), resourcet (>=1.1.7.4 && <1.3), text (>=1.2.2.1 && <2.1), unordered-containers (>=0.2.5.1 && <0.3), xml-conduit (>=1.3.5 && <2.0), xml-conduit-writer (>=0.1.1.2 && <0.2), xml-types (>=0.3.6 && <0.4) [details]
License MIT
Copyright (c) 2013-2017 Alexander Bondarenko
Author Alexander Bondarenko
Maintainer aenor.realm@gmail.com
Revised Revision 2 made by AlexanderBondarenko at 2022-03-20T10:36:44Z
Category Web
Home page https://bitbucket.org/dpwiz/haskell-soap
Uploaded by AlexanderBondarenko at 2018-03-16T13:34:30Z
Distributions Debian:0.2.3.6, LTSHaskell:0.2.3.6, NixOS:0.2.3.6
Downloads 14339 total (87 in the last 30 days)
Rating 1.75 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-03-16 [all 1 reports]