v0.0.0-...-d9421b2 Latest Latest

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 14 Imported by: 20



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.



This section is empty.


View Source
var DefaultOptions = []Option{

DefaultOptions are the default options for Go source code generation.


func GenCLI

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

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

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

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

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

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

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

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

type Logger

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

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

type Option

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

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

func LogLevel(level int) Option

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

func LogOutput

func LogOutput(dest Logger) Option

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

func OnlyPorts

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

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

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

func PackageName(name string) Option

PackageName specifies the name of the generated Go package.


Path Synopsis
Package chemspell accesses the NLM ChemSpell web service.
Package chemspell accesses the NLM ChemSpell web service.
Package forecast access the National Digital Forecast Database.
Package forecast access the National Digital Forecast Database.

Jump to

Keyboard shortcuts

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