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:


* Fix conduit-1.3 deprecations.

* Fix tests

* Prepare for xml-conduit-1.5 series.

* Relax envelope parser.

* Unbreak the build with GHC 7.8.

* Sprinkle some CPP to prepare for next http-client.

+ Add monadic request and response processors.
* Deprecate pure processors.

! Add missing export for parser runner.

* Extract parser runner. `invokeWS` now is a mere default pipeline.

* Drop upper bounds entirely.

! Haddock breaks on LANGUAGE in example.

* Raise http-client upper boundary.

! Fix missing imports after conduit stopped reexporting in 1.1.

+ Add basic http transport initializer to exports.


* Switch to http-client transport.
Bring soap-tls or soap-openssl to use HTTPS connections.

* Cabal-only tweaks: remove -O2, add changelog.

+ Add timeout option to confTransport.

! Pin http-conduit version to 1.9.x.

* Throw SOAPParsingError instead of plain error.
* Update SOAPFault detection.

+ Add configurator-based transport initialization.

! Switch to a recent http-conduit version.

* Detect SOAPFault in response and throw a proper Exception.

+ Tag content helpers for stream parsers.
+ Dict helper for cursor parsers.
+ Document-based parser for "medium rare" cursor parsers.
+ Request and response tracing helpers.


* Switch to xml-conduit-writer for more clean serializers.
+ Pluggable transports.
+ Raw and streaming parsers.


Initial implementation, somewhat inflexible and warty,
but working with diverse services.
comments powered byDisqus