kiere / soap

Pure Elixir implementation of SOAP client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Soap

Build Status

Pure Elixir implementation of SOAP client

NOTE: Library is NOT production ready before 1.0 version

Installation

  1. Add soap to your deps:
def deps do
  [{:soap, "~> 0.2"}]
end
  1. Add soap to the list of application dependencies
def application do
  [applications: [:logger, :soap]]
end

Usage

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(body)

To add SOAP headers, pass in a {headers, params} tuple instead of just params.

%Soap.Response{} = Soap.call(wsdl, action, {%{Token: "foo"}, params})

About

Pure Elixir implementation of SOAP client

License:MIT License


Languages

Language:Elixir 100.0%