Function: soap-parse-envelope
soap-parse-envelope is a byte-compiled function defined in
soap-client.el.gz.
Signature
(soap-parse-envelope NODE OPERATION WSDL)
Documentation
Parse the SOAP envelope in NODE and return the response.
OPERATION is the WSDL operation for which we expect the response, WSDL is used to decode the NODE.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-parse-envelope (node operation wsdl)
"Parse the SOAP envelope in NODE and return the response.
OPERATION is the WSDL operation for which we expect the response,
WSDL is used to decode the NODE."
(soap-with-local-xmlns node
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'soap:Envelope)
nil
"expecting soap:Envelope node, got %s"
(soap-l2wk (xml-node-name node)))
(let ((headers (soap-xml-get-children1 node 'soap:Header))
(body (car (soap-xml-get-children1 node 'soap:Body))))
(let ((fault (car (soap-xml-get-children1 body 'soap:Fault))))
(when fault
(let ((fault-code (let ((n (car (xml-get-children
fault 'faultcode))))
(car-safe (xml-node-children n))))
(fault-string (let ((n (car (xml-get-children
fault 'faultstring))))
(car-safe (xml-node-children n))))
(detail (xml-get-children fault 'detail)))
(while t
(signal 'soap-error (list fault-code fault-string detail))))))
;; First (non string) element of the body is the root node of he
;; response
(let ((response (if (eq (soap-bound-operation-use operation) 'literal)
;; For 'literal uses, the response is the actual body
body
;; ...otherwise the first non string element
;; of the body is the response
(catch 'found
(dolist (n (xml-node-children body))
(when (consp n)
(throw 'found n)))))))
(soap-parse-response response operation wsdl headers body)))))