Lather.Server.DSL (lather v1.0.42)

View Source

Domain Specific Language for defining SOAP operations and types.

Provides convenient macros for defining SOAP service operations, parameter validation, and type definitions.

Summary

Functions

Configures Basic Authentication.

Configures custom authentication.

Sets the description for the current operation or type. Works in both soap_operation and soap_type blocks.

Defines an element within a complex type.

Defines input parameters for the current operation.

Defines output parameters for the current operation.

Defines a parameter within an input or output block.

Sets the SOAPAction for the current operation.

Defines authentication requirements for operations.

Defines a SOAP operation with metadata for WSDL generation.

Defines a complex type for use in operations.

Sets the description for the current type (deprecated, use description/1).

Configures WS-Security authentication.

Functions

basic_auth(opts \\ [])

(macro)

Configures Basic Authentication.

custom_auth(opts \\ [])

(macro)

Configures custom authentication.

description(text)

(macro)

Sets the description for the current operation or type. Works in both soap_operation and soap_type blocks.

element(name, type, opts \\ [])

(macro)

Defines an element within a complex type.

input(list)

(macro)

Defines input parameters for the current operation.

output(list)

(macro)

Defines output parameters for the current operation.

parameter(name, type, opts \\ [])

(macro)

Defines a parameter within an input or output block.

soap_action(action)

(macro)

Sets the SOAPAction for the current operation.

soap_auth(list)

(macro)

Defines authentication requirements for operations.

Example

soap_auth do
  basic_auth realm: "SOAP Service"
  # or
  ws_security required: true
  # or
  custom_auth handler: MyApp.CustomAuth
end

soap_operation(name, list)

(macro)

Defines a SOAP operation with metadata for WSDL generation.

Example

soap_operation "GetUser" do
  description "Retrieves a user by ID"

  input do
    parameter "userId", :string, required: true, description: "User identifier"
    parameter "includeDetails", :boolean, required: false, default: false
  end

  output do
    parameter "user", "User", description: "User information"
  end

  soap_action "http://example.com/GetUser"
end

def get_user(params) do
  # Implementation
end

soap_type(name, list)

(macro)

Defines a complex type for use in operations.

Example

soap_type "User" do
  description "User information"

  element "id", :string, required: true
  element "name", :string, required: true
  element "email", :string, required: false
  element "created_at", :dateTime, required: true
end

type_description(text)

(macro)

Sets the description for the current type (deprecated, use description/1).

ws_security(opts \\ [])

(macro)

Configures WS-Security authentication.