Skip to content
Castile is a modern Elixir SOAP API client.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Castile is a modern Elixir SOAP API client. It borrows ideas heavily from Detergent/yaws.

Why write another SOAP client? We really wanted to use Detergent/Detergentex, but ran into some issues (and also wanted to use HTTPoison as the HTTP client).

Detergent itself hasn't really been updated since 2013 (a time when erlang itself had no maps even), and Detergentex being just a lightweight wrapper around it, has the same shortcomings (even worse, the detergent version on that detergentex relies on has no support for HTTPS). Erlsom has also been updated in the mean time, improving XML write speed and adding support for binaries natively.

Castile is an attempt at a fresh start, with a small API that's easy to use in Elixir.

At the moment, the supported subset is SOAP 1.1 with WSDL 1.1 (and document/literal format). SOAP 1.2 and WSDL 2.0 are on the roadmap, but none of the APIs we interact with use either of those, so I'm having problems finding a public API to test against (if you find one, please open an issue!).


Install from

def deps do
    {:castile, "~> 1.0"}

Docs can be found at


# It's recommended to do init_model at compile time, as an @attr
@model = Castile.init_model("CountryInfoService.wsdl")

# we take maps as input and return binaries
{:ok, resp} =, :CountryISOCode, %{sCountryName: "Netherlands"})
# "NL"

# More complex results get cast into maps:
model = Castile.init_model("BLZService.wsdl")
{:ok, resp} =, :getBank, %{blz: "70070010"})
# resp => %{
#   bezeichnung: "Deutsche Bank",
#   bic: "DEUTDEMMXXX",
#   ort: "München",
#   plz: "80271"
# }


  • Faults (1.1)
  • HTTP client as adapter (specify module)
  • SOAP 1.2 support
  • RPC/encoding RPC/literal style (multiple bodies)
  • WSDL 2.0 support
  • Attachments/multipart


  • detergent/yaws for the original SOAP implementation.
  • bet365/soap for some of the ideas/fixes (simplifying the WSDL XSDs, already_imported schema patch)
You can’t perform that action at this time.