aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Harsanyi2017-05-24 14:18:39 -0400
committerThomas Fitzsimmons2017-05-25 08:49:57 -0400
commit349fbb35513f001a49623be8fe6704cda4ca48e2 (patch)
tree46e9e97353eb3b5e6dfd375780447552fa9d873b
parent1a9ce7c54e99d80fb515a33edbeeb75fd3239526 (diff)
downloademacs-349fbb35513f001a49623be8fe6704cda4ca48e2.tar.gz
emacs-349fbb35513f001a49623be8fe6704cda4ca48e2.zip
Remove cl dependency in soap-client.el and soap-inspect.el
* lisp/net/soap-inspect.el: Replace cl library with cl-lib, case with cl-case, destructuring-bind with cl-destructuring-bind and loop with cl-loop. * lisp/net/soap-client.el: Replace cl library with cl-lib, defstruct with cl-defstruct, assert with cl-assert, case with cl-case, ecase with cl-ecase, loop with cl-loop and destructuring-bind with cl-destructuring-bind. Co-authored-by: Stefan Monnier <monnier@iro.umontreal.ca>
-rw-r--r--lisp/net/soap-client.el311
-rw-r--r--lisp/net/soap-inspect.el93
2 files changed, 201 insertions, 203 deletions
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 5d36cfa89b8..922f6985761 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -43,7 +43,6 @@
43 43
44;;; Code: 44;;; Code:
45 45
46(eval-when-compile (require 'cl))
47(require 'cl-lib) 46(require 'cl-lib)
48 47
49(require 'xml) 48(require 'xml)
@@ -298,7 +297,7 @@ be tagged with a namespace tag."
298;; An element in an XML namespace, "things" stored in soap-xml-namespaces will 297;; An element in an XML namespace, "things" stored in soap-xml-namespaces will
299;; be derived from this object. 298;; be derived from this object.
300 299
301(defstruct soap-element 300(cl-defstruct soap-element
302 name 301 name
303 ;; The "well-known" namespace tag for the element. For example, while 302 ;; The "well-known" namespace tag for the element. For example, while
304 ;; parsing XML documents, we can have different tags for the XMLSchema 303 ;; parsing XML documents, we can have different tags for the XMLSchema
@@ -321,13 +320,13 @@ element name."
321;; a namespace link stores an alias for an object in once namespace to a 320;; a namespace link stores an alias for an object in once namespace to a
322;; "target" object possibly in a different namespace 321;; "target" object possibly in a different namespace
323 322
324(defstruct (soap-namespace-link (:include soap-element)) 323(cl-defstruct (soap-namespace-link (:include soap-element))
325 target) 324 target)
326 325
327;; A namespace is a collection of soap-element objects under a name (the name 326;; A namespace is a collection of soap-element objects under a name (the name
328;; of the namespace). 327;; of the namespace).
329 328
330(defstruct soap-namespace 329(cl-defstruct soap-namespace
331 (name nil :read-only t) ; e.g "http://xml.apache.org/xml-soap" 330 (name nil :read-only t) ; e.g "http://xml.apache.org/xml-soap"
332 (elements (make-hash-table :test 'equal) :read-only t)) 331 (elements (make-hash-table :test 'equal) :read-only t))
333 332
@@ -360,9 +359,9 @@ added to the namespace."
360 (setq name target)))))) 359 (setq name target))))))
361 360
362 ;; by now, name should be valid 361 ;; by now, name should be valid
363 (assert (and name (not (equal name ""))) 362 (cl-assert (and name (not (equal name "")))
364 nil 363 nil
365 "Cannot determine name for namespace link") 364 "Cannot determine name for namespace link")
366 (push (make-soap-namespace-link :name name :target target) 365 (push (make-soap-namespace-link :name name :target target)
367 (gethash name (soap-namespace-elements ns)))) 366 (gethash name (soap-namespace-elements ns))))
368 367
@@ -372,7 +371,7 @@ If multiple elements with the same name exist,
372DISCRIMINANT-PREDICATE is used to pick one of them. This allows 371DISCRIMINANT-PREDICATE is used to pick one of them. This allows
373storing elements of different types (like a message type and a 372storing elements of different types (like a message type and a
374binding) but the same name." 373binding) but the same name."
375 (assert (stringp name)) 374 (cl-assert (stringp name))
376 (let ((elements (gethash name (soap-namespace-elements ns)))) 375 (let ((elements (gethash name (soap-namespace-elements ns))))
377 (cond (discriminant-predicate 376 (cond (discriminant-predicate
378 (catch 'found 377 (catch 'found
@@ -394,14 +393,14 @@ binding) but the same name."
394;; message exchange. We include here an XML schema model with a parser and 393;; message exchange. We include here an XML schema model with a parser and
395;; serializer/deserializer. 394;; serializer/deserializer.
396 395
397(defstruct (soap-xs-type (:include soap-element)) 396(cl-defstruct (soap-xs-type (:include soap-element))
398 id 397 id
399 attributes 398 attributes
400 attribute-groups) 399 attribute-groups)
401 400
402;;;;; soap-xs-basic-type 401;;;;; soap-xs-basic-type
403 402
404(defstruct (soap-xs-basic-type (:include soap-xs-type)) 403(cl-defstruct (soap-xs-basic-type (:include soap-xs-type))
405 ;; Basic types are "built in" and we know how to handle them directly. 404 ;; Basic types are "built in" and we know how to handle them directly.
406 ;; Other type definitions reference basic types, so we need to create them 405 ;; Other type definitions reference basic types, so we need to create them
407 ;; in a namespace (see `soap-make-xs-basic-types') 406 ;; in a namespace (see `soap-make-xs-basic-types')
@@ -483,7 +482,7 @@ This is a specialization of `soap-encode-value' for
483 482
484 (when (or value (eq kind 'boolean)) 483 (when (or value (eq kind 'boolean))
485 (let ((value-string 484 (let ((value-string
486 (case kind 485 (cl-case kind
487 ((string anyURI QName ID IDREF language) 486 ((string anyURI QName ID IDREF language)
488 (unless (stringp value) 487 (unless (stringp value)
489 (error "Not a string value: %s" value)) 488 (error "Not a string value: %s" value))
@@ -495,7 +494,7 @@ This is a specialization of `soap-encode-value' for
495 ;; string format in UTC. 494 ;; string format in UTC.
496 (format-time-string 495 (format-time-string
497 (concat 496 (concat
498 (ecase kind 497 (cl-ecase kind
499 (dateTime "%Y-%m-%dT%H:%M:%S") 498 (dateTime "%Y-%m-%dT%H:%M:%S")
500 (time "%H:%M:%S") 499 (time "%H:%M:%S")
501 (date "%Y-%m-%d") 500 (date "%Y-%m-%d")
@@ -673,7 +672,7 @@ This is a specialization of `soap-decode-type' for
673 672
674 (if (null contents) 673 (if (null contents)
675 nil 674 nil
676 (ecase kind 675 (cl-ecase kind
677 ((string anyURI QName ID IDREF language) (car contents)) 676 ((string anyURI QName ID IDREF language) (car contents))
678 ((dateTime time date gYearMonth gYear gMonthDay gDay gMonth) 677 ((dateTime time date gYearMonth gYear gMonthDay gDay gMonth)
679 (car contents)) 678 (car contents))
@@ -694,7 +693,7 @@ This is a specialization of `soap-decode-type' for
694 693
695;;;;; soap-xs-element 694;;;;; soap-xs-element
696 695
697(defstruct (soap-xs-element (:include soap-element)) 696(cl-defstruct (soap-xs-element (:include soap-element))
698 ;; NOTE: we don't support exact number of occurrences via minOccurs, 697 ;; NOTE: we don't support exact number of occurrences via minOccurs,
699 ;; maxOccurs. Instead we support optional? and multiple? 698 ;; maxOccurs. Instead we support optional? and multiple?
700 699
@@ -738,8 +737,8 @@ contains a reference, retrieve the type of the reference."
738 (ref (xml-get-attribute-or-nil node 'ref)) 737 (ref (xml-get-attribute-or-nil node 'ref))
739 (substitution-group (xml-get-attribute-or-nil node 'substitutionGroup)) 738 (substitution-group (xml-get-attribute-or-nil node 'substitutionGroup))
740 (node-name (soap-l2wk (xml-node-name node)))) 739 (node-name (soap-l2wk (xml-node-name node))))
741 (assert (memq node-name '(xsd:element xsd:group)) 740 (cl-assert (memq node-name '(xsd:element xsd:group))
742 "expecting xsd:element or xsd:group, got %s" node-name) 741 "expecting xsd:element or xsd:group, got %s" node-name)
743 742
744 (when type 743 (when type
745 (setq type (soap-l2fq type 'tns))) 744 (setq type (soap-l2fq type 'tns)))
@@ -895,11 +894,11 @@ This is a specialization of `soap-encode-value' for
895 (soap-element-namespace-tag type))) 894 (soap-element-namespace-tag type)))
896 (setf (soap-xs-element-type^ new-element) 895 (setf (soap-xs-element-type^ new-element)
897 (soap-xs-complex-type-base type)) 896 (soap-xs-complex-type-base type))
898 (loop for i below (length value) 897 (cl-loop for i below (length value)
899 do (progn 898 do (progn
900 (soap-encode-xs-element (aref value i) new-element) 899 (soap-encode-xs-element (aref value i) new-element)
901 ))) 900 )))
902 (soap-encode-value value type)) 901 (soap-encode-value value type))
903 (insert "</" fq-name ">\n")) 902 (insert "</" fq-name ">\n"))
904 ;; else 903 ;; else
905 (insert "/>\n")))) 904 (insert "/>\n"))))
@@ -925,18 +924,18 @@ This is a specialization of `soap-decode-type' for
925 924
926;;;;; soap-xs-attribute 925;;;;; soap-xs-attribute
927 926
928(defstruct (soap-xs-attribute (:include soap-element)) 927(cl-defstruct (soap-xs-attribute (:include soap-element))
929 type ; a simple type or basic type 928 type ; a simple type or basic type
930 default ; the default value, if any 929 default ; the default value, if any
931 reference) 930 reference)
932 931
933(defstruct (soap-xs-attribute-group (:include soap-xs-type)) 932(cl-defstruct (soap-xs-attribute-group (:include soap-xs-type))
934 reference) 933 reference)
935 934
936(defun soap-xs-parse-attribute (node) 935(defun soap-xs-parse-attribute (node)
937 "Construct a `soap-xs-attribute' from NODE." 936 "Construct a `soap-xs-attribute' from NODE."
938 (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:attribute) 937 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:attribute)
939 "expecting xsd:attribute, got %s" (soap-l2wk (xml-node-name node))) 938 "expecting xsd:attribute, got %s" (soap-l2wk (xml-node-name node)))
940 (let* ((name (xml-get-attribute-or-nil node 'name)) 939 (let* ((name (xml-get-attribute-or-nil node 'name))
941 (type (soap-l2fq (xml-get-attribute-or-nil node 'type))) 940 (type (soap-l2fq (xml-get-attribute-or-nil node 'type)))
942 (default (xml-get-attribute-or-nil node 'fixed)) 941 (default (xml-get-attribute-or-nil node 'fixed))
@@ -952,8 +951,8 @@ This is a specialization of `soap-decode-type' for
952(defun soap-xs-parse-attribute-group (node) 951(defun soap-xs-parse-attribute-group (node)
953 "Construct a `soap-xs-attribute-group' from NODE." 952 "Construct a `soap-xs-attribute-group' from NODE."
954 (let ((node-name (soap-l2wk (xml-node-name node)))) 953 (let ((node-name (soap-l2wk (xml-node-name node))))
955 (assert (eq node-name 'xsd:attributeGroup) 954 (cl-assert (eq node-name 'xsd:attributeGroup)
956 "expecting xsd:attributeGroup, got %s" node-name) 955 "expecting xsd:attributeGroup, got %s" node-name)
957 (let ((name (xml-get-attribute-or-nil node 'name)) 956 (let ((name (xml-get-attribute-or-nil node 'name))
958 (id (xml-get-attribute-or-nil node 'id)) 957 (id (xml-get-attribute-or-nil node 'id))
959 (ref (xml-get-attribute-or-nil node 'ref)) 958 (ref (xml-get-attribute-or-nil node 'ref))
@@ -970,7 +969,7 @@ This is a specialization of `soap-decode-type' for
970 (unless (stringp child) 969 (unless (stringp child)
971 ;; Ignore optional annotation. 970 ;; Ignore optional annotation.
972 ;; Ignore anyAttribute nodes. 971 ;; Ignore anyAttribute nodes.
973 (case (soap-l2wk (xml-node-name child)) 972 (cl-case (soap-l2wk (xml-node-name child))
974 (xsd:attribute 973 (xsd:attribute
975 (push (soap-xs-parse-attribute child) 974 (push (soap-xs-parse-attribute child)
976 (soap-xs-type-attributes attribute-group))) 975 (soap-xs-type-attributes attribute-group)))
@@ -1043,7 +1042,7 @@ See also `soap-wsdl-resolve-references'."
1043 1042
1044;;;;; soap-xs-simple-type 1043;;;;; soap-xs-simple-type
1045 1044
1046(defstruct (soap-xs-simple-type (:include soap-xs-type)) 1045(cl-defstruct (soap-xs-simple-type (:include soap-xs-type))
1047 ;; A simple type is an extension on the basic type to which some 1046 ;; A simple type is an extension on the basic type to which some
1048 ;; restrictions can be added. For example we can define a simple type based 1047 ;; restrictions can be added. For example we can define a simple type based
1049 ;; off "string" with the restrictions that only the strings "one", "two" and 1048 ;; off "string" with the restrictions that only the strings "one", "two" and
@@ -1064,11 +1063,11 @@ See also `soap-wsdl-resolve-references'."
1064 1063
1065(defun soap-xs-parse-simple-type (node) 1064(defun soap-xs-parse-simple-type (node)
1066 "Construct an `soap-xs-simple-type' object from the XML NODE." 1065 "Construct an `soap-xs-simple-type' object from the XML NODE."
1067 (assert (memq (soap-l2wk (xml-node-name node)) 1066 (cl-assert (memq (soap-l2wk (xml-node-name node))
1068 '(xsd:simpleType xsd:simpleContent)) 1067 '(xsd:simpleType xsd:simpleContent))
1069 nil 1068 nil
1070 "expecting xsd:simpleType or xsd:simpleContent node, got %s" 1069 "expecting xsd:simpleType or xsd:simpleContent node, got %s"
1071 (soap-l2wk (xml-node-name node))) 1070 (soap-l2wk (xml-node-name node)))
1072 1071
1073 ;; NOTE: name can be nil for inline types. Such types cannot be added to a 1072 ;; NOTE: name can be nil for inline types. Such types cannot be added to a
1074 ;; namespace. 1073 ;; namespace.
@@ -1079,7 +1078,7 @@ See also `soap-wsdl-resolve-references'."
1079 :name name :namespace-tag soap-target-xmlns :id id)) 1078 :name name :namespace-tag soap-target-xmlns :id id))
1080 (def (soap-xml-node-find-matching-child 1079 (def (soap-xml-node-find-matching-child
1081 node '(xsd:restriction xsd:extension xsd:union xsd:list)))) 1080 node '(xsd:restriction xsd:extension xsd:union xsd:list))))
1082 (ecase (soap-l2wk (xml-node-name def)) 1081 (cl-ecase (soap-l2wk (xml-node-name def))
1083 (xsd:restriction (soap-xs-add-restriction def type)) 1082 (xsd:restriction (soap-xs-add-restriction def type))
1084 (xsd:extension (soap-xs-add-extension def type)) 1083 (xsd:extension (soap-xs-add-extension def type))
1085 (xsd:union (soap-xs-add-union def type)) 1084 (xsd:union (soap-xs-add-union def type))
@@ -1090,10 +1089,10 @@ See also `soap-wsdl-resolve-references'."
1090(defun soap-xs-add-restriction (node type) 1089(defun soap-xs-add-restriction (node type)
1091 "Add restrictions defined in XML NODE to TYPE, an `soap-xs-simple-type'." 1090 "Add restrictions defined in XML NODE to TYPE, an `soap-xs-simple-type'."
1092 1091
1093 (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:restriction) 1092 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:restriction)
1094 nil 1093 nil
1095 "expecting xsd:restriction node, got %s" 1094 "expecting xsd:restriction node, got %s"
1096 (soap-l2wk (xml-node-name node))) 1095 (soap-l2wk (xml-node-name node)))
1097 1096
1098 (setf (soap-xs-simple-type-base type) 1097 (setf (soap-xs-simple-type-base type)
1099 (soap-l2fq (xml-get-attribute node 'base))) 1098 (soap-l2fq (xml-get-attribute node 'base)))
@@ -1101,7 +1100,7 @@ See also `soap-wsdl-resolve-references'."
1101 (dolist (r (xml-node-children node)) 1100 (dolist (r (xml-node-children node))
1102 (unless (stringp r) ; skip the white space 1101 (unless (stringp r) ; skip the white space
1103 (let ((value (xml-get-attribute r 'value))) 1102 (let ((value (xml-get-attribute r 'value)))
1104 (case (soap-l2wk (xml-node-name r)) 1103 (cl-case (soap-l2wk (xml-node-name r))
1105 (xsd:enumeration 1104 (xsd:enumeration
1106 (push value (soap-xs-simple-type-enumeration type))) 1105 (push value (soap-xs-simple-type-enumeration type)))
1107 (xsd:pattern 1106 (xsd:pattern
@@ -1162,9 +1161,9 @@ See also `soap-wsdl-resolve-references'."
1162 1161
1163(defun soap-xs-add-union (node type) 1162(defun soap-xs-add-union (node type)
1164 "Add union members defined in XML NODE to TYPE, an `soap-xs-simple-type'." 1163 "Add union members defined in XML NODE to TYPE, an `soap-xs-simple-type'."
1165 (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:union) 1164 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:union)
1166 nil 1165 nil
1167 "expecting xsd:union node, got %s" (soap-l2wk (xml-node-name node))) 1166 "expecting xsd:union node, got %s" (soap-l2wk (xml-node-name node)))
1168 1167
1169 (setf (soap-xs-simple-type-base type) 1168 (setf (soap-xs-simple-type-base type)
1170 (mapcar 'soap-l2fq 1169 (mapcar 'soap-l2fq
@@ -1182,9 +1181,9 @@ See also `soap-wsdl-resolve-references'."
1182 1181
1183(defun soap-xs-add-list (node type) 1182(defun soap-xs-add-list (node type)
1184 "Add list defined in XML NODE to TYPE, a `soap-xs-simple-type'." 1183 "Add list defined in XML NODE to TYPE, a `soap-xs-simple-type'."
1185 (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:list) 1184 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:list)
1186 nil 1185 nil
1187 "expecting xsd:list node, got %s" (soap-l2wk (xml-node-name node))) 1186 "expecting xsd:list node, got %s" (soap-l2wk (xml-node-name node)))
1188 1187
1189 ;; A simple type can be defined inline inside the list node or referenced by 1188 ;; A simple type can be defined inline inside the list node or referenced by
1190 ;; the itemType attribute, in which case it will be resolved by the 1189 ;; the itemType attribute, in which case it will be resolved by the
@@ -1219,7 +1218,7 @@ See also `soap-wsdl-resolve-references'."
1219(defun soap-validate-xs-basic-type (value type) 1218(defun soap-validate-xs-basic-type (value type)
1220 "Validate VALUE against the basic type TYPE." 1219 "Validate VALUE against the basic type TYPE."
1221 (let* ((kind (soap-xs-basic-type-kind type))) 1220 (let* ((kind (soap-xs-basic-type-kind type)))
1222 (case kind 1221 (cl-case kind
1223 ((anyType Array byte[]) 1222 ((anyType Array byte[])
1224 value) 1223 value)
1225 (t 1224 (t
@@ -1384,7 +1383,7 @@ This is a specialization of `soap-decode-type' for
1384 1383
1385;;;;; soap-xs-complex-type 1384;;;;; soap-xs-complex-type
1386 1385
1387(defstruct (soap-xs-complex-type (:include soap-xs-type)) 1386(cl-defstruct (soap-xs-complex-type (:include soap-xs-type))
1388 indicator ; sequence, choice, all, array 1387 indicator ; sequence, choice, all, array
1389 base 1388 base
1390 elements 1389 elements
@@ -1400,12 +1399,12 @@ This is a specialization of `soap-decode-type' for
1400 type 1399 type
1401 attributes 1400 attributes
1402 attribute-groups) 1401 attribute-groups)
1403 (assert (memq node-name '(xsd:complexType xsd:complexContent xsd:group)) 1402 (cl-assert (memq node-name '(xsd:complexType xsd:complexContent xsd:group))
1404 nil "unexpected node: %s" node-name) 1403 nil "unexpected node: %s" node-name)
1405 1404
1406 (dolist (def (xml-node-children node)) 1405 (dolist (def (xml-node-children node))
1407 (when (consp def) ; skip text nodes 1406 (when (consp def) ; skip text nodes
1408 (case (soap-l2wk (xml-node-name def)) 1407 (cl-case (soap-l2wk (xml-node-name def))
1409 (xsd:attribute (push (soap-xs-parse-attribute def) attributes)) 1408 (xsd:attribute (push (soap-xs-parse-attribute def) attributes))
1410 (xsd:attributeGroup 1409 (xsd:attributeGroup
1411 (push (soap-xs-parse-attribute-group def) 1410 (push (soap-xs-parse-attribute-group def)
@@ -1416,7 +1415,7 @@ This is a specialization of `soap-decode-type' for
1416 (xsd:complexContent 1415 (xsd:complexContent
1417 (dolist (def (xml-node-children def)) 1416 (dolist (def (xml-node-children def))
1418 (when (consp def) 1417 (when (consp def)
1419 (case (soap-l2wk (xml-node-name def)) 1418 (cl-case (soap-l2wk (xml-node-name def))
1420 (xsd:attribute 1419 (xsd:attribute
1421 (push (soap-xs-parse-attribute def) attributes)) 1420 (push (soap-xs-parse-attribute def) attributes))
1422 (xsd:attributeGroup 1421 (xsd:attributeGroup
@@ -1447,15 +1446,15 @@ This is a specialization of `soap-decode-type' for
1447(defun soap-xs-parse-sequence (node) 1446(defun soap-xs-parse-sequence (node)
1448 "Parse a sequence definition from XML NODE. 1447 "Parse a sequence definition from XML NODE.
1449Returns a `soap-xs-complex-type'" 1448Returns a `soap-xs-complex-type'"
1450 (assert (memq (soap-l2wk (xml-node-name node)) 1449 (cl-assert (memq (soap-l2wk (xml-node-name node))
1451 '(xsd:sequence xsd:choice xsd:all)) 1450 '(xsd:sequence xsd:choice xsd:all))
1452 nil 1451 nil
1453 "unexpected node: %s" (soap-l2wk (xml-node-name node))) 1452 "unexpected node: %s" (soap-l2wk (xml-node-name node)))
1454 1453
1455 (let ((type (make-soap-xs-complex-type))) 1454 (let ((type (make-soap-xs-complex-type)))
1456 1455
1457 (setf (soap-xs-complex-type-indicator type) 1456 (setf (soap-xs-complex-type-indicator type)
1458 (ecase (soap-l2wk (xml-node-name node)) 1457 (cl-ecase (soap-l2wk (xml-node-name node))
1459 (xsd:sequence 'sequence) 1458 (xsd:sequence 'sequence)
1460 (xsd:all 'all) 1459 (xsd:all 'all)
1461 (xsd:choice 'choice))) 1460 (xsd:choice 'choice)))
@@ -1465,7 +1464,7 @@ Returns a `soap-xs-complex-type'"
1465 1464
1466 (dolist (r (xml-node-children node)) 1465 (dolist (r (xml-node-children node))
1467 (unless (stringp r) ; skip the white space 1466 (unless (stringp r) ; skip the white space
1468 (case (soap-l2wk (xml-node-name r)) 1467 (cl-case (soap-l2wk (xml-node-name r))
1469 ((xsd:element xsd:group) 1468 ((xsd:element xsd:group)
1470 (push (soap-xs-parse-element r) 1469 (push (soap-xs-parse-element r)
1471 (soap-xs-complex-type-elements type))) 1470 (soap-xs-complex-type-elements type)))
@@ -1489,10 +1488,10 @@ Returns a `soap-xs-complex-type'"
1489(defun soap-xs-parse-extension-or-restriction (node) 1488(defun soap-xs-parse-extension-or-restriction (node)
1490 "Parse an extension or restriction definition from XML NODE. 1489 "Parse an extension or restriction definition from XML NODE.
1491Return a `soap-xs-complex-type'." 1490Return a `soap-xs-complex-type'."
1492 (assert (memq (soap-l2wk (xml-node-name node)) 1491 (cl-assert (memq (soap-l2wk (xml-node-name node))
1493 '(xsd:extension xsd:restriction)) 1492 '(xsd:extension xsd:restriction))
1494 nil 1493 nil
1495 "unexpected node: %s" (soap-l2wk (xml-node-name node))) 1494 "unexpected node: %s" (soap-l2wk (xml-node-name node)))
1496 (let (type 1495 (let (type
1497 attributes 1496 attributes
1498 attribute-groups 1497 attribute-groups
@@ -1507,7 +1506,7 @@ Return a `soap-xs-complex-type'."
1507 1506
1508 (dolist (def (xml-node-children node)) 1507 (dolist (def (xml-node-children node))
1509 (when (consp def) ; skip text nodes 1508 (when (consp def) ; skip text nodes
1510 (case (soap-l2wk (xml-node-name def)) 1509 (cl-case (soap-l2wk (xml-node-name def))
1511 ((xsd:sequence xsd:choice xsd:all) 1510 ((xsd:sequence xsd:choice xsd:all)
1512 (setq type (soap-xs-parse-sequence def))) 1511 (setq type (soap-xs-parse-sequence def)))
1513 (xsd:attribute 1512 (xsd:attribute
@@ -1628,7 +1627,7 @@ position.
1628 1627
1629This is a specialization of `soap-encode-value' for 1628This is a specialization of `soap-encode-value' for
1630`soap-xs-complex-type' objects." 1629`soap-xs-complex-type' objects."
1631 (case (soap-xs-complex-type-indicator type) 1630 (cl-case (soap-xs-complex-type-indicator type)
1632 (array 1631 (array
1633 (error "Arrays of type soap-encode-xs-complex-type are handled elsewhere")) 1632 (error "Arrays of type soap-encode-xs-complex-type are handled elsewhere"))
1634 ((sequence choice all nil) 1633 ((sequence choice all nil)
@@ -1650,7 +1649,7 @@ This is a specialization of `soap-encode-value' for
1650 (let ((e-name (intern e-name))) 1649 (let ((e-name (intern e-name)))
1651 (dolist (v value) 1650 (dolist (v value)
1652 (when (equal (car v) e-name) 1651 (when (equal (car v) e-name)
1653 (incf instance-count) 1652 (cl-incf instance-count)
1654 (soap-encode-value (cdr v) candidate)))) 1653 (soap-encode-value (cdr v) candidate))))
1655 (if (soap-xs-complex-type-indicator type) 1654 (if (soap-xs-complex-type-indicator type)
1656 (let ((current-point (point))) 1655 (let ((current-point (point)))
@@ -1658,12 +1657,12 @@ This is a specialization of `soap-encode-value' for
1658 ;; characters were inserted in the buffer. 1657 ;; characters were inserted in the buffer.
1659 (soap-encode-value value candidate) 1658 (soap-encode-value value candidate)
1660 (when (not (equal current-point (point))) 1659 (when (not (equal current-point (point)))
1661 (incf instance-count))) 1660 (cl-incf instance-count)))
1662 (dolist (v value) 1661 (dolist (v value)
1663 (let ((current-point (point))) 1662 (let ((current-point (point)))
1664 (soap-encode-value v candidate) 1663 (soap-encode-value v candidate)
1665 (when (not (equal current-point (point))) 1664 (when (not (equal current-point (point)))
1666 (incf instance-count)))))))) 1665 (cl-incf instance-count))))))))
1667 ;; Do some sanity checking 1666 ;; Do some sanity checking
1668 (let* ((indicator (soap-xs-complex-type-indicator type)) 1667 (let* ((indicator (soap-xs-complex-type-indicator type))
1669 (element-type (soap-xs-element-type element)) 1668 (element-type (soap-xs-element-type element))
@@ -1801,7 +1800,7 @@ type-info stored in TYPE.
1801 1800
1802This is a specialization of `soap-decode-type' for 1801This is a specialization of `soap-decode-type' for
1803`soap-xs-basic-type' objects." 1802`soap-xs-basic-type' objects."
1804 (case (soap-xs-complex-type-indicator type) 1803 (cl-case (soap-xs-complex-type-indicator type)
1805 (array 1804 (array
1806 (let ((result nil) 1805 (let ((result nil)
1807 (element-type (soap-xs-complex-type-base type))) 1806 (element-type (soap-xs-complex-type-base type)))
@@ -1878,7 +1877,7 @@ This is a specialization of `soap-decode-type' for
1878 (list node))) 1877 (list node)))
1879 (element-type (soap-xs-element-type element))) 1878 (element-type (soap-xs-element-type element)))
1880 (dolist (node children) 1879 (dolist (node children)
1881 (incf instance-count) 1880 (cl-incf instance-count)
1882 (let* ((attributes 1881 (let* ((attributes
1883 (soap-decode-xs-attributes element-type node)) 1882 (soap-decode-xs-attributes element-type node))
1884 ;; Attributes may specify xsi:type override. 1883 ;; Attributes may specify xsi:type override.
@@ -1939,11 +1938,11 @@ This is a specialization of `soap-decode-type' for
1939;;;;; WSDL document elements 1938;;;;; WSDL document elements
1940 1939
1941 1940
1942(defstruct (soap-message (:include soap-element)) 1941(cl-defstruct (soap-message (:include soap-element))
1943 parts ; ALIST of NAME => WSDL-TYPE name 1942 parts ; ALIST of NAME => WSDL-TYPE name
1944 ) 1943 )
1945 1944
1946(defstruct (soap-operation (:include soap-element)) 1945(cl-defstruct (soap-operation (:include soap-element))
1947 parameter-order 1946 parameter-order
1948 input ; (NAME . MESSAGE) 1947 input ; (NAME . MESSAGE)
1949 output ; (NAME . MESSAGE) 1948 output ; (NAME . MESSAGE)
@@ -1951,13 +1950,13 @@ This is a specialization of `soap-decode-type' for
1951 input-action ; WS-addressing action string 1950 input-action ; WS-addressing action string
1952 output-action) ; WS-addressing action string 1951 output-action) ; WS-addressing action string
1953 1952
1954(defstruct (soap-port-type (:include soap-element)) 1953(cl-defstruct (soap-port-type (:include soap-element))
1955 operations) ; a namespace of operations 1954 operations) ; a namespace of operations
1956 1955
1957;; A bound operation is an operation which has a soap action and a use 1956;; A bound operation is an operation which has a soap action and a use
1958;; method attached -- these are attached as part of a binding and we 1957;; method attached -- these are attached as part of a binding and we
1959;; can have different bindings for the same operations. 1958;; can have different bindings for the same operations.
1960(defstruct soap-bound-operation 1959(cl-defstruct soap-bound-operation
1961 operation ; SOAP-OPERATION 1960 operation ; SOAP-OPERATION
1962 soap-action ; value for SOAPAction HTTP header 1961 soap-action ; value for SOAPAction HTTP header
1963 soap-headers ; list of (message part use) 1962 soap-headers ; list of (message part use)
@@ -1966,11 +1965,11 @@ This is a specialization of `soap-decode-type' for
1966 ; http://www.w3.org/TR/wsdl#_soap:body 1965 ; http://www.w3.org/TR/wsdl#_soap:body
1967 ) 1966 )
1968 1967
1969(defstruct (soap-binding (:include soap-element)) 1968(cl-defstruct (soap-binding (:include soap-element))
1970 port-type 1969 port-type
1971 (operations (make-hash-table :test 'equal) :readonly t)) 1970 (operations (make-hash-table :test 'equal) :readonly t))
1972 1971
1973(defstruct (soap-port (:include soap-element)) 1972(cl-defstruct (soap-port (:include soap-element))
1974 service-url 1973 service-url
1975 binding) 1974 binding)
1976 1975
@@ -1978,10 +1977,10 @@ This is a specialization of `soap-decode-type' for
1978;;;;; The WSDL document 1977;;;;; The WSDL document
1979 1978
1980;; The WSDL data structure used for encoding/decoding SOAP messages 1979;; The WSDL data structure used for encoding/decoding SOAP messages
1981(defstruct (soap-wsdl 1980(cl-defstruct (soap-wsdl
1982 ;; NOTE: don't call this constructor, see `soap-make-wsdl' 1981 ;; NOTE: don't call this constructor, see `soap-make-wsdl'
1983 (:constructor soap-make-wsdl^) 1982 (:constructor soap-make-wsdl^)
1984 (:copier soap-copy-wsdl)) 1983 (:copier soap-copy-wsdl))
1985 origin ; file or URL from which this wsdl was loaded 1984 origin ; file or URL from which this wsdl was loaded
1986 current-file ; most-recently fetched file or URL 1985 current-file ; most-recently fetched file or URL
1987 xmlschema-imports ; a list of schema imports 1986 xmlschema-imports ; a list of schema imports
@@ -2107,16 +2106,16 @@ used to resolve the namespace alias."
2107 "Parse a schema NODE, placing the results in WSDL. 2106 "Parse a schema NODE, placing the results in WSDL.
2108Return a SOAP-NAMESPACE containing the elements." 2107Return a SOAP-NAMESPACE containing the elements."
2109 (soap-with-local-xmlns node 2108 (soap-with-local-xmlns node
2110 (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:schema) 2109 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:schema)
2111 nil 2110 nil
2112 "expecting an xsd:schema node, got %s" 2111 "expecting an xsd:schema node, got %s"
2113 (soap-l2wk (xml-node-name node))) 2112 (soap-l2wk (xml-node-name node)))
2114 2113
2115 (let ((ns (make-soap-namespace :name (soap-get-target-namespace node)))) 2114 (let ((ns (make-soap-namespace :name (soap-get-target-namespace node))))
2116 2115
2117 (dolist (def (xml-node-children node)) 2116 (dolist (def (xml-node-children node))
2118 (unless (stringp def) ; skip text nodes 2117 (unless (stringp def) ; skip text nodes
2119 (case (soap-l2wk (xml-node-name def)) 2118 (cl-case (soap-l2wk (xml-node-name def))
2120 (xsd:import 2119 (xsd:import
2121 ;; Imports will be processed later 2120 ;; Imports will be processed later
2122 ;; NOTE: we should expand the location now! 2121 ;; NOTE: we should expand the location now!
@@ -2195,7 +2194,7 @@ See also `soap-resolve-references' and
2195 (message (cdr input))) 2194 (message (cdr input)))
2196 ;; Name this part if it was not named 2195 ;; Name this part if it was not named
2197 (when (or (null name) (equal name "")) 2196 (when (or (null name) (equal name ""))
2198 (setq name (format "in%d" (incf counter)))) 2197 (setq name (format "in%d" (cl-incf counter))))
2199 (when (soap-name-p message) 2198 (when (soap-name-p message)
2200 (setf (soap-operation-input operation) 2199 (setf (soap-operation-input operation)
2201 (cons (intern name) 2200 (cons (intern name)
@@ -2206,7 +2205,7 @@ See also `soap-resolve-references' and
2206 (let ((name (car output)) 2205 (let ((name (car output))
2207 (message (cdr output))) 2206 (message (cdr output)))
2208 (when (or (null name) (equal name "")) 2207 (when (or (null name) (equal name ""))
2209 (setq name (format "out%d" (incf counter)))) 2208 (setq name (format "out%d" (cl-incf counter))))
2210 (when (soap-name-p message) 2209 (when (soap-name-p message)
2211 (setf (soap-operation-output operation) 2210 (setf (soap-operation-output operation)
2212 (cons (intern name) 2211 (cons (intern name)
@@ -2218,7 +2217,7 @@ See also `soap-resolve-references' and
2218 (let ((name (car fault)) 2217 (let ((name (car fault))
2219 (message (cdr fault))) 2218 (message (cdr fault)))
2220 (when (or (null name) (equal name "")) 2219 (when (or (null name) (equal name ""))
2221 (setq name (format "fault%d" (incf counter)))) 2220 (setq name (format "fault%d" (cl-incf counter))))
2222 (if (soap-name-p message) 2221 (if (soap-name-p message)
2223 (push (cons (intern name) 2222 (push (cons (intern name)
2224 (soap-wsdl-get message wsdl 'soap-message-p)) 2223 (soap-wsdl-get message wsdl 'soap-message-p))
@@ -2304,19 +2303,19 @@ traverse an element tree."
2304 ;; If this namespace does not have an alias, create one for it. 2303 ;; If this namespace does not have an alias, create one for it.
2305 (catch 'done 2304 (catch 'done
2306 (while t 2305 (while t
2307 (setq nstag (format "ns%d" (incf nstag-id))) 2306 (setq nstag (format "ns%d" (cl-incf nstag-id)))
2308 (unless (assoc nstag alias-table) 2307 (unless (assoc nstag alias-table)
2309 (soap-wsdl-add-alias nstag (soap-namespace-name ns) wsdl) 2308 (soap-wsdl-add-alias nstag (soap-namespace-name ns) wsdl)
2310 (throw 'done t))))) 2309 (throw 'done t)))))
2311 2310
2312 (maphash (lambda (_name element) 2311 (maphash (lambda (_name element)
2313 (cond ((soap-element-p element) ; skip links 2312 (cond ((soap-element-p element) ; skip links
2314 (incf nprocessed) 2313 (cl-incf nprocessed)
2315 (soap-resolve-references element wsdl)) 2314 (soap-resolve-references element wsdl))
2316 ((listp element) 2315 ((listp element)
2317 (dolist (e element) 2316 (dolist (e element)
2318 (when (soap-element-p e) 2317 (when (soap-element-p e)
2319 (incf nprocessed) 2318 (cl-incf nprocessed)
2320 (soap-resolve-references e wsdl)))))) 2319 (soap-resolve-references e wsdl))))))
2321 (soap-namespace-elements ns))))) 2320 (soap-namespace-elements ns)))))
2322 wsdl) 2321 wsdl)
@@ -2391,9 +2390,9 @@ Build on WSDL if it is provided."
2391 "Assert that NODE is valid." 2390 "Assert that NODE is valid."
2392 (soap-with-local-xmlns node 2391 (soap-with-local-xmlns node
2393 (let ((node-name (soap-l2wk (xml-node-name node)))) 2392 (let ((node-name (soap-l2wk (xml-node-name node))))
2394 (assert (eq node-name 'wsdl:definitions) 2393 (cl-assert (eq node-name 'wsdl:definitions)
2395 nil 2394 nil
2396 "expecting wsdl:definitions node, got %s" node-name)))) 2395 "expecting wsdl:definitions node, got %s" node-name))))
2397 2396
2398(defun soap-parse-wsdl-phase-fetch-imports (node wsdl) 2397(defun soap-parse-wsdl-phase-fetch-imports (node wsdl)
2399 "Fetch and load files imported by NODE into WSDL." 2398 "Fetch and load files imported by NODE into WSDL."
@@ -2473,10 +2472,10 @@ Build on WSDL if it is provided."
2473 2472
2474(defun soap-parse-message (node) 2473(defun soap-parse-message (node)
2475 "Parse NODE as a wsdl:message and return the corresponding type." 2474 "Parse NODE as a wsdl:message and return the corresponding type."
2476 (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:message) 2475 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:message)
2477 nil 2476 nil
2478 "expecting wsdl:message node, got %s" 2477 "expecting wsdl:message node, got %s"
2479 (soap-l2wk (xml-node-name node))) 2478 (soap-l2wk (xml-node-name node)))
2480 (let ((name (xml-get-attribute-or-nil node 'name)) 2479 (let ((name (xml-get-attribute-or-nil node 'name))
2481 parts) 2480 parts)
2482 (dolist (p (soap-xml-get-children1 node 'wsdl:part)) 2481 (dolist (p (soap-xml-get-children1 node 'wsdl:part))
@@ -2500,10 +2499,10 @@ Build on WSDL if it is provided."
2500 2499
2501(defun soap-parse-port-type (node) 2500(defun soap-parse-port-type (node)
2502 "Parse NODE as a wsdl:portType and return the corresponding port." 2501 "Parse NODE as a wsdl:portType and return the corresponding port."
2503 (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:portType) 2502 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:portType)
2504 nil 2503 nil
2505 "expecting wsdl:portType node got %s" 2504 "expecting wsdl:portType node got %s"
2506 (soap-l2wk (xml-node-name node))) 2505 (soap-l2wk (xml-node-name node)))
2507 (let* ((soap-target-xmlns (concat "urn:" (xml-get-attribute node 'name))) 2506 (let* ((soap-target-xmlns (concat "urn:" (xml-get-attribute node 'name)))
2508 (ns (make-soap-namespace :name soap-target-xmlns))) 2507 (ns (make-soap-namespace :name soap-target-xmlns)))
2509 (dolist (node (soap-xml-get-children1 node 'wsdl:operation)) 2508 (dolist (node (soap-xml-get-children1 node 'wsdl:operation))
@@ -2522,14 +2521,14 @@ Build on WSDL if it is provided."
2522 2521
2523 ;; link all messages from this namespace, as this namespace 2522 ;; link all messages from this namespace, as this namespace
2524 ;; will be used for decoding the response. 2523 ;; will be used for decoding the response.
2525 (destructuring-bind (name . message) (soap-operation-input o) 2524 (cl-destructuring-bind (name . message) (soap-operation-input o)
2526 (soap-namespace-put-link name message ns)) 2525 (soap-namespace-put-link name message ns))
2527 2526
2528 (destructuring-bind (name . message) (soap-operation-output o) 2527 (cl-destructuring-bind (name . message) (soap-operation-output o)
2529 (soap-namespace-put-link name message ns)) 2528 (soap-namespace-put-link name message ns))
2530 2529
2531 (dolist (fault (soap-operation-faults o)) 2530 (dolist (fault (soap-operation-faults o))
2532 (destructuring-bind (name . message) fault 2531 (cl-destructuring-bind (name . message) fault
2533 (soap-namespace-put-link name message ns))) 2532 (soap-namespace-put-link name message ns)))
2534 2533
2535 ))))) 2534 )))))
@@ -2539,10 +2538,10 @@ Build on WSDL if it is provided."
2539 2538
2540(defun soap-parse-operation (node) 2539(defun soap-parse-operation (node)
2541 "Parse NODE as a wsdl:operation and return the corresponding type." 2540 "Parse NODE as a wsdl:operation and return the corresponding type."
2542 (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:operation) 2541 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:operation)
2543 nil 2542 nil
2544 "expecting wsdl:operation node, got %s" 2543 "expecting wsdl:operation node, got %s"
2545 (soap-l2wk (xml-node-name node))) 2544 (soap-l2wk (xml-node-name node)))
2546 (let ((name (xml-get-attribute node 'name)) 2545 (let ((name (xml-get-attribute node 'name))
2547 (parameter-order (split-string 2546 (parameter-order (split-string
2548 (xml-get-attribute node 'parameterOrder))) 2547 (xml-get-attribute node 'parameterOrder)))
@@ -2579,10 +2578,10 @@ Build on WSDL if it is provided."
2579 2578
2580(defun soap-parse-binding (node) 2579(defun soap-parse-binding (node)
2581 "Parse NODE as a wsdl:binding and return the corresponding type." 2580 "Parse NODE as a wsdl:binding and return the corresponding type."
2582 (assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:binding) 2581 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:binding)
2583 nil 2582 nil
2584 "expecting wsdl:binding node, got %s" 2583 "expecting wsdl:binding node, got %s"
2585 (soap-l2wk (xml-node-name node))) 2584 (soap-l2wk (xml-node-name node)))
2586 (let ((name (xml-get-attribute node 'name)) 2585 (let ((name (xml-get-attribute node 'name))
2587 (type (xml-get-attribute node 'type))) 2586 (type (xml-get-attribute node 'type)))
2588 (let ((binding (make-soap-binding :name name 2587 (let ((binding (make-soap-binding :name name
@@ -2693,8 +2692,8 @@ decode function to perform the actual decoding."
2693 (when result (throw 'done result)))))) 2692 (when result (throw 'done result))))))
2694 (t 2693 (t
2695 (let ((decoder (get (aref type 0) 'soap-decoder))) 2694 (let ((decoder (get (aref type 0) 'soap-decoder)))
2696 (assert decoder nil 2695 (cl-assert decoder nil
2697 "no soap-decoder for %s type" (aref type 0)) 2696 "no soap-decoder for %s type" (aref type 0))
2698 (funcall decoder type node)))))))))) 2697 (funcall decoder type node))))))))))
2699 2698
2700(defun soap-decode-any-type (node) 2699(defun soap-decode-any-type (node)
@@ -2769,10 +2768,10 @@ decode function to perform the actual decoding."
2769OPERATION is the WSDL operation for which we expect the response, 2768OPERATION is the WSDL operation for which we expect the response,
2770WSDL is used to decode the NODE" 2769WSDL is used to decode the NODE"
2771 (soap-with-local-xmlns node 2770 (soap-with-local-xmlns node
2772 (assert (eq (soap-l2wk (xml-node-name node)) 'soap:Envelope) 2771 (cl-assert (eq (soap-l2wk (xml-node-name node)) 'soap:Envelope)
2773 nil 2772 nil
2774 "expecting soap:Envelope node, got %s" 2773 "expecting soap:Envelope node, got %s"
2775 (soap-l2wk (xml-node-name node))) 2774 (soap-l2wk (xml-node-name node)))
2776 (let ((headers (soap-xml-get-children1 node 'soap:Header)) 2775 (let ((headers (soap-xml-get-children1 node 'soap:Header))
2777 (body (car (soap-xml-get-children1 node 'soap:Body)))) 2776 (body (car (soap-xml-get-children1 node 'soap:Body))))
2778 2777
@@ -2879,8 +2878,8 @@ for the type and calls that specialized function to do the work.
2879Attributes are inserted in the current buffer at the current 2878Attributes are inserted in the current buffer at the current
2880position." 2879position."
2881 (let ((attribute-encoder (get (aref type 0) 'soap-attribute-encoder))) 2880 (let ((attribute-encoder (get (aref type 0) 'soap-attribute-encoder)))
2882 (assert attribute-encoder nil 2881 (cl-assert attribute-encoder nil
2883 "no soap-attribute-encoder for %s type" (aref type 0)) 2882 "no soap-attribute-encoder for %s type" (aref type 0))
2884 (funcall attribute-encoder value type))) 2883 (funcall attribute-encoder value type)))
2885 2884
2886(defun soap-encode-value (value type) 2885(defun soap-encode-value (value type)
@@ -2893,7 +2892,7 @@ is to be encoded. This is a generic function which finds an
2893encoder function based on TYPE and calls that encoder to do the 2892encoder function based on TYPE and calls that encoder to do the
2894work." 2893work."
2895 (let ((encoder (get (aref type 0) 'soap-encoder))) 2894 (let ((encoder (get (aref type 0) 'soap-encoder)))
2896 (assert encoder nil "no soap-encoder for %s type" (aref type 0)) 2895 (cl-assert encoder nil "no soap-encoder for %s type" (aref type 0))
2897 (funcall encoder value type)) 2896 (funcall encoder value type))
2898 (when (soap-element-namespace-tag type) 2897 (when (soap-element-namespace-tag type)
2899 (add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag type)))) 2898 (add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag type))))
@@ -2909,9 +2908,9 @@ being used."
2909 (use (soap-bound-operation-use operation)) 2908 (use (soap-bound-operation-use operation))
2910 (message (cdr (soap-operation-input op))) 2909 (message (cdr (soap-operation-input op)))
2911 (parameter-order (soap-operation-parameter-order op)) 2910 (parameter-order (soap-operation-parameter-order op))
2912 (param-table (loop for formal in parameter-order 2911 (param-table (cl-loop for formal in parameter-order
2913 for value in parameters 2912 for value in parameters
2914 collect (cons formal value)))) 2913 collect (cons formal value))))
2915 2914
2916 (unless (= (length parameter-order) (length parameters)) 2915 (unless (= (length parameter-order) (length parameters))
2917 (error "Wrong number of parameters for %s: expected %d, got %s" 2916 (error "Wrong number of parameters for %s: expected %d, got %s"
@@ -3059,41 +3058,41 @@ OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
3059 (lambda (status) 3058 (lambda (status)
3060 (let ((data-buffer (current-buffer))) 3059 (let ((data-buffer (current-buffer)))
3061 (unwind-protect 3060 (unwind-protect
3062 (let ((error-status (plist-get status :error))) 3061 (let ((error-status (plist-get status :error)))
3063 (if error-status 3062 (if error-status
3064 (signal (car error-status) (cdr error-status)) 3063 (signal (car error-status) (cdr error-status))
3065 (apply callback 3064 (apply callback
3066 (soap-parse-envelope 3065 (soap-parse-envelope
3067 (soap-parse-server-response) 3066 (soap-parse-server-response)
3068 operation wsdl) 3067 operation wsdl)
3069 cbargs))) 3068 cbargs)))
3070 ;; Ensure the url-retrieve buffer is not leaked. 3069 ;; Ensure the url-retrieve buffer is not leaked.
3071 (and (buffer-live-p data-buffer) 3070 (and (buffer-live-p data-buffer)
3072 (kill-buffer data-buffer)))))) 3071 (kill-buffer data-buffer))))))
3073 (let ((buffer (url-retrieve-synchronously 3072 (let ((buffer (url-retrieve-synchronously
3074 (soap-port-service-url port)))) 3073 (soap-port-service-url port))))
3075 (condition-case err 3074 (condition-case err
3076 (with-current-buffer buffer 3075 (with-current-buffer buffer
3077 (declare (special url-http-response-status)) 3076 (declare (special url-http-response-status))
3078 (if (null url-http-response-status) 3077 (if (null url-http-response-status)
3079 (error "No HTTP response from server")) 3078 (error "No HTTP response from server"))
3080 (if (and soap-debug (> url-http-response-status 299)) 3079 (if (and soap-debug (> url-http-response-status 299))
3081 ;; This is a warning because some SOAP errors come 3080 ;; This is a warning because some SOAP errors come
3082 ;; back with a HTTP response 500 (internal server 3081 ;; back with a HTTP response 500 (internal server
3083 ;; error) 3082 ;; error)
3084 (warn "Error in SOAP response: HTTP code %s" 3083 (warn "Error in SOAP response: HTTP code %s"
3085 url-http-response-status)) 3084 url-http-response-status))
3086 (soap-parse-envelope (soap-parse-server-response) 3085 (soap-parse-envelope (soap-parse-server-response)
3087 operation wsdl)) 3086 operation wsdl))
3088 (soap-error 3087 (soap-error
3089 ;; Propagate soap-errors -- they are error replies of the 3088 ;; Propagate soap-errors -- they are error replies of the
3090 ;; SOAP protocol and don't indicate a communication 3089 ;; SOAP protocol and don't indicate a communication
3091 ;; problem or a bug in this code. 3090 ;; problem or a bug in this code.
3092 (signal (car err) (cdr err))) 3091 (signal (car err) (cdr err)))
3093 (error 3092 (error
3094 (when soap-debug 3093 (when soap-debug
3095 (pop-to-buffer buffer)) 3094 (pop-to-buffer buffer))
3096 (error (error-message-string err))))))))) 3095 (error (error-message-string err)))))))))
3097 3096
3098(defun soap-invoke (wsdl service operation-name &rest parameters) 3097(defun soap-invoke (wsdl service operation-name &rest parameters)
3099 "Invoke a SOAP operation and return the result. 3098 "Invoke a SOAP operation and return the result.
diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el
index db83cf8463e..cd14eddb4f4 100644
--- a/lisp/net/soap-inspect.el
+++ b/lisp/net/soap-inspect.el
@@ -37,8 +37,7 @@
37 37
38;;; Code: 38;;; Code:
39 39
40(eval-when-compile (require 'cl)) 40(require 'cl-lib)
41
42(require 'soap-client) 41(require 'soap-client)
43 42
44;;; sample-value 43;;; sample-value
@@ -53,13 +52,13 @@ will be called."
53 (let ((sample-value (get (aref type 0) 'soap-sample-value))) 52 (let ((sample-value (get (aref type 0) 'soap-sample-value)))
54 (if sample-value 53 (if sample-value
55 (funcall sample-value type) 54 (funcall sample-value type)
56 (error "Cannot provide sample value for type %s" (aref type 0))))) 55 (error "Cannot provide sample value for type %s" (aref type 0)))))
57 56
58(defun soap-sample-value-for-xs-basic-type (type) 57(defun soap-sample-value-for-xs-basic-type (type)
59 "Provide a sample value for TYPE, an xs-basic-type. 58 "Provide a sample value for TYPE, an xs-basic-type.
60This is a specialization of `soap-sample-value' for xs-basic-type 59This is a specialization of `soap-sample-value' for xs-basic-type
61objects." 60objects."
62 (case (soap-xs-basic-type-kind type) 61 (cl-case (soap-xs-basic-type-kind type)
63 (string "a string") 62 (string "a string")
64 (anyURI "an URI") 63 (anyURI "an URI")
65 (QName "a QName") 64 (QName "a QName")
@@ -77,7 +76,7 @@ objects."
77 (if (soap-xs-element-name element) 76 (if (soap-xs-element-name element)
78 (cons (intern (soap-xs-element-name element)) 77 (cons (intern (soap-xs-element-name element))
79 (soap-sample-value (soap-xs-element-type element))) 78 (soap-sample-value (soap-xs-element-type element)))
80 (soap-sample-value (soap-xs-element-type element)))) 79 (soap-sample-value (soap-xs-element-type element))))
81 80
82(defun soap-sample-value-for-xs-attribute (attribute) 81(defun soap-sample-value-for-xs-attribute (attribute)
83 "Provide a sample value for ATTRIBUTE, a WSDL attribute. 82 "Provide a sample value for ATTRIBUTE, a WSDL attribute.
@@ -119,20 +118,20 @@ This is a specialization of `soap-sample-value' for
119 ((soap-xs-simple-type-pattern type) 118 ((soap-xs-simple-type-pattern type)
120 (format "a string matching %s" (soap-xs-simple-type-pattern type))) 119 (format "a string matching %s" (soap-xs-simple-type-pattern type)))
121 ((soap-xs-simple-type-length-range type) 120 ((soap-xs-simple-type-length-range type)
122 (destructuring-bind (low . high) (soap-xs-simple-type-length-range type) 121 (cl-destructuring-bind (low . high) (soap-xs-simple-type-length-range type)
123 (cond 122 (cond
124 ((and low high) 123 ((and low high)
125 (format "a string between %d and %d chars long" low high)) 124 (format "a string between %d and %d chars long" low high))
126 (low (format "a string at least %d chars long" low)) 125 (low (format "a string at least %d chars long" low))
127 (high (format "a string at most %d chars long" high)) 126 (high (format "a string at most %d chars long" high))
128 (t (format "a string OOPS"))))) 127 (t (format "a string OOPS")))))
129 ((soap-xs-simple-type-integer-range type) 128 ((soap-xs-simple-type-integer-range type)
130 (destructuring-bind (min . max) (soap-xs-simple-type-integer-range type) 129 (cl-destructuring-bind (min . max) (soap-xs-simple-type-integer-range type)
131 (cond 130 (cond
132 ((and min max) (+ min (random (- max min)))) 131 ((and min max) (+ min (random (- max min))))
133 (min (+ min (random 10))) 132 (min (+ min (random 10)))
134 (max (random max)) 133 (max (random max))
135 (t (random 100))))) 134 (t (random 100)))))
136 ((consp (soap-xs-simple-type-base type)) ; an union of values 135 ((consp (soap-xs-simple-type-base type)) ; an union of values
137 (let ((base (soap-xs-simple-type-base type))) 136 (let ((base (soap-xs-simple-type-base type)))
138 (soap-sample-value (nth (random (length base)) base)))) 137 (soap-sample-value (nth (random (length base)) base))))
@@ -146,7 +145,7 @@ This is a specialization of `soap-sample-value' for
146 (append 145 (append
147 (mapcar 'soap-sample-value-for-xs-attribute 146 (mapcar 'soap-sample-value-for-xs-attribute
148 (soap-xs-type-attributes type)) 147 (soap-xs-type-attributes type))
149 (case (soap-xs-complex-type-indicator type) 148 (cl-case (soap-xs-complex-type-indicator type)
150 (array 149 (array
151 (let* ((element-type (soap-xs-complex-type-base type)) 150 (let* ((element-type (soap-xs-complex-type-base type))
152 (sample1 (soap-sample-value element-type)) 151 (sample1 (soap-sample-value element-type))
@@ -251,24 +250,24 @@ entire WSDL can be inspected."
251 250
252 251
253(define-button-type 'soap-client-describe-link 252(define-button-type 'soap-client-describe-link
254 'face 'link 253 'face 'link
255 'help-echo "mouse-2, RET: describe item" 254 'help-echo "mouse-2, RET: describe item"
256 'follow-link t 255 'follow-link t
257 'action (lambda (button) 256 'action (lambda (button)
258 (let ((item (button-get button 'item))) 257 (let ((item (button-get button 'item)))
259 (soap-inspect item))) 258 (soap-inspect item)))
260 'skip t) 259 'skip t)
261 260
262(define-button-type 'soap-client-describe-back-link 261(define-button-type 'soap-client-describe-back-link
263 'face 'link 262 'face 'link
264 'help-echo "mouse-2, RET: browse the previous item" 263 'help-echo "mouse-2, RET: browse the previous item"
265 'follow-link t 264 'follow-link t
266 'action (lambda (_button) 265 'action (lambda (_button)
267 (let ((item (pop soap-inspect-previous-items))) 266 (let ((item (pop soap-inspect-previous-items)))
268 (when item 267 (when item
269 (setq soap-inspect-current-item nil) 268 (setq soap-inspect-current-item nil)
270 (soap-inspect item)))) 269 (soap-inspect item))))
271 'skip t) 270 'skip t)
272 271
273(defun soap-insert-describe-button (element) 272(defun soap-insert-describe-button (element)
274 "Insert a button to inspect ELEMENT when pressed." 273 "Insert a button to inspect ELEMENT when pressed."
@@ -323,7 +322,7 @@ soap-xs-attribute-group, in the current buffer."
323 (insert ", ") 322 (insert ", ")
324 (setq first-time nil)) 323 (setq first-time nil))
325 (soap-insert-describe-button b))) 324 (soap-insert-describe-button b)))
326 (soap-insert-describe-button (soap-xs-simple-type-base type))) 325 (soap-insert-describe-button (soap-xs-simple-type-base type)))
327 (insert "\nAttributes: ") 326 (insert "\nAttributes: ")
328 (dolist (attribute (soap-xs-simple-type-attributes type)) 327 (dolist (attribute (soap-xs-simple-type-attributes type))
329 (let ((name (or (soap-xs-attribute-name attribute) "*inline*")) 328 (let ((name (or (soap-xs-attribute-name attribute) "*inline*"))
@@ -359,7 +358,7 @@ soap-xs-attribute-group, in the current buffer."
359TYPE is a `soap-xs-complex-type'" 358TYPE is a `soap-xs-complex-type'"
360 (insert "Complex type: " (soap-element-fq-name type)) 359 (insert "Complex type: " (soap-element-fq-name type))
361 (insert "\nKind: ") 360 (insert "\nKind: ")
362 (case (soap-xs-complex-type-indicator type) 361 (cl-case (soap-xs-complex-type-indicator type)
363 ((sequence all) 362 ((sequence all)
364 (insert "a sequence ") 363 (insert "a sequence ")
365 (when (soap-xs-complex-type-base type) 364 (when (soap-xs-complex-type-base type)
@@ -394,10 +393,10 @@ TYPE is a `soap-xs-complex-type'"
394 (insert 393 (insert
395 (make-string 394 (make-string
396 (- type-width (length (soap-element-fq-name type))) ?\ )) 395 (- type-width (length (soap-element-fq-name type))) ?\ ))
397 (when (soap-xs-element-multiple? element) 396 (when (soap-xs-element-multiple? element)
398 (insert " multiple")) 397 (insert " multiple"))
399 (when (soap-xs-element-optional? element) 398 (when (soap-xs-element-optional? element)
400 (insert " optional")))))) 399 (insert " optional"))))))
401 (choice 400 (choice
402 (insert "a choice ") 401 (insert "a choice ")
403 (when (soap-xs-complex-type-base type) 402 (when (soap-xs-complex-type-base type)
@@ -449,11 +448,11 @@ TYPE is a `soap-xs-complex-type'"
449 "Insert information about PORT-TYPE into the current buffer." 448 "Insert information about PORT-TYPE into the current buffer."
450 (insert "Port-type name: " (soap-element-fq-name port-type) "\n") 449 (insert "Port-type name: " (soap-element-fq-name port-type) "\n")
451 (insert "Operations:\n") 450 (insert "Operations:\n")
452 (loop for o being the hash-values of 451 (cl-loop for o being the hash-values of
453 (soap-namespace-elements (soap-port-type-operations port-type)) 452 (soap-namespace-elements (soap-port-type-operations port-type))
454 do (progn 453 do (progn
455 (insert "\t") 454 (insert "\t")
456 (soap-insert-describe-button (car o))))) 455 (soap-insert-describe-button (car o)))))
457 456
458(defun soap-inspect-binding (binding) 457(defun soap-inspect-binding (binding)
459 "Insert information about BINDING into the current buffer." 458 "Insert information about BINDING into the current buffer."
@@ -461,13 +460,13 @@ TYPE is a `soap-xs-complex-type'"
461 (insert "\n") 460 (insert "\n")
462 (insert "Bound operations:\n") 461 (insert "Bound operations:\n")
463 (let* ((ophash (soap-binding-operations binding)) 462 (let* ((ophash (soap-binding-operations binding))
464 (operations (loop for o being the hash-keys of ophash 463 (operations (cl-loop for o being the hash-keys of ophash
465 collect o)) 464 collect o))
466 op-name-width) 465 op-name-width)
467 466
468 (setq operations (sort operations 'string<)) 467 (setq operations (sort operations 'string<))
469 468
470 (setq op-name-width (loop for o in operations maximizing (length o))) 469 (setq op-name-width (cl-loop for o in operations maximizing (length o)))
471 470
472 (dolist (op operations) 471 (dolist (op operations)
473 (let* ((bound-op (gethash op ophash)) 472 (let* ((bound-op (gethash op ophash))