soapproxy

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 18 Imported by: 1

README

soapproxy

A simple SOAP <-> gRPC proxy.

1. Generate the WSDL

with ./protoc-gen-wsdl:

protoc --wsdl_out=myproxy -I $GOPATH/src $GOPATH/src/unosoft.hu/ws/bruno/pb/dealer/dealer.proto

will create myproxy/dealer.wsdl and myproxy/dealer.wsdl.go.

2. Generate the Client code

with github.com/UNO-SOFT/gprcer/protoc-gen-grpcer:

protoc --grpcer_out=myproxy -I $GOPATH/src $GOPATH/src/unosoft.hu/ws/bruno/pb/dealer/dealer.proto

will create myproxy/dealer.grpcer.go, with grpc.Client implementation in it.

3. Profit!

Then use the SOAPHandler in myproxy/main.go (see ./example/example.go):

cc, err := grpcer.Connect("grpc-host:port", "ca.pem", "localhost")
if err != nil {
	log.Fatal(err)
}
http.ListenAndServe(
	":8080",
	soapproxy.SOAPHandler{Client:NewClient(cc), WSDL:soapproxy.Ungzb64(WSDLgzb64)},
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterEmptyTags

func FilterEmptyTags(w io.Writer, r io.Reader) error

func FindBody

func FindBody(dec *xml.Decoder) (xml.StartElement, error)

FindBody will find the first StartElement after soap:Body.

func Ungzb64

func Ungzb64(s string) string

Ungzb64 decodes-decompresses the given gzipped-base64-encoded string. Esp. useful for reading the WSDLgzb64 from protoc-gen-wsdl embedded WSDL strings.

Types

type SOAPHandler

type SOAPHandler struct {
	grpcer.Client
	WSDL      string
	Log       func(keyvals ...interface{}) error
	Locations []string
	// contains filtered or unexported fields
}

SOAPHandler is a http.Handler which proxies SOAP requests to the Client. WSDL is served on GET requests.

func (*SOAPHandler) Input added in v0.2.4

func (h *SOAPHandler) Input(name string) interface{}

func (*SOAPHandler) ServeHTTP

func (h *SOAPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
mysrvc
Package mysrvc is a generated protocol buffer package.
Package mysrvc is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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