trbngr/Lyex
{ "createdAt": "2019-01-03T07:53:34Z", "defaultBranch": "master", "description": "A modern SOAP client library for Elixir", "fullName": "trbngr/Lyex", "homepage": null, "language": "Elixir", "name": "Lyex", "pushedAt": "2019-06-28T04:23:30Z", "stargazersCount": 21, "topics": [], "updatedAt": "2021-10-28T13:48:15Z", "url": "https://github.com/trbngr/Lyex"}This project is not usable for most WSDLs. It probably won’t work for you. Please don’t use in production!
Section titled “This project is not usable for most WSDLs. It probably won’t work for you. Please don’t use in production!”I’ve tried all the SOAP libraries for Elixir without success.
So Lyex was born.
I had to learn a bit lot about WSDL. I’m pretty sure this won’t work on a bunch of WSDLs in the wild.
Much more to do.
Installation
Section titled “Installation”If available in Hex, the package can be installed
by adding lyex to your list of dependencies in mix.exs:
def deps do [ {:lyex, "~> 0.1.0"} ]endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/lyex.
use the Lyex.Client with configuration to generate a full SOAP client with functions and structs.
defmodule KeefeClient do use Lyex.Client, service_name: "Keefe", wsdl: "https://services.keefegp.com/VendorPayment/VendorPaymentSvc.svc?wsdl", cache_dir: "./priv"end
defmodule OtherModule do def run do
response = KeefeClient.lookup_recipient(%Keefe.LookupRecipientInput{ Auth: %{ VendorCode: "redacted", UserId: "redacted", Password: "redacted" }, RecipientNumber: "123456", FacilityCode: "ALDOC" })
%Keefe.LookupRecipientOutput{ DOBDay: "0", DOBMonth: "0", DOBYear: "0", FacilityName: nil, FirstName: nil, LastName: nil, MaxDepositAmount: "0", Result: %{Code: "INVALID_DEPOSITOR", Text: "Could not find resident"} } = response endendFeatures
Section titled “Features”- WSDL Parsing.
- Function generation for each operation.
- Input/output struct generation.
- parse responses into output structs.
- generate documentation for functions/structs.
- Input validation.
- adding soap headers to requests.
- supporting multiple ports.
Overview of code
Section titled “Overview of code”-
Resolve file and cache it
-
Parse the WSDL file via SAX. When we hit an import, start at step 1 and store it into state.imports. Merge all imports into the main WSDL
-
Assemble the WSDL by resolving all messages, bindings, etc.
-
Generate code