Skip to content

Commit 70bafec

Browse files
committed
Throw error when no actions
1 parent 5731da5 commit 70bafec

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

autoload/webapi/soap.vim

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,30 @@ endfunction
8686
function! webapi#soap#proxy(url)
8787
let dom = webapi#xml#parseURL(a:url)
8888
let l:api = {}
89-
let action = dom.childNode("service").find("soap:address").attr["location"]
90-
let operations = dom.childNode("portType").childNodes("operation")
89+
let ns = substitute(dom.name, ':\zs.*', '', '')
90+
let service = dom.childNode(ns."service")
91+
if empty(service)
92+
let action = ''
93+
else
94+
let address = dom.childNode(ns."service").find("soap:address")
95+
if empty(address)
96+
let action = ''
97+
else
98+
let action = dom.childNode(ns."service").find("soap:address").attr["location"]
99+
endif
100+
endif
101+
if action == ""
102+
return {}
103+
endif
104+
let operations = dom.childNode(ns."portType").childNodes(ns."operation")
91105
for operation in operations
92106
let name = operation.attr["name"]
93-
let inp = substitute(operation.childNode("input").attr["message"], "^tns:", "", "")
94-
let out = substitute(operation.childNode("output").attr["message"], "^tns:", "", "")
95-
let message = dom.childNode("message", {"name": inp})
107+
let inp = substitute(operation.childNode(ns."input").attr["message"], "^tns:", "", "")
108+
let out = substitute(operation.childNode(ns."output").attr["message"], "^tns:", "", "")
109+
let message = dom.childNode(ns."message", {"name": inp})
96110
let args = []
97-
for part in message.childNodes("part")
98-
call add(args, {"name": part.attr["name"], "type": part.attr["type"]})
111+
for part in message.childNodes(ns."part")
112+
call add(args, {"name": part.attr["name"], "type": has_key(part.attr, "type") ? part.attr["type"] : "xsd:string"})
99113
endfor
100114
let argnames = []
101115
let code = ""

0 commit comments

Comments
 (0)