Skip to content

Commit 16a7133

Browse files
author
Viktor Diditskiy
committed
Revert "Handle nil function input / output (fiorix#131)"
This reverts commit 5100b2d.
1 parent c197063 commit 16a7133

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

wsdlgo/encoder.go

+10-25
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"go/parser"
1414
"go/token"
1515
"io"
16-
"log"
1716
"net/http"
1817
"net/url"
1918
"os"
@@ -713,14 +712,10 @@ func (ge *goEncoder) writeSOAPFunc(w io.Writer, d *wsdl.Definitions, op *wsdl.Op
713712
retDefaults[len(retDefaults)-1] = "err"
714713

715714
// Check if we need to prefix the op with a namespace
716-
mInput := ge.funcs[op.Name].Input
717715
namespacedOpName := op.Name
718-
719-
if mInput != nil {
720-
nsSplit := strings.Split(mInput.Message, ":")
721-
if len(nsSplit) > 1 {
722-
namespacedOpName = nsSplit[0] + ":" + namespacedOpName
723-
}
716+
nsSplit := strings.Split(ge.funcs[op.Name].Input.Message, ":")
717+
if len(nsSplit) > 1 {
718+
namespacedOpName = nsSplit[0] + ":" + namespacedOpName
724719
}
725720

726721
// The response name is always the operation name + "Response" according to specification.
@@ -1367,27 +1362,17 @@ func (ge *goEncoder) genGoStruct(w io.Writer, d *wsdl.Definitions, ct *wsdl.Comp
13671362

13681363
func (ge *goEncoder) genGoOpStruct(w io.Writer, d *wsdl.Definitions, bo *wsdl.BindingOperation) error {
13691364
name := goSymbol(bo.Name)
1370-
function := ge.funcs[name]
13711365

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]
1366+
inputMessage := ge.messages[trimns(ge.funcs[bo.Name].Input.Message)]
13771367

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-
}
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)
13831372
}
13841373

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-
}
1374+
// Output messages are always required
1375+
ge.genOpStructMessage(w, d, name, ge.messages[trimns(ge.funcs[bo.Name].Output.Message)])
13911376

13921377
return nil
13931378
}

0 commit comments

Comments
 (0)