Function: soap-parse-response
soap-parse-response is a byte-compiled function defined in
soap-client.el.gz.
Signature
(soap-parse-response RESPONSE-NODE OPERATION WSDL SOAP-HEADERS SOAP-BODY)
Documentation
Parse RESPONSE-NODE and return the result as a LISP value.
OPERATION is the WSDL operation for which we expect the response, WSDL is used to decode the NODE.
SOAP-HEADERS is a list of the headers of the SOAP envelope or nil if there are no headers.
SOAP-BODY is the body of the SOAP envelope (of which RESPONSE-NODE is a sub-node). It is used in case RESPONSE-NODE reference multiRef parts which are external to RESPONSE-NODE.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-parse-response (response-node operation wsdl soap-headers soap-body)
"Parse RESPONSE-NODE and return the result as a LISP value.
OPERATION is the WSDL operation for which we expect the response,
WSDL is used to decode the NODE.
SOAP-HEADERS is a list of the headers of the SOAP envelope or nil
if there are no headers.
SOAP-BODY is the body of the SOAP envelope (of which
RESPONSE-NODE is a sub-node). It is used in case RESPONSE-NODE
reference multiRef parts which are external to RESPONSE-NODE."
(let* ((soap-current-wsdl wsdl)
(op (soap-bound-operation-operation operation))
(use (soap-bound-operation-use operation))
(message (cdr (soap-operation-output op))))
(soap-with-local-xmlns response-node
(when (eq use 'encoded)
(let* ((received-message-name (soap-l2fq (xml-node-name response-node)))
(received-message (soap-wsdl-get
received-message-name wsdl 'soap-message-p)))
(unless (eq received-message message)
(error "Unexpected message: got %s, expecting %s"
received-message-name
(soap-element-name message)))))
(let ((decoded-parts nil)
(soap-multi-refs (xml-get-children soap-body 'multiRef))
(soap-decoded-multi-refs nil))
(dolist (part (soap-message-parts message))
(let ((tag (car part))
(type (cdr part))
node)
(setq node
(cond
((eq use 'encoded)
(car (xml-get-children response-node tag)))
((eq use 'literal)
(catch 'found
(let* ((ns-aliases (soap-wsdl-alias-table wsdl))
(ns-name (cdr (assoc
(soap-element-namespace-tag type)
ns-aliases)))
(fqname (cons ns-name (soap-element-name type))))
(dolist (c (append (mapcar (lambda (header)
(car (xml-node-children
header)))
soap-headers)
(xml-node-children response-node)))
(when (consp c)
(soap-with-local-xmlns c
(when (equal (soap-l2fq (xml-node-name c))
fqname)
(throw 'found c))))))))))
(unless node
(error "Soap-parse-response(%s): cannot find message part %s"
(soap-element-name op) tag))
(let ((decoded-value (soap-decode-type type node)))
(when decoded-value
(push decoded-value decoded-parts)))))
decoded-parts))))