Skip to content

Commit 7cca288

Browse files
committed
Initial commit
0 parents  commit 7cca288

File tree

9 files changed

+32378
-0
lines changed

9 files changed

+32378
-0
lines changed

README.md

Whitespace-only changes.

cli.go

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package main
2+
3+
func main() {
4+
5+
}

cli_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package main

ec2.wsdl

+7,408
Large diffs are not rendered by default.

soap.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
"encoding/xml"
5+
)
6+
7+
type SoapEnvelope struct {
8+
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
9+
EncodingStyle string `xml:"http://schemas.xmlsoap.org/soap/envelope/ encodingStyle,attr"`
10+
Header SoapHeader `xml:"http://schemas.xmlsoap.org/soap/envelope/ Header"`
11+
Body SoapBody `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
12+
}
13+
14+
type SoapHeader struct {
15+
}
16+
17+
type SoapBody struct {
18+
Body interface{}
19+
}

vim.wsdl

+24,698
Large diffs are not rendered by default.

wsdl.go

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
package main
2+
3+
type Wsdl struct {
4+
Name string `xml:"name,attr"`
5+
TargetNamespace string `xml:"targetNamespace,attr"`
6+
Imports []*WsdlImport `xml:"http://schemas.xmlsoap.org/wsdl/ import"`
7+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
8+
Types WsdlType `xml:"http://schemas.xmlsoap.org/wsdl/ types"`
9+
Messages []*WsdlMessage `xml:"http://schemas.xmlsoap.org/wsdl/ message"`
10+
PortTypes []*WsdlPortType `xml:"http://schemas.xmlsoap.org/wsdl/ portType"`
11+
Binding []*WsdlBinding `xml:"http://schemas.xmlsoap.org/wsdl/ binding"`
12+
Service []*WsdlService `xml:"http://schemas.xmlsoap.org/wsdl/ service"`
13+
}
14+
15+
type WsdlImport struct {
16+
Namespace string `xml:"namespace,attr"`
17+
Location string `xml:"location,attr"`
18+
}
19+
20+
type WsdlType struct {
21+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
22+
Schema []*XsdSchema `xml:"http://www.w3.org/2001/XMLSchema schema"`
23+
}
24+
25+
type WsdlPart struct {
26+
Name string `xml:"name,attr"`
27+
Element string `xml:"element,attr"`
28+
Type string `xml:"type,attr"`
29+
}
30+
31+
type WsdlMessage struct {
32+
Name string `xml:"name,attr"`
33+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
34+
Parts []*WsdlPart `xml:"http://schemas.xmlsoap.org/wsdl/ part"`
35+
}
36+
37+
type WsdlFault struct {
38+
Name string `xml:"name,attr"`
39+
Message string `xml:"message,attr"`
40+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
41+
SoapFault WsdlSoapFault `xml:"http://schemas.xmlsoap.org/wsdl/soap/ fault"`
42+
}
43+
44+
type WsdlInput struct {
45+
Name string `xml:"name,attr"`
46+
Message string `xml:"message,attr"`
47+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
48+
SoapBody WsdlSoapBody `xml:"http://schemas.xmlsoap.org/wsdl/soap/ body"`
49+
SoapHeader []*WsdlSoapHeader `xml:"http://schemas.xmlsoap.org/wsdl/soap/ header"`
50+
//Mime MimeBinding
51+
}
52+
53+
type WsdlOutput struct {
54+
Name string `xml:"name,attr"`
55+
Message string `xml:"message,attr"`
56+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
57+
SoapBody WsdlSoapBody `xml:"http://schemas.xmlsoap.org/wsdl/soap/ body"`
58+
SoapHeader []*WsdlSoapHeader `xml:"http://schemas.xmlsoap.org/wsdl/soap/ header"`
59+
//Mime MimeBinding
60+
}
61+
62+
type WsdlOperation struct {
63+
Name string `xml:"name,attr"`
64+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
65+
Input WsdlInput `xml:"http://schemas.xmlsoap.org/wsdl/ input"`
66+
Output WsdlOutput `xml:"http://schemas.xmlsoap.org/wsdl/ output"`
67+
Faults []*WsdlFault `xml:"http://schemas.xmlsoap.org/wsdl/ fault"`
68+
SoapOperation WsdlSoapOperation `xml:"http://schemas.xmlsoap.org/wsdl/soap/ operation"`
69+
HttpOperation WsdlHttpOperation `xml:"http://schemas.xmlsoap.org/wsdl/http/ operation"`
70+
}
71+
72+
type WsdlPortType struct {
73+
Name string `xml:"name,attr"`
74+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
75+
Operations []*WsdlOperation `xml:"http://schemas.xmlsoap.org/wsdl/ operation"`
76+
}
77+
78+
type WsdlHttpBinding struct {
79+
Verb string `xml:"verb,attr"`
80+
}
81+
82+
type WsdlSoapBinding struct {
83+
Style string `xml:"style,attr"`
84+
Transport string `xml:"transport,attr"`
85+
}
86+
87+
type WsdlSoapOperation struct {
88+
SoapAction string `xml:"soapAction,attr"`
89+
Style string `xml:"style,attr"`
90+
}
91+
92+
type WsdlSoapHeader struct {
93+
Message string `xml:"message,attr"`
94+
Part string `xml:"part,attr"`
95+
Use string `xml:"use,attr"`
96+
EncodingStyle string `xml:"encodingStyle,attr"`
97+
Namespace string `xml:"namespace,attr"`
98+
HeadersFault []*WsdlSoapHeaderFault `xml:"http://schemas.xmlsoap.org/wsdl/soap/ headerfault"`
99+
}
100+
101+
type WsdlSoapHeaderFault struct {
102+
Message string `xml:"message,attr"`
103+
Part string `xml:"part,attr"`
104+
Use string `xml:"use,attr"`
105+
EncodingStyle string `xml:"encodingStyle,attr"`
106+
Namespace string `xml:"namespace,attr"`
107+
}
108+
109+
type WsdlSoapBody struct {
110+
Parts string `xml:"parts,attr"`
111+
Use string `xml:"use,attr"`
112+
EncodingStyle string `xml:"encodingStyle,attr"`
113+
Namespace string `xml:"namespace,attr"`
114+
}
115+
116+
type WsdlSoapFault struct {
117+
Parts string `xml:"parts,attr"`
118+
Use string `xml:"use,attr"`
119+
EncodingStyle string `xml:"encodingStyle,attr"`
120+
Namespace string `xml:"namespace,attr"`
121+
}
122+
123+
type WsdlSoapAddress struct {
124+
Location string `xml:"location,attr"`
125+
}
126+
127+
type WsdlHttpOperation struct {
128+
Location string `xml:"location,attr"`
129+
}
130+
131+
type WsdlBinding struct {
132+
Name string `xml:"name,attr"`
133+
Type string `xml:"type,attr"`
134+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
135+
HttpBinding WsdlHttpBinding `xml:"http://schemas.xmlsoap.org/wsdl/http/ binding"`
136+
SoapBinding WsdlSoapBinding `xml:"http://schemas.xmlsoap.org/wsdl/soap/ binding"`
137+
Operations []*WsdlOperation `xml:"http://schemas.xmlsoap.org/wsdl/ operation"`
138+
}
139+
140+
type WsdlPort struct {
141+
Name string `xml:"name,attr"`
142+
Binding string `xml:"binding,attr"`
143+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
144+
SoapAddress WsdlSoapAddress `xml:"http://schemas.xmlsoap.org/wsdl/soap/ address"`
145+
}
146+
147+
type WsdlService struct {
148+
Name string `xml:"name,attr"`
149+
Doc string `xml:"http://schemas.xmlsoap.org/wsdl/ documentation"`
150+
Ports []*WsdlPort `xml:"http://schemas.xmlsoap.org/wsdl/ port"`
151+
}

wsdl_test.go

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package main
2+
3+
import (
4+
"encoding/xml"
5+
"io/ioutil"
6+
"testing"
7+
)
8+
9+
func TestUnmarshal(t *testing.T) {
10+
data, err := ioutil.ReadFile("vim.wsdl")
11+
if err != nil {
12+
t.Errorf("incorrect result\ngot: %#v\nwant: %#v", err, nil)
13+
}
14+
15+
v := Wsdl{}
16+
err = xml.Unmarshal(data, &v)
17+
if err != nil {
18+
t.Errorf("incorrect result\ngot: %#v\nwant: %#v", err, nil)
19+
}
20+
21+
for _, pt := range v.PortTypes {
22+
t.Logf("PortType name: %s\n", pt.Name)
23+
for _, o := range pt.Operations {
24+
t.Logf("Operation: %s", o.Name)
25+
}
26+
t.Logf("Total ops: %d\n", len(pt.Operations))
27+
}
28+
29+
t.Logf("%#v\n", v.Types.Schema[0].Includes)
30+
}

xsd.go

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package main
2+
3+
// import (
4+
// "encoding/xml"
5+
// )
6+
7+
type XsdSchema struct {
8+
TargetNamespace string `xml:"targetNamespace,attr"`
9+
ElementFormDefault string `xml:"elementFormDefault,attr"`
10+
Includes []*XsdInclude `xml:"http://www.w3.org/2001/XMLSchema include"`
11+
Imports []*XsdImport `xml:"http://www.w3.org/2001/XMLSchema import"`
12+
Elements []*XsdElement `xml:"http://www.w3.org/2001/XMLSchema element"`
13+
ComplexTypes []*XsdComplexType `xml:"http://www.w3.org/2001/XMLSchema complexType"`
14+
}
15+
16+
type XsdInclude struct {
17+
SchemaLocation string `xml:"schemaLocation,attr"`
18+
}
19+
20+
type XsdImport struct {
21+
SchemaLocation string `xml:"schemaLocation,attr"`
22+
Namespace string `xml:"namespace,attr"`
23+
}
24+
25+
type XsdElement struct {
26+
Name string `xml:"name,attr"`
27+
Nillable bool `xml:"nillable,attr"`
28+
Type string `xml:"type,attr"`
29+
MinOccurs string `xml:"minOccurs,attr"`
30+
MaxOccurs string `xml:"maxOccurs,attr"`
31+
ComplexType *XsdComplexType `xml:"http://www.w3.org/2001/XMLSchema complexType"`
32+
SimpleType *XsdSimpleType `xml:"http://www.w3.org/2001/XMLSchema simpleType"`
33+
}
34+
35+
type XsdComplexType struct {
36+
Name string `xml:"name,attr"`
37+
Sequence *XsdSequence `xml:"http://www.w3.org/2001/XMLSchema sequence"`
38+
}
39+
40+
type XsdSimpleType struct {
41+
Name string `xml:"name,attr"`
42+
Sequence *XsdRestriction `xml:"http://www.w3.org/2001/XMLSchema restriction"`
43+
}
44+
45+
type XsdSequence struct {
46+
Elements []*XsdElement `xml:"http://www.w3.org/2001/XMLSchema element"`
47+
}
48+
49+
type XsdRestriction struct {
50+
Base string `xml:"base,attr"`
51+
Pattern *XsdPattern `xml:"http://www.w3.org/2001/XMLSchema pattern"`
52+
MinInclusive *XsdMinInclusive `xml:"http://www.w3.org/2001/XMLSchema minInclusive"`
53+
MaxInclusive *XsdMaxInclusive `xml:"http://www.w3.org/2001/XMLSchema maxInclusive"`
54+
}
55+
56+
type XsdPattern struct {
57+
Value string `xml:"value,attr"`
58+
}
59+
60+
type XsdMinInclusive struct {
61+
Value string `xml:"value,attr"`
62+
}
63+
64+
type XsdMaxInclusive struct {
65+
Value string `xml:"value,attr"`
66+
}

0 commit comments

Comments
 (0)