package module
Version: v0.2.1 Latest Latest

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

Go to latest
Published: Dec 22, 2015 License: MPL-2.0 Imports: 17 Imported by: 0


WSDL to Go

![Gitter](https://badges.gitter.im/Join Chat.svg) GoDoc Build Status

Generates Go code from a WSDL file.

  • Generate idiomatic Go code as much as possible
  • Support only Document/Literal wrapped services, which are WS-I compliant
  • Support:
    • WSDL 1.1
    • XML Schema 1.0
    • SOAP 1.1
  • Resolve external XML Schemas
  • Support external and local WSDL
  • Please keep in mind that the generated code is just a reflection of what the WSDL is like. If your WSDL has duplicated type definitions, your Go code is going to have the same and may not compile.
Usage: gowsdl [options] myservice.wsdl
  -o string
        File where the generated code will be saved (default "myservice.go")
  -p string
        Package under which code will be generated (default "myservice")
  -i    Skips TLS Verification
  -v    Shows gowsdl version




This section is empty.


This section is empty.


This section is empty.


type GoWSDL

type GoWSDL struct {
	// contains filtered or unexported fields

GoWSDL defines the struct for WSDL generator.

func NewGoWSDL

func NewGoWSDL(file, pkg string, ignoreTLS bool) (*GoWSDL, error)

NewGoWSDL initializes WSDL generator.

func (*GoWSDL) Start

func (g *GoWSDL) Start() (map[string][]byte, error)

Start initiaties the code generation process by starting two goroutines: one to generate types and another one to generate operations.

type WSDL

type WSDL struct {
	Name            string          `xml:"name,attr"`
	TargetNamespace string          `xml:"targetNamespace,attr"`
	Imports         []*WSDLImport   `xml:"import"`
	Doc             string          `xml:"documentation"`
	Types           WSDLType        `xml:"http://schemas.xmlsoap.org/wsdl/ types"`
	Messages        []*WSDLMessage  `xml:"http://schemas.xmlsoap.org/wsdl/ message"`
	PortTypes       []*WSDLPortType `xml:"http://schemas.xmlsoap.org/wsdl/ portType"`
	Binding         []*WSDLBinding  `xml:"http://schemas.xmlsoap.org/wsdl/ binding"`
	Service         []*WSDLService  `xml:"http://schemas.xmlsoap.org/wsdl/ service"`

WSDL represents the global structure of a WSDL file.

type WSDLBinding

type WSDLBinding struct {
	Name        string           `xml:"name,attr"`
	Type        string           `xml:"type,attr"`
	Doc         string           `xml:"documentation"`
	SOAPBinding WSDLSOAPBinding  `xml:"http://schemas.xmlsoap.org/wsdl/soap/ binding"`
	Operations  []*WSDLOperation `xml:"http://schemas.xmlsoap.org/wsdl/ operation"`

WSDLBinding defines only a SOAP binding and its operations

type WSDLFault

type WSDLFault struct {
	Name      string        `xml:"name,attr"`
	Message   string        `xml:"message,attr"`
	Doc       string        `xml:"documentation"`
	SOAPFault WSDLSOAPFault `xml:"http://schemas.xmlsoap.org/wsdl/soap/ fault"`

WSDLFault represents a WSDL fault message.

type WSDLImport

type WSDLImport struct {
	Namespace string `xml:"namespace,attr"`
	Location  string `xml:"location,attr"`

WSDLImport is the struct used for deserializing WSDL imports.

type WSDLInput

type WSDLInput struct {
	Name       string            `xml:"name,attr"`
	Message    string            `xml:"message,attr"`
	Doc        string            `xml:"documentation"`
	SOAPBody   WSDLSOAPBody      `xml:"http://schemas.xmlsoap.org/wsdl/soap/ body"`
	SOAPHeader []*WSDLSOAPHeader `xml:"http://schemas.xmlsoap.org/wsdl/soap/ header"`

WSDLInput represents a WSDL input message.

type WSDLMessage

type WSDLMessage struct {
	Name  string      `xml:"name,attr"`
	Doc   string      `xml:"documentation"`
	Parts []*WSDLPart `xml:"http://schemas.xmlsoap.org/wsdl/ part"`

WSDLMessage represents a function, which in turn has one or more parameters.

type WSDLOperation

type WSDLOperation struct {
	Name          string            `xml:"name,attr"`
	Doc           string            `xml:"documentation"`
	Input         WSDLInput         `xml:"input"`
	Output        WSDLOutput        `xml:"output"`
	Faults        []*WSDLFault      `xml:"fault"`
	SOAPOperation WSDLSOAPOperation `xml:"http://schemas.xmlsoap.org/wsdl/soap/ operation"`

WSDLOperation represents the contract of an entire operation or function.

type WSDLOutput

type WSDLOutput struct {
	Name       string            `xml:"name,attr"`
	Message    string            `xml:"message,attr"`
	Doc        string            `xml:"documentation"`
	SOAPBody   WSDLSOAPBody      `xml:"http://schemas.xmlsoap.org/wsdl/soap/ body"`
	SOAPHeader []*WSDLSOAPHeader `xml:"http://schemas.xmlsoap.org/wsdl/soap/ header"`

WSDLOutput represents a WSDL output message.

type WSDLPart

type WSDLPart struct {
	Name    string `xml:"name,attr"`
	Element string `xml:"element,attr"`
	Type    string `xml:"type,attr"`

WSDLPart defines the struct for a function parameter within a WSDL.

type WSDLPort

type WSDLPort struct {
	Name        string          `xml:"name,attr"`
	Binding     string          `xml:"binding,attr"`
	Doc         string          `xml:"documentation"`
	SOAPAddress WSDLSOAPAddress `xml:"http://schemas.xmlsoap.org/wsdl/soap/ address"`

WSDLPort defines the properties for a SOAP port only.

type WSDLPortType

type WSDLPortType struct {
	Name       string           `xml:"name,attr"`
	Doc        string           `xml:"documentation"`
	Operations []*WSDLOperation `xml:"http://schemas.xmlsoap.org/wsdl/ operation"`

WSDLPortType defines the service, operations that can be performed and the messages involved. A port type can be compared to a function library, module or class.

type WSDLSOAPAddress

type WSDLSOAPAddress struct {
	Location string `xml:"location,attr"`

WSDLSOAPAddress defines the location for the SOAP service.

type WSDLSOAPBinding

type WSDLSOAPBinding struct {
	Style     string `xml:"style,attr"`
	Transport string `xml:"transport,attr"`

WSDLSOAPBinding represents a SOAP binding to the web service.


type WSDLSOAPBody struct {
	Parts         string `xml:"parts,attr"`
	Use           string `xml:"use,attr"`
	EncodingStyle string `xml:"encodingStyle,attr"`
	Namespace     string `xml:"namespace,attr"`

WSDLSOAPBody defines SOAP body characteristics.

type WSDLSOAPFault

type WSDLSOAPFault struct {
	Parts         string `xml:"parts,attr"`
	Use           string `xml:"use,attr"`
	EncodingStyle string `xml:"encodingStyle,attr"`
	Namespace     string `xml:"namespace,attr"`

WSDLSOAPFault defines a SOAP fault message characteristics.

type WSDLSOAPHeader

type WSDLSOAPHeader struct {
	Message       string                 `xml:"message,attr"`
	Part          string                 `xml:"part,attr"`
	Use           string                 `xml:"use,attr"`
	EncodingStyle string                 `xml:"encodingStyle,attr"`
	Namespace     string                 `xml:"namespace,attr"`
	HeadersFault  []*WSDLSOAPHeaderFault `xml:"headerfault"`

WSDLSOAPHeader defines the header for a SOAP service.

type WSDLSOAPHeaderFault

type WSDLSOAPHeaderFault struct {
	Message       string `xml:"message,attr"`
	Part          string `xml:"part,attr"`
	Use           string `xml:"use,attr"`
	EncodingStyle string `xml:"encodingStyle,attr"`
	Namespace     string `xml:"namespace,attr"`

WSDLSOAPHeaderFault defines a SOAP fault header.

type WSDLSOAPOperation

type WSDLSOAPOperation struct {
	SOAPAction string `xml:"soapAction,attr"`
	Style      string `xml:"style,attr"`

WSDLSOAPOperation represents a service operation in SOAP terms.

type WSDLService

type WSDLService struct {
	Name  string      `xml:"name,attr"`
	Doc   string      `xml:"documentation"`
	Ports []*WSDLPort `xml:"http://schemas.xmlsoap.org/wsdl/ port"`

WSDLService defines the list of SOAP services associated with the WSDL.

type WSDLType

type WSDLType struct {
	Doc     string       `xml:"documentation"`
	Schemas []*XSDSchema `xml:"schema"`

WSDLType represents the entry point for deserializing XSD schemas used by the WSDL file.

type XSDAttribute

type XSDAttribute struct {
	Name       string         `xml:"name,attr"`
	Doc        string         `xml:"annotation>documentation"`
	Type       string         `xml:"type,attr"`
	SimpleType *XSDSimpleType `xml:"simpleType"`

XSDAttribute represent an element attribute. Simple elements cannot have attributes. If an element has attributes, it is considered to be of a complex type. But the attribute itself is always declared as a simple type.

type XSDComplexContent

type XSDComplexContent struct {
	XMLName   xml.Name     `xml:"complexContent"`
	Extension XSDExtension `xml:"extension"`

XSDComplexContent element defines extensions or restrictions on a complex type that contains mixed content or elements only.

type XSDComplexType

type XSDComplexType struct {
	XMLName        xml.Name          `xml:"complexType"`
	Abstract       bool              `xml:"abstract,attr"`
	Name           string            `xml:"name,attr"`
	Mixed          bool              `xml:"mixed,attr"`
	Sequence       []XSDElement      `xml:"sequence>element"`
	Choice         []XSDElement      `xml:"choice>element"`
	SequenceChoice []XSDElement      `xml:"sequence>choice>element"`
	All            []XSDElement      `xml:"all>element"`
	ComplexContent XSDComplexContent `xml:"complexContent"`
	SimpleContent  XSDSimpleContent  `xml:"simpleContent"`
	Attributes     []*XSDAttribute   `xml:"attribute"`

XSDComplexType represents a Schema complex type.

type XSDElement

type XSDElement struct {
	XMLName     xml.Name        `xml:"element"`
	Name        string          `xml:"name,attr"`
	Doc         string          `xml:"annotation>documentation"`
	Nillable    bool            `xml:"nillable,attr"`
	Type        string          `xml:"type,attr"`
	Ref         string          `xml:"ref,attr"`
	MinOccurs   string          `xml:"minOccurs,attr"`
	MaxOccurs   string          `xml:"maxOccurs,attr"`
	ComplexType *XSDComplexType `xml:"complexType"` //local
	SimpleType  *XSDSimpleType  `xml:"simpleType"`
	Groups      []*XSDGroup     `xml:"group"`

XSDElement represents a Schema element.

type XSDExtension

type XSDExtension struct {
	XMLName    xml.Name        `xml:"extension"`
	Base       string          `xml:"base,attr"`
	Attributes []*XSDAttribute `xml:"attribute"`
	Sequence   []XSDElement    `xml:"sequence>element"`

XSDExtension element extends an existing simpleType or complexType element.

type XSDGroup

type XSDGroup struct {
	Name     string       `xml:"name,attr"`
	Ref      string       `xml:"ref,attr"`
	Sequence []XSDElement `xml:"sequence>element"`
	Choice   []XSDElement `xml:"choice>element"`
	All      []XSDElement `xml:"all>element"`

XSDGroup element is used to define a group of elements to be used in complex type definitions.

type XSDImport

type XSDImport struct {
	XMLName        xml.Name `xml:"import"`
	SchemaLocation string   `xml:"schemaLocation,attr"`
	Namespace      string   `xml:"namespace,attr"`

XSDImport represents XSD imports within the main schema.

type XSDInclude

type XSDInclude struct {
	SchemaLocation string `xml:"schemaLocation,attr"`

XSDInclude represents schema includes.

type XSDRestriction

type XSDRestriction struct {
	Base         string                `xml:"base,attr"`
	Enumeration  []XSDRestrictionValue `xml:"enumeration"`
	Pattern      XSDRestrictionValue   `xml:"pattern"`
	MinInclusive XSDRestrictionValue   `xml:"minInclusive"`
	MaxInclusive XSDRestrictionValue   `xml:"maxInclusive"`
	WhiteSpace   XSDRestrictionValue   `xml:"whitespace"`
	Length       XSDRestrictionValue   `xml:"length"`
	MinLength    XSDRestrictionValue   `xml:"minLength"`
	MaxLength    XSDRestrictionValue   `xml:"maxLength"`

XSDRestriction defines restrictions on a simpleType, simpleContent, or complexContent definition.

type XSDRestrictionValue

type XSDRestrictionValue struct {
	Doc   string `xml:"annotation>documentation"`
	Value string `xml:"value,attr"`

XSDRestrictionValue represents a restriction value.

type XSDSchema

type XSDSchema struct {
	XMLName            xml.Name          `xml:"schema"`
	Tns                string            `xml:"xmlns tns,attr"`
	Xs                 string            `xml:"xmlns xs,attr"`
	Version            string            `xml:"version,attr"`
	TargetNamespace    string            `xml:"targetNamespace,attr"`
	ElementFormDefault string            `xml:"elementFormDefault,attr"`
	Includes           []*XSDInclude     `xml:"include"`
	Imports            []*XSDImport      `xml:"import"`
	Elements           []*XSDElement     `xml:"element"`
	ComplexTypes       []*XSDComplexType `xml:"complexType"` //global
	SimpleType         []*XSDSimpleType  `xml:"simpleType"`

XSDSchema represents an entire Schema structure.

type XSDSimpleContent

type XSDSimpleContent struct {
	XMLName   xml.Name     `xml:"simpleContent"`
	Extension XSDExtension `xml:"extension"`

XSDSimpleContent element contains extensions or restrictions on a text-only complex type or on a simple type as content and contains no elements.

type XSDSimpleType

type XSDSimpleType struct {
	Name        string         `xml:"name,attr"`
	Restriction XSDRestriction `xml:"restriction"`

XSDSimpleType element defines a simple type and specifies the constraints and information about the values of attributes or text-only elements.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL