forked from hooklift/gowsdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsdl.go
164 lines (143 loc) · 6.21 KB
/
wsdl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package gowsdl
// WSDL represents the global structure of a WSDL file.
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"`
}
// WSDLImport is the struct used for deserializing WSDL imports.
type WSDLImport struct {
Namespace string `xml:"namespace,attr"`
Location string `xml:"location,attr"`
}
// WSDLType represents the entry point for deserializing XSD schemas used by the WSDL file.
type WSDLType struct {
Doc string `xml:"documentation"`
Schemas []*XSDSchema `xml:"schema"`
}
// WSDLPart defines the struct for a function parameter within a WSDL.
type WSDLPart struct {
Name string `xml:"name,attr"`
Element string `xml:"element,attr"`
Type string `xml:"type,attr"`
}
// WSDLMessage represents a function, which in turn has one or more parameters.
type WSDLMessage struct {
Name string `xml:"name,attr"`
Doc string `xml:"documentation"`
Parts []*WSDLPart `xml:"http://schemas.xmlsoap.org/wsdl/ part"`
}
// WSDLFault represents a WSDL fault message.
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"`
}
// WSDLInput represents a WSDL input message.
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"`
}
// WSDLOutput represents a WSDL output message.
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"`
}
// WSDLOperation represents the contract of an entire operation or function.
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"`
}
// 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 WSDLPortType struct {
Name string `xml:"name,attr"`
Doc string `xml:"documentation"`
Operations []*WSDLOperation `xml:"http://schemas.xmlsoap.org/wsdl/ operation"`
}
// WSDLSOAPBinding represents a SOAP binding to the web service.
type WSDLSOAPBinding struct {
Style string `xml:"style,attr"`
Transport string `xml:"transport,attr"`
}
// WSDLSOAPOperation represents a service operation in SOAP terms.
type WSDLSOAPOperation struct {
SOAPAction string `xml:"soapAction,attr"`
Style string `xml:"style,attr"`
}
// WSDLSOAPHeader defines the header for a SOAP service.
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"`
}
// WSDLSOAPHeaderFault defines a SOAP fault header.
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"`
}
// WSDLSOAPBody defines SOAP body characteristics.
type WSDLSOAPBody 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 WSDLSOAPFault struct {
Parts string `xml:"parts,attr"`
Use string `xml:"use,attr"`
EncodingStyle string `xml:"encodingStyle,attr"`
Namespace string `xml:"namespace,attr"`
}
// WSDLSOAPAddress defines the location for the SOAP service.
type WSDLSOAPAddress struct {
Location string `xml:"location,attr"`
}
// WSDLBinding defines only a SOAP binding and its operations
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"`
}
// WSDLPort defines the properties for a SOAP port only.
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"`
}
// WSDLService defines the list of SOAP services associated with the WSDL.
type WSDLService struct {
Name string `xml:"name,attr"`
Doc string `xml:"documentation"`
Ports []*WSDLPort `xml:"http://schemas.xmlsoap.org/wsdl/ port"`
}