xml: aqwari.net/xml/wsdlgen Index | Files | Directories

package wsdlgen

import "aqwari.net/xml/wsdlgen"

Package wsdlgen generates Go source code from wsdl documents.

The wsdlgen package generates Go source for calling the various methods defined in a WSDL (Web Service Definition Language) document. The generated Go source is self-contained, with no dependencies on non-standard packages.

Code generation for the wsdlgen package can be configured by using the provided Option functions.

Index

Package Files

cli.go config.go helper.go wsdlgen.go

Variables

var DefaultOptions = []Option{
    PackageName("ws"),
    InputThreshold(3),
    OutputThreshold(2),
}

DefaultOptions are the default options for Go source code generation.

func GenCLI Uses

func GenCLI(args ...string) error

The GenCLI function generates Go source code using the default options chosen by the wsdlgen package. It is meant to be used from the main package of a command-line program.

type Config Uses

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

A Config contains parameters for the various code generation processes. Users may modify the output of the wsdlgen package's code generation by using a Config's Option method to change these parameters.

func (*Config) GenAST Uses

func (cfg *Config) GenAST(files ...string) (*ast.File, error)

GenAST creates a Go source file containing type and method declarations that can be used to access the service described in the provided set of wsdl files.

func (*Config) GenCLI Uses

func (cfg *Config) GenCLI(arguments ...string) error

GenCLI creates a file containing Go source generated from a WSDL definition. It is intended to be called from the main function of any command-line interfaces to the wsdlgen package.

func (*Config) GenSource Uses

func (cfg *Config) GenSource(files ...string) ([]byte, error)

The GenSource method converts the AST returned by GenAST to formatted Go source code.

func (*Config) Option Uses

func (cfg *Config) Option(opts ...Option) (previous Option)

Option applies the provides Options to a Config, modifying the code generation process. The return value of Option can be used to revert the effects of the final parameter.

func (*Config) XSDOption Uses

func (cfg *Config) XSDOption(opts ...xsdgen.Option) (previous xsdgen.Option)

XSDOption controls the generation of type declarations according to the xsdgen package.

type Logger Uses

type Logger interface {
    Printf(format string, v ...interface{})
}

Types conforming to the Logger interface can receive information about the code generation process.

type Option Uses

type Option func(*Config) Option

An Option modifies code generation parameters. The return value of an Option can be used to undo its effect.

func InputThreshold Uses

func InputThreshold(n int) Option

InputThreshold sets the maximum number of parameters a generated function may take. If a WSDL operation is defined as taking greater than n parameters, the generated function will take only one parameter; a struct, through which all arguments will be accessed.

func LogLevel Uses

func LogLevel(level int) Option

LogLevel sets the level of verbosity for log messages generated during the code generation process.

func LogOutput Uses

func LogOutput(dest Logger) Option

LogOutput sets the destination for log messages generated during code generation.

func OnlyPorts Uses

func OnlyPorts(ports ...string) Option

The OnlyPorts option defines a whitelist of WSDL ports to generate code for. Any other ports will not have types or methods present in the generated output.

func OutputThreshold Uses

func OutputThreshold(n int) Option

OutputThreshold sets the maximum number of values that a generated function may return. If a WSDL operation is defined as returning greater than n values, the generated function will return a wrapper struct instead. Note that the error value that all generated functions return is not counted against the threshold.

func PackageComment Uses

func PackageComment(comment string) Option

PackageComment specifies the first line of package-level Godoc comments. If the input WSDL file provides package-level comments, they are added after the provided comment, separated by a newline.

func PackageName Uses

func PackageName(name string) Option

PackageName specifies the name of the generated Go package.

Directories

PathSynopsis
examples
examples/chemspellPackage chemspell accesses the NLM ChemSpell web service.
examples/chemspell/_gen
examples/forecastPackage forecast access the National Digital Forecast Database.
examples/forecast/_gen

Package wsdlgen imports 14 packages (graph) and is imported by 6 packages. Updated 2019-01-15. Refresh now. Tools for package owners.