soap

package
v0.0.0-...-0df88b9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package soap is a minimal SOAP RPC client.

Skeleton Request

A SOAP request, `encodingStyle` is required. For example,

<?xml version="1.0"?>
<soap:Envelope
  xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
  soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
  <soap:Header>
    ...
  </soap:Header>
  <soap:Body>
    ...
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Ewwow!</faultstring>
      <detail><UwuError>o noes!</UwuError></detail>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

A <faultcode> looks like:

  • VersionMismatch: Found an invalid namespace for the SOAP Envelope element.
  • MustUnderstand: An immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood.
  • Client: The message was incorrectly formed or contained incorrect information.
  • Server: There was a problem with the server so the message could not proceed.

All the elements above are declared in the default namespace for the SOAP envelope:

http://www.w3.org/2003/05/soap-envelope/

and the default namespace for SOAP encoding and data types is:

http://www.w3.org/2003/05/soap-encoding

Links

Index

Constants

View Source
const (
	FaultVersionMismatch = FaultCode("VersionMismatch")
	FaultMustUnderstand  = FaultCode("MustUnderstand")
	FaultClient          = FaultCode("Client")
	FaultServer          = FaultCode("Server")
)

Variables

This section is empty.

Functions

func Handle

func Handle(w http.ResponseWriter, r *http.Request, handler Interface)

Types

type Error

type Error interface {
	FaultCode() FaultCode
	FaultString() string
	Detail() string
}

Error is an error returned by the remote system. Non-application errors (e.g. connection failure) will be passed through as normal.

type FaultCode

type FaultCode string

FaultCode is a SOAP error <faultcode>

type Interface

type Interface interface {
	// Call performs SOAP RPCs under a given action namespace.
	// It consumes and returns an XML fragment as []byte.
	// The user is responsible for marshalling and unmarshalling these.
	Call(ctx context.Context, namespace, action string, input []byte) ([]byte, error)
}

Interface is the SOAP RPC interface.

func NewClient

func NewClient(baseURL *url.URL) Interface

Jump to

Keyboard shortcuts

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