Function: soap-wsdl-resolve-references

soap-wsdl-resolve-references is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-wsdl-resolve-references WSDL)

Documentation

Resolve all references inside the WSDL structure.

When the WSDL elements are created from the XML document, they refer to each other by name. For example, the ELEMENT-TYPE slot of an SOAP-ARRAY-TYPE will contain the name of the element and the user would have to call soap-wsdl-get to obtain the actual element.

After the entire document is loaded, we resolve all these references to the actual elements they refer to so that at runtime, we don't have to call soap-wsdl-get each time we traverse an element tree.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-wsdl-resolve-references (wsdl)
  "Resolve all references inside the WSDL structure.

When the WSDL elements are created from the XML document, they
refer to each other by name.  For example, the ELEMENT-TYPE slot
of an SOAP-ARRAY-TYPE will contain the name of the element and
the user would have to call `soap-wsdl-get' to obtain the actual
element.

After the entire document is loaded, we resolve all these
references to the actual elements they refer to so that at
runtime, we don't have to call `soap-wsdl-get' each time we
traverse an element tree."
  (let ((nprocessed 0)
        (nstag-id 0)
        (alias-table (soap-wsdl-alias-table wsdl)))
    (dolist (ns (soap-wsdl-namespaces wsdl))
      (let ((nstag (car-safe (rassoc (soap-namespace-name ns) alias-table))))
        (unless nstag
          ;; If this namespace does not have an alias, create one for it.
          (catch 'done
            (while t
              (setq nstag (format "ns%d" (incf nstag-id)))
              (unless (assoc nstag alias-table)
                (soap-wsdl-add-alias nstag (soap-namespace-name ns) wsdl)
                (throw 'done t)))))

        (maphash (lambda (_name element)
                   (cond ((soap-element-p element) ; skip links
                          (incf nprocessed)
                          (soap-resolve-references element wsdl))
                         ((listp element)
                          (dolist (e element)
                            (when (soap-element-p e)
                              (incf nprocessed)
                              (soap-resolve-references e wsdl))))))
                 (soap-namespace-elements ns)))))
  wsdl)