Documentation
¶
Index ¶
- Constants
- Variables
- func LogJSON(v interface{})
- type BasicAuth
- type Body
- type Client
- type Envelope
- type Fault
- type Header
- type OperationHandlerFunc
- type RequestFactoryFunc
- type Server
- func (s *Server) ListenAndServe(addr string) error
- func (s *Server) RegisterHandler(path string, action string, messageType string, ...)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) UseSoap11()
- func (s *Server) UseSoap12()
- func (s *Server) WriteHeader(w http.ResponseWriter, code int)
- type XMLMarshaller
Constants ¶
const ( SoapVersion11 = "1.1" SoapVersion12 = "1.2" SoapContentType11 = "text/xml; charset=\"utf-8\"" SoapContentType12 = "application/soap+xml; charset=\"utf-8\"" NamespaceSoap11 = "http://schemas.xmlsoap.org/soap/envelope/" NamespaceSoap12 = "http://www.w3.org/2003/05/soap-envelope" )
Variables ¶
var ClientDialTimeout = time.Duration(30 * time.Second)
ClientDialTimeout default timeout 30s
var UserAgent = "go-soap-0.1"
UserAgent is the default user agent
var Verbose = false
Verbose be verbose
Functions ¶
Types ¶
type Body ¶
type Body struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
Fault *Fault `xml:",omitempty"`
Content interface{} `xml:",omitempty"`
SOAPBodyContentType string `xml:"-"`
}
Body type
func (*Body) UnmarshalXML ¶
UnmarshalXML implement xml.Unmarshaler
type Client ¶
type Client struct {
Marshaller XMLMarshaller
ContentType string
SoapVersion string
// contains filtered or unexported fields
}
Client generic SOAP client
func NewClient ¶
NewClient constructor. SOAP 1.1 is used by default. Switch to SOAP 1.2 with UseSoap12()
func NewClientWithClient ¶
type Envelope ¶
type Envelope struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
Header Header
Body Body
}
Envelope type
type Fault ¶
type Fault struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"`
Code string `xml:"faultcode,omitempty"`
String string `xml:"faultstring,omitempty"`
Actor string `xml:"faultactor,omitempty"`
Detail string `xml:"detail,omitempty"`
}
Fault type
type Header ¶
type Header struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
Header interface{}
}
Header type
type OperationHandlerFunc ¶
type OperationHandlerFunc func(request interface{}, w http.ResponseWriter, httpRequest *http.Request) (response interface{}, err error)
OperationHandlerFunc runs the actual business logic - request is whatever you constructed in RequestFactoryFunc
type RequestFactoryFunc ¶
type RequestFactoryFunc func() interface{}
RequestFactoryFunc constructs a request object for OperationHandlerFunc
type Server ¶
type Server struct {
Marshaller XMLMarshaller
ContentType string
SoapVersion string
// contains filtered or unexported fields
}
Server a SOAP server, which can be run standalone or used as a http.HandlerFunc
func (*Server) ListenAndServe ¶
ListenAndServe run standalone
func (*Server) RegisterHandler ¶
func (s *Server) RegisterHandler(path string, action string, messageType string, requestFactory RequestFactoryFunc, operationHandlerFunc OperationHandlerFunc)
RegisterHandler register to handle an operation
func (*Server) WriteHeader ¶
func (s *Server) WriteHeader(w http.ResponseWriter, code int)
WriteHeader first sets header like content-type and then writes the header