soap- SOAP client tools

Safe HaskellNone




A feature-rich http-conduit based transport allowing to deal with HTTPS, authentication and other stuff using request and body processors.



initTransport :: EndpointURL -> RequestP -> BodyP -> IO TransportSource

Create a http-conduit transport. Use identity transformers if you don't need any special treatment.

initTransport_ :: EndpointURL -> IO TransportSource

Create a transport without any request and body processing.

confTransport :: Text -> Config -> IO TransportSource

Load common transport parameters from a configurator file.

 soap {
   url = "https://vendor.tld/service/"
   client_cert = "etc/client.pem"
   client_key = "etc/client.key"
   trace = true

Only url field is required.

 import Data.Configurator (load, Worth(Required))
 main = do
     transport <- confTransport "soap" =<< load [Required "etc/example.conf"]

type EndpointURL = StringSource

Web service URL. Configured at initialization, but you can tweak it dynamically with a request processor.

Making a request

type RequestP = Request (ResourceT IO) -> Request (ResourceT IO)Source

Update request record after defaults and method-specific fields are set.



:: FilePath

Path to a certificate.

-> FilePath

Path to a private key.

-> IO RequestP 

Load certificate, key and make a request processor setting them.

traceRequest :: RequestPSource

Show a debug dump of a request body.

Processing a response

type BodyP = ByteString -> ByteStringSource

Process response body to make it a nice UTF8-encoded XML document.

iconv :: EncodingName -> BodyPSource

Create an IConv-based processor.

traceBody :: BodyPSource

Show a debug dump of a response body.

Raw transport function

runQuery :: Manager -> EndpointURL -> RequestP -> BodyP -> TransportSource

Render document, submit it as a POST request and retrieve a body.