gosoap

package module
v0.0.0-...-0d1fa60 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 14 Imported by: 0

README

fork of https://github.com/tiaguinho/gosoap/ with breaking changes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPayloadFromError

func GetPayloadFromError(err error) []byte

GetPayloadFromError returns the payload of a ErrorWithPayload

func Named

func Named(element any, name string) named

Types

type ArrayParams

type ArrayParams [][2]any

type Client

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

Client struct hold all the information about WSDL, request and response of the server

func NewClient

func NewClient(wsdlSource WSDLSource, config *Config) (*Client, error)

NewClient return new *Client to handle the requests with the WSDL

func (*Client) Call

func (c *Client) Call(ctx context.Context, wsdlOperation string, body any, headerParams ...any) (res *Response, err error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *Request) (res *Response, err error)

Do Process Soap Request

type CommunicationLogger

type CommunicationLogger interface {
	LogRequest(operation string, header http.Header, body []byte)
	LogResponse(operation string, header http.Header, body []byte)
}

func NewSlogAdapter

func NewSlogAdapter(logger *slog.Logger, level slog.Level) CommunicationLogger

type Config

type Config struct {
	Client      *http.Client
	AutoAction  bool
	LogRequests bool
	Logger      CommunicationLogger

	Service string
	Port    string

	EnvelopePrefix string
	EnvelopeAttrs  map[string]string

	Username string
	Password string
}

Config config the Client

type ErrorWithPayload

type ErrorWithPayload struct {
	Payload []byte
	// contains filtered or unexported fields
}

ErrorWithPayload error payload schema

type Fault

type Fault struct {
	Code        string `xml:"faultcode"`
	Description string `xml:"faultstring"`
	Detail      string `xml:"detail"`
}

Fault see https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507

func (*Fault) String

func (f *Fault) String() string

type FaultError

type FaultError struct {
	Fault Fault
}

FaultError implements error interface

func (FaultError) Error

func (e FaultError) Error() string

func (FaultError) Is

func (e FaultError) Is(target error) bool

type NamedElement

type NamedElement interface {
	Name() xml.StartElement
	Value() any
}

type Params

type Params map[string]any

Params type is used to set the params in soap request

type Request

type Request struct {
	// wsdl operation name, this will be used to map to a SOAP action
	// https://www.w3.org/TR/2001/NOTE-wsdl-20010315#_soap:operation
	WSDLOperation string
	// see https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383503
	Body any
	// see https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383497
	HeaderEntries []any
}

A representation of a SOAP Request

func NewRequest

func NewRequest(wsdlOperation string, body any, headerBlocks ...any) *Request

type Response

Response Soap Response

func (*Response) Unmarshal

func (r *Response) Unmarshal(v any) error

func (*Response) UnmarshalHeader

func (r *Response) UnmarshalHeader(v any) error

type SliceParams

type SliceParams []any

type SoapBody

type SoapBody struct {
	XMLName  struct{} `xml:"Body"`
	Contents []byte   `xml:",innerxml"`
}

SoapBody struct

type SoapEnvelope

type SoapEnvelope struct {
	XMLName struct{} `xml:"Envelope"`
	Header  SoapHeader
	Body    SoapBody
}

SoapEnvelope struct

type SoapHeader

type SoapHeader struct {
	XMLName  struct{} `xml:"Header"`
	Contents []byte   `xml:",innerxml"`
}

SoapHeader struct

type WSDLSource

type WSDLSource func(config *Config) ([]byte, error)

func SourceFromBytes

func SourceFromBytes(raw []byte) WSDLSource

func SourceFromURI

func SourceFromURI(ctx context.Context, uri string) WSDLSource

Jump to

Keyboard shortcuts

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