Git Product home page Git Product logo

castile's Introduction

Castile

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 hex.pm 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!).

Installation

Install from Hex.pm:

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

Docs can be found at https://hexdocs.pm/castile.

Usage

# 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} = Castile.call(@model, :CountryISOCode, %{sCountryName: "Netherlands"})
# "NL"

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

TODO

  • 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

Thanks

  • detergent/yaws for the original SOAP implementation.
  • bet365/soap for some of the ideas/fixes (simplifying the WSDL XSDs, already_imported schema patch)

castile's People

Contributors

archseer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.