Lather.Server (lather v1.0.4)
View SourceSOAP Server implementation for Lather.
Provides a framework for building SOAP web services in Elixir with:
- Automatic WSDL generation from module definitions
- Request/response handling and validation
- Authentication and authorization support
- Phoenix/Plug integration
- Comprehensive error handling with SOAP faults
Usage
Define a SOAP service module:
defmodule MyApp.UserService do
use Lather.Server
@namespace "http://myapp.com/users"
@service_name "UserService"
@soap_operation %{
name: "GetUser",
input: [%{name: "userId", type: "string", required: true}],
output: [%{name: "user", type: "User"}]
}
def get_user(%{"userId" => user_id}) do
case fetch_user(user_id) do
{:ok, user} -> {:ok, %{"user" => user}}
{:error, :not_found} -> soap_fault("Client", "User not found")
end
end
defp fetch_user(id), do: {:ok, %{"id" => id, "name" => "John Doe"}}
endThen mount it in your Phoenix router or Plug application:
# In Phoenix router
scope "/soap" do
pipe_through :api
post "/users", Lather.Server.Plug, service: MyApp.UserService
end
# Or as a standalone Plug
plug Lather.Server.Plug, service: MyApp.UserService
Summary
Functions
Callback executed before module compilation to generate service metadata.
Macro for creating SOAP service modules.
Formats operation response according to SOAP conventions.
Creates a SOAP fault response.
Validates parameter types according to operation definition.
Validates that required operation parameters are present.
Functions
Callback executed before module compilation to generate service metadata.
Macro for creating SOAP service modules.
Formats operation response according to SOAP conventions.
Creates a SOAP fault response.
Validates parameter types according to operation definition.
Validates that required operation parameters are present.