@@ -13,6 +13,7 @@ import (
13
13
"go/parser"
14
14
"go/token"
15
15
"io"
16
+ "log"
16
17
"net/http"
17
18
"net/url"
18
19
"os"
@@ -712,10 +713,14 @@ func (ge *goEncoder) writeSOAPFunc(w io.Writer, d *wsdl.Definitions, op *wsdl.Op
712
713
retDefaults [len (retDefaults )- 1 ] = "err"
713
714
714
715
// Check if we need to prefix the op with a namespace
716
+ mInput := ge .funcs [op .Name ].Input
715
717
namespacedOpName := op .Name
716
- nsSplit := strings .Split (ge .funcs [op .Name ].Input .Message , ":" )
717
- if len (nsSplit ) > 1 {
718
- namespacedOpName = nsSplit [0 ] + ":" + namespacedOpName
718
+
719
+ if mInput != nil {
720
+ nsSplit := strings .Split (mInput .Message , ":" )
721
+ if len (nsSplit ) > 1 {
722
+ namespacedOpName = nsSplit [0 ] + ":" + namespacedOpName
723
+ }
719
724
}
720
725
721
726
// The response name is always the operation name + "Response" according to specification.
@@ -1362,17 +1367,27 @@ func (ge *goEncoder) genGoStruct(w io.Writer, d *wsdl.Definitions, ct *wsdl.Comp
1362
1367
1363
1368
func (ge * goEncoder ) genGoOpStruct (w io.Writer , d * wsdl.Definitions , bo * wsdl.BindingOperation ) error {
1364
1369
name := goSymbol (bo .Name )
1370
+ function := ge .funcs [name ]
1365
1371
1366
- inputMessage := ge .messages [trimns (ge .funcs [bo .Name ].Input .Message )]
1372
+ if function .Input == nil {
1373
+ log .Printf ("function input is nil! %v is %v" , name , function )
1374
+ } else {
1375
+ message := trimns (function .Input .Message )
1376
+ inputMessage := ge .messages [message ]
1367
1377
1368
- // No-Op on operations which don't take arguments
1369
- // (These can be inlined, and don't need to pollute the file)
1370
- if len (inputMessage .Parts ) > 0 {
1371
- ge .genOpStructMessage (w , d , name , inputMessage )
1378
+ // No-Op on operations which don't take arguments
1379
+ // (These can be inlined, and don't need to pollute the file)
1380
+ if len (inputMessage .Parts ) > 0 {
1381
+ ge .genOpStructMessage (w , d , name , inputMessage )
1382
+ }
1372
1383
}
1373
1384
1374
- // Output messages are always required
1375
- ge .genOpStructMessage (w , d , name , ge .messages [trimns (ge .funcs [bo .Name ].Output .Message )])
1385
+ if function .Output == nil {
1386
+ log .Printf ("function output is nil! %v is %v" , name , function )
1387
+ } else {
1388
+ // Output messages are always required
1389
+ ge .genOpStructMessage (w , d , name , ge .messages [trimns (ge .funcs [bo .Name ].Output .Message )])
1390
+ }
1376
1391
1377
1392
return nil
1378
1393
}
0 commit comments