soap

package
v0.0.0-...-bf4a537 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAFunc                   = errors.New("must be a func")
	ErrWrongArgumentCount         = errors.New("must have exactly two arguments")
	ErrFirstArgumentWrongType     = errors.New("first argument must be a struct")
	ErrSecondArgumentWrongType    = errors.New("second argument must be *http.Request")
	ErrWrongReturnValueCount      = errors.New("must have exactly two return values")
	ErrFirstReturnValueWrongType  = errors.New("first return value must be a struct")
	ErrSecondReturnValueWrongType = errors.New("second return value must be error")
)

Functions

This section is empty.

Types

type Action

type Action interface {
	EmptyArguments() interface{}
	Handle(interface{}, *http.Request) (interface{}, error)
}

Action is a SOAP action

func ActionFunc

func ActionFunc(f interface{}) (a Action, err error)

ActionFunc converts a function into an Action. The function must conform to the func(A, *http.Request) (B, error) signature where A and B are struct types.

type Fault

type Fault struct {
	XMLName xml.Name `xml:"Fault"`
	Code    string   `xml:"faultcode"`
	Message string   `xml:"faultstring"`
	Actor   string   `xml:"faultactor,omitempty"`
	Detail  string   `xml:"detail,omitempty"`
}

Fault is used to send errors

func ConvertError

func ConvertError(code string, err error) *Fault

Error converts any error into a SOAP Fault

func Errorf

func Errorf(code, msg string, args ...interface{}) *Fault

Errorf creates a SOAP Fault from an error message

func (*Fault) Error

func (f *Fault) Error() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the action map and can serve SOAP through HTTP

func New

func New() *Server

New creates an empty SOAP Server

func (*Server) RegisterAction

func (s *Server) RegisterAction(name xml.Name, action Action) error

RegisterAction adds a Handler for a given action

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL