summaryrefslogtreecommitdiff
path: root/lisp/net/soap-inspect.el
diff options
context:
space:
mode:
authorAlex Harsanyi <AlexHarsanyi@gmail.com>2012-04-25 12:28:29 +0200
committerMichael Albinus <michael.albinus@gmx.de>2012-04-25 12:28:29 +0200
commitdb9b177bcc4aabebebf604de7a0efc5b32981c5b (patch)
treedb389c859ea4965a2d36215dbe24671f52c1098c /lisp/net/soap-inspect.el
parent1fc6097bfa931cf17f8a5b76ec8442e22d33c724 (diff)
downloademacs-db9b177bcc4aabebebf604de7a0efc5b32981c5b.tar.gz
Sync with soap-client repository. Support SOAP simpleType. (Bug#10331)
* soap-client.el (soap-resolve-references-for-sequence-type) (soap-resolve-references-for-array-type): hack to prevent self references, see Bug#9. (soap-parse-envelope): report the contents of the 'detail' node when receiving a fault reply. (soap-parse-envelope): report the contents of the entire 'detail' node. * soap-inspect.el (soap-sample-value-for-simple-type) (soap-inspect-simple-type): new function * soap-client.el (soap-simple-type): new struct (soap-default-xsd-types, soap-default-soapenc-types) (soap-decode-basic-type, soap-encode-basic-type): support unsignedInt and double basic types (soap-resolve-references-for-simple-type) (soap-parse-simple-type, soap-encode-simple-type): new function (soap-parse-schema): parse xsd:simpleType declarations * soap-client.el (soap-default-xsd-types) (soap-default-soapenc-types): add integer, byte and anyURI types (soap-parse-complex-type-complex-content): use `soap-wk2l' to find the local name of "soapenc:Array" (soap-decode-basic-type, soap-encode-basic-type): support encoding decoding integer, byte and anyURI xsd types.
Diffstat (limited to 'lisp/net/soap-inspect.el')
-rw-r--r--lisp/net/soap-inspect.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el
index 823f815d58f..23937e21770 100644
--- a/lisp/net/soap-inspect.el
+++ b/lisp/net/soap-inspect.el
@@ -66,6 +66,15 @@ use `soap-sample-value' instead."
;; TODO: we need better sample values for more types.
(t (format "%s" (soap-basic-type-kind type)))))
+(defun soap-sample-value-for-simple-type (type)
+ "Provive a sample value for TYPE which is a simple type.
+This is a specific function which should not be called directly,
+use `soap-sample-value' instead."
+ (let ((enumeration (soap-simple-type-enumeration type)))
+ (if (> (length enumeration) 1)
+ (elt enumeration (random (length enumeration)))
+ (soap-sample-value-for-basic-type type))))
+
(defun soap-sample-value-for-seqence-type (type)
"Provide a sample value for TYPE which is a sequence type.
Values for sequence types are ALISTS of (slot-name . VALUE) for
@@ -115,6 +124,9 @@ use `soap-sample-value' instead."
(put (aref (make-soap-basic-type) 0) 'soap-sample-value
'soap-sample-value-for-basic-type)
+ (put (aref (make-soap-simple-type) 0) 'soap-sample-value
+ 'soap-sample-value-for-simple-type)
+
(put (aref (make-soap-sequence-type) 0) 'soap-sample-value
'soap-sample-value-for-seqence-type)
@@ -204,6 +216,16 @@ entire WSDL can be inspected."
(insert "\nSample value\n")
(pp (soap-sample-value basic-type) (current-buffer)))
+(defun soap-inspect-simple-type (simple-type)
+ "Insert information about SIMPLE-TYPE into the current buffer"
+ (insert "Simple type: " (soap-element-fq-name simple-type) "\n")
+ (insert "Base: " (symbol-name (soap-basic-type-kind simple-type)) "\n")
+ (let ((enumeration (soap-simple-type-enumeration simple-type)))
+ (when (> (length enumeration) 1)
+ (insert "Valid values: ")
+ (dolist (e enumeration)
+ (insert "\"" e "\" ")))))
+
(defun soap-inspect-sequence-type (sequence)
"Insert information about SEQUENCE into the current buffer."
(insert "Sequence type: " (soap-element-fq-name sequence) "\n")
@@ -331,6 +353,9 @@ entire WSDL can be inspected."
(put (aref (make-soap-basic-type) 0) 'soap-inspect
'soap-inspect-basic-type)
+ (put (aref (make-soap-simple-type) 0) 'soap-inspect
+ 'soap-inspect-simple-type)
+
(put (aref (make-soap-sequence-type) 0) 'soap-inspect
'soap-inspect-sequence-type)