Pure Elixir implementation of SOAP client
- Add
soap
to your deps:
def deps do
[{:soap, "~> 0.1.1"}]
end
- Add
soap
to the list of application dependencies
def application do
[applications: [:logger, :soap]]
end
- Add configuration:
config :soap, :globals, version: "1.1"
config :soap, http_opts: [recv_timeout: 20_000, timeout: 20_000]
wsdl_path = "https://git.io/vNCWd"
action = "SendMessage"
params = %{recipient: "1", body: ""}
# Parse wsdl file for execution of action on its basis
{:ok, wsdl} = Soap.init_model(wsdl_path, :url)
# Call action
%Soap.Response{body: body, headers: headers, request_url: url, status_code: code} = Soap.call(wsdl, action, params)
# Parse body
Soap.Response.parse(body, code)