Function: soap-parse-binding
soap-parse-binding is a byte-compiled function defined in
soap-client.el.gz.
Signature
(soap-parse-binding NODE)
Documentation
Parse NODE as a wsdl:binding and return the corresponding type.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-parse-binding (node)
"Parse NODE as a wsdl:binding and return the corresponding type."
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:binding)
nil
"expecting wsdl:binding node, got %s"
(soap-l2wk (xml-node-name node)))
(let ((name (xml-get-attribute node 'name))
(type (xml-get-attribute node 'type)))
(let ((binding (make-soap-binding :name name
:port-type (soap-l2fq type 'tns))))
(dolist (wo (soap-xml-get-children1 node 'wsdl:operation))
(let ((name (xml-get-attribute wo 'name))
soap-action
soap-headers
soap-body
use)
(dolist (so (soap-xml-get-children1 wo 'wsdlsoap:operation))
(setq soap-action (xml-get-attribute-or-nil so 'soapAction)))
;; Search a wsdlsoap:body node and find a "use" tag. The
;; same use tag is assumed to be present for both input and
;; output types (although the WDSL spec allows separate
;; "use"-s for each of them...
(dolist (i (soap-xml-get-children1 wo 'wsdl:input))
;; There can be multiple headers ...
(dolist (h (soap-xml-get-children1 i 'wsdlsoap:header))
(let ((message (soap-l2fq (xml-get-attribute-or-nil h 'message)))
(part (xml-get-attribute-or-nil h 'part))
(use (xml-get-attribute-or-nil h 'use)))
(when (and message part)
(push (list message part use) soap-headers))))
;; ... but only one body
(let ((body (car (soap-xml-get-children1 i 'wsdlsoap:body))))
(setq soap-body (xml-get-attribute-or-nil body 'parts))
(when soap-body
(setq soap-body
(mapcar #'intern (split-string soap-body
nil
'omit-nulls))))
(setq use (xml-get-attribute-or-nil body 'use))))
(unless use
(dolist (i (soap-xml-get-children1 wo 'wsdl:output))
(dolist (b (soap-xml-get-children1 i 'wsdlsoap:body))
(setq use (or use
(xml-get-attribute-or-nil b 'use))))))
(puthash name (make-soap-bound-operation
:operation name
:soap-action soap-action
:soap-headers (nreverse soap-headers)
:soap-body soap-body
:use (and use (intern use)))
(soap-binding-operations binding))))
binding)))