Lather.Http.Transport (lather v1.0.42)
View SourceHTTP transport layer for SOAP requests.
Handles HTTP/HTTPS communication using Finch for connection pooling and efficient request handling.
Summary
Functions
Builds HTTP headers for SOAP requests.
Sends a POST request with the SOAP envelope to the specified endpoint.
Creates SSL options for secure SOAP connections.
Validates a URL for SOAP requests.
Functions
Builds HTTP headers for SOAP requests.
Parameters
options- Request options including SOAP version and action
Options
:soap_version- SOAP protocol version (:v1_1or:v1_2, default::v1_1):soap_action- SOAPAction header value or action to embed in Content-Type:headers- Additional custom headers:basic_auth- Basic authentication credentials
Sends a POST request with the SOAP envelope to the specified endpoint.
Parameters
url- The SOAP endpoint URLbody- The SOAP envelope XML as a stringoptions- Request options
Options
:timeout- Request timeout in milliseconds:headers- Additional headers to include:soap_action- SOAPAction header value:soap_version- SOAP protocol version (:v1_1or:v1_2, default::v1_1):ssl_options- SSL/TLS options for HTTPS connections:pool_timeout- Connection pool timeout in milliseconds:basic_auth- Basic authentication credentials{username, password}
Examples
# Example usage (would make actual HTTP request):
# Transport.post("https://example.com/soap", "<soap>...</soap>", [])
# {:ok, %{status: 200, body: "<response>...</response>"}}
# With Basic authentication:
# Transport.post(url, body, basic_auth: {"user", "pass"})
Creates SSL options for secure SOAP connections.
Parameters
options- SSL configuration options
Options
:verify- Verification mode (:verify_peer or :verify_none):cacerts- List of CA certificates:cert- Client certificate:key- Client private key:versions- Supported TLS versions
@spec validate_url(String.t()) :: :ok | {:error, :invalid_url}
Validates a URL for SOAP requests.
Examples
iex> Lather.Http.Transport.validate_url("https://example.com/soap")
:ok
iex> Lather.Http.Transport.validate_url("invalid-url")
{:error, :invalid_url}