Safe Haskell | None |
---|
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 Transport
- initTransport_ :: EndpointURL -> IO Transport
- confTransport :: Text -> Config -> IO Transport
- type EndpointURL = String
- type RequestP = Request (ResourceT IO) -> Request (ResourceT IO)
- clientCert :: FilePath -> FilePath -> IO RequestP
- traceRequest :: RequestP
- type BodyP = ByteString -> ByteString
- iconv :: EncodingName -> BodyP
- traceBody :: BodyP
- runQuery :: Manager -> EndpointURL -> RequestP -> BodyP -> Transport
Initialization
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 timeout = 15 }
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.
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.