@hackage soap0.2.3.6
SOAP client tools
Installation
Dependencies (16)
- base >=4.8 && <5.0
- bytestring >=0.10.6 && <0.13
- 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 Show all…
Dependents (3)
@hackage/acme-everything, @hackage/soap-openssl, @hackage/soap-tls
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/