Documentation
¶
Overview ¶
Package soap ... TO BE ADDED
Index ¶
- Constants
- Variables
- type Body
- type Body11
- type Body12
- type Client
- type Code
- type EnvBuilder
- func (bldr *EnvBuilder) Build(version string) (Envelope, error)
- func (bldr *EnvBuilder) BuildHTTPRequest(version string, action string) (*http.Request, error)
- func (bldr *EnvBuilder) Env() Envelope
- func (bldr *EnvBuilder) SetHeaders(hdrs ...interface{}) *EnvBuilder
- func (bldr *EnvBuilder) SetPayload(items ...interface{}) *EnvBuilder
- type EnvBuilderOption
- type Envelope
- type Envelope11
- type Envelope12
- type Fault
- type Fault11
- type Fault12
- type FaultDetail
- type FaultDetails2
- type Header
- type Option
- type Reason
- type Request
- type Response
- type Subcode
- type Text
Constants ¶
const ( V11 string = "1.1" V12 string = "1.2" )
Constants to represent the different SOAP versions.
Variables ¶
var ErrInvalidVersion = errors.New("version must be either 1.1 or 1.2")
ErrInvalidVersion is an error returned when the specified version is not one of the allowed versions.
Functions ¶
This section is empty.
Types ¶
type Body11 ¶
type Body11 struct { FaultElem *Fault11 `xml:"Fault,omitempty"` PayloadElem []byte `xml:",innerxml"` }
Body11 models the body element of the SOAP 1.1 Envelope.
type Body12 ¶
type Body12 struct { FaultElem *Fault12 `xml:"Fault,omitempty"` PayloadElem []byte `xml:",innerxml"` }
Body12 models the body element of the SOAP 1.2 Envelope.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a SOAP client that will be used to send requests and process responses.
type Code ¶
Code models the SOAP 1.2 code element. Specifications can be found at http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultcodeelement.
type EnvBuilder ¶
type EnvBuilder struct {
// contains filtered or unexported fields
}
EnvBuilder is a SOAP Envelope builder.
func (*EnvBuilder) Build ¶
func (bldr *EnvBuilder) Build(version string) (Envelope, error)
Build builds an Envelope for the specified SOAP version.
func (*EnvBuilder) BuildHTTPRequest ¶
BuildHTTPRequest builds a HTTP Request.
func (*EnvBuilder) Env ¶
func (bldr *EnvBuilder) Env() Envelope
Env will return the latest envelope built with this builder. If neither Build nor BuildHTTPRequest has been called successfully, nil will be returned.
func (*EnvBuilder) SetHeaders ¶
func (bldr *EnvBuilder) SetHeaders(hdrs ...interface{}) *EnvBuilder
SetHeaders sets the SOAP headers, overriding the previous ones.
func (*EnvBuilder) SetPayload ¶
func (bldr *EnvBuilder) SetPayload(items ...interface{}) *EnvBuilder
SetPayload sets the payload, overriding the previous one.
type EnvBuilderOption ¶
type EnvBuilderOption func(*EnvBuilder)
EnvBuilderOption represents a configuration function for an EnvBuilder. An Option will configure or set up internal details of an EnvBuilder.
func SetXmlns ¶
func SetXmlns(xmlns map[string]string) EnvBuilderOption
SetXmlns returns a configuration function to configure the namespace prefix of an EnvBuilderOption.
type Envelope ¶
type Envelope interface { Header() *Header Body() Body GetHTTPRequest(action string) (*http.Request, error) // contains filtered or unexported methods }
Envelope represents behaviors supported by a SOAP Envelope.
func DecodeEnvelope ¶
DecodeEnvelope decodes the specified io.Reader into an Envelope of the specified version.
func NewEnvelope ¶
func NewEnvelope(version string, header interface{}, payload interface{}, opts ...EnvBuilderOption) (Envelope, error)
NewEnvelope returns a new Envelope based on the parameters passed.
type Envelope11 ¶
type Envelope11 struct { XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"` Xmlns map[string]string HeaderElem *Header `xml:"Header,omitempty"` BodyElem Body11 `xml:"Body"` }
Envelope11 models an envelope following the SOAP 1.1 Envelope specs.
func (*Envelope11) Body ¶
func (e *Envelope11) Body() Body
Body implements the Body method of the Envelope interface.
func (*Envelope11) GetHTTPRequest ¶
func (e *Envelope11) GetHTTPRequest(action string) (*http.Request, error)
GetHTTPRequest TODO.
func (*Envelope11) Header ¶
func (e *Envelope11) Header() *Header
Header implements the Header method of the Envelope interface.
func (Envelope11) MarshalXML ¶
func (x Envelope11) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type Envelope12 ¶
type Envelope12 struct { XMLName xml.Name `xml:"http://www.w3.org/2003/05/soap-envelope Envelope"` Xmlns map[string]string HeaderElem *Header `xml:"Header,omitempty"` BodyElem Body12 `xml:"Body"` }
Envelope12 models an envelope following the SOAP 1.2 Envelope specs.
func (*Envelope12) Body ¶
func (e *Envelope12) Body() Body
Body implements the Body method of the Envelope interface.
func (*Envelope12) GetHTTPRequest ¶
func (e *Envelope12) GetHTTPRequest(action string) (*http.Request, error)
GetHTTPRequest TODO.
func (*Envelope12) Header ¶
func (e *Envelope12) Header() *Header
Header implements the Header method of the Envelope interface.
func (*Envelope12) MarshalXML ¶
func (e *Envelope12) MarshalXML(enc *xml.Encoder, start xml.StartElement) error
MarshalXML sets the SOAP 1.2 namespace and calls the generic envelope XML marshaller.
type Fault11 ¶
type Fault11 struct { XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault"` Code string `xml:"faultcode"` String string `xml:"faultstring"` Actor string `xml:"faultactor,omitempty"` Detail *FaultDetail `xml:"detail,omitempty"` }
Fault11 models a fault under SOAP 1.1.
func (*Fault11) Description ¶
Description implements the Description method of the Fault interface.
type Fault12 ¶
type Fault12 struct { XMLName xml.Name `xml:"http://www.w3.org/2003/05/soap-envelope Fault"` Code Code `xml:"Code"` Reason Reason `xml:"Reason"` Node string `xml:"Node,omitempty"` Role string `xml:"Role,omitempty"` Detail *FaultDetail `xml:"Detail,omitempty"` }
Fault12 models a fault under SOAP 1.2.
func (*Fault12) Description ¶
Description implements the Description method of the Fault interface.
type FaultDetail ¶
type FaultDetail struct {
Items []byte `xml:",innerxml"`
}
FaultDetail is a container for carrying application specific error information about errors occurred on the endpoint that we will be communicating with. The type of the errors is not known until the response is received, that is why the Items property is an slice of interface{}.
type FaultDetails2 ¶
type FaultDetails2 struct { Message string `xml:"message"` SOAPErrorCode string `xml:"soapErrorCode"` }
FaultDetails2 represents the content of Body.Fault.Details() field.
type Header ¶
type Header struct {
Content []byte `xml:",innerxml"`
}
Header models the header section of the SOAP Envelope.
type Option ¶
type Option func(*Client)
Option represents a configuration function for a SOAP client. An option will configure or set up internal details of a SOAP client.
func SetHTTPClient ¶
func SetHTTPClient(httpClient soap_http.ClientAdapter) Option
SetHTTPClient returns a configuration function to configure the HTTP Client that will be used to send the requests.
type Reason ¶
type Reason struct {
Items []Text `xml:"Text"`
}
Reason models the SOAP 1.2 reason element. The Reason element information item is intended to provide a human readable explanation of the fault. Specifications can be found at http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultstringelement.
type Response ¶
type Response struct { Env Envelope Request *Request ReceivedAt time.Time URL string // URL that sent the response. Endpoint string // An endpoint called by request. Method string // A HTTP method used to contact the endpoint. StatusCode int // HTTP status code received Payload string // used when there is an error to strinify the body response }
Response represents a SOAP response.
type Subcode ¶
Subcode models the SOAP 1.2 subcode element. Specifications can be found at http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultsubcodeelement.
type Text ¶
Text models the SOAP 1.2 text element. The Text element information item is intended to carry the text of a human readable explanation of the fault. Specifications can be found at http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#reasontextelement.