Lather.DynamicClient (lather v1.0.42)
View SourceDynamic SOAP client that can work with any SOAP service.
This client uses WSDL analysis to understand service operations and dynamically builds SOAP requests without requiring service-specific code.
Summary
Functions
Calls a SOAP operation dynamically.
Generates a report of the service capabilities.
Gets detailed information about a specific operation.
Gets service information including endpoints, namespaces, and types.
Lists all available operations for the service.
Creates a new dynamic client from a WSDL URL or file path.
Validates parameters for a specific operation without making the call.
Types
@type t() :: %Lather.DynamicClient{ base_client: Lather.Client.t(), default_options: keyword(), service_info: map() }
Functions
Calls a SOAP operation dynamically.
Parameters
client- The dynamic clientoperation_name- Name of the operation to callparameters- Map of parameters for the operationoptions- Additional call options
Options
:headers- Additional SOAP headers:timeout- Request timeout override:validate- Whether to validate parameters (default: true)
Examples
{:ok, response} = Lather.DynamicClient.call(
client,
"GetUser",
%{"userId" => "12345"}
)
{:ok, response} = Lather.DynamicClient.call(
client,
"CreateUser",
%{"userData" => %{"name" => "John", "email" => "john@example.com"}},
headers: [%{"Authentication" => "Bearer token123"}]
)
Generates a report of the service capabilities.
Examples
report = Lather.DynamicClient.generate_service_report(client)
IO.puts(report)
Gets detailed information about a specific operation.
Parameters
client- The dynamic clientoperation_name- Name of the operation to inspect
Examples
{:ok, operation_info} = Lather.DynamicClient.get_operation_info(client, "GetUser")
# %{
# name: "GetUser",
# required_parameters: ["userId"],
# optional_parameters: [],
# return_type: "User",
# soap_action: "http://example.com/GetUser"
# }
Gets service information including endpoints, namespaces, and types.
Examples
service_info = Lather.DynamicClient.get_service_info(client)
# %{
# service_name: "MyService",
# target_namespace: "http://example.com/service",
# endpoints: [...],
# operations: [...],
# types: [...]
# }
Lists all available operations for the service.
Examples
operations = Lather.DynamicClient.list_operations(client)
# [
# %{name: "GetUser", required_parameters: ["userId"], ...},
# %{name: "CreateUser", required_parameters: ["userData"], ...}
# ]
Creates a new dynamic client from a WSDL URL or file path.
Parameters
wsdl_source- URL or file path to the WSDLoptions- Client configuration options
Options
:service_name- Specific service name if WSDL contains multiple services:endpoint_override- Override the endpoint URL from WSDL:default_headers- Default headers to include in all requests:authentication- Authentication configuration:timeout- Default request timeout:soap_version- SOAP protocol version (:v1_1or:v1_2, auto-detected if not specified)
Examples
{:ok, client} = Lather.DynamicClient.new("http://example.com/service?wsdl")
{:ok, client} = Lather.DynamicClient.new(
"http://example.com/service?wsdl",
authentication: {:basic, "user", "pass"},
timeout: 60_000
)
Validates parameters for a specific operation without making the call.
Parameters
client- The dynamic clientoperation_name- Name of the operationparameters- Parameters to validate
Examples
:ok = Lather.DynamicClient.validate_parameters(client, "GetUser", %{"userId" => "123"})
{:error, {:missing_required_parameter, "userId"}} =
Lather.DynamicClient.validate_parameters(client, "GetUser", %{})