]> code.delx.au - gnu-emacs/blobdiff - lisp/net/soap-client.el
Merge from trunk.
[gnu-emacs] / lisp / net / soap-client.el
index bad6ca1e4312c0944dcf33060ceea953437e4117..42c698876cdfd40dcbf200d832fd75e0f0b3a244 100644 (file)
@@ -1,25 +1,27 @@
 ;;;; soap-client.el -- Access SOAP web services from Emacs
 
-;; Copyright (C) 2009-2011  Alex Harsanyi <AlexHarsanyi@gmail.com>
+;; Copyright (C) 2009-2011  Free Software Foundation, Inc.
 
-;; This program is free software: you can redistribute it and/or modify
+;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
+;; Created: December, 2009
+;; Keywords: soap, web-services, comm, hypermedia
+;; Package: soap-client
+;; Homepage: http://code.google.com/p/emacs-soap-client
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
 ;; (at your option) any later version.
 
-;; This program is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-;; Author: Alexandru Harsanyi (AlexHarsanyi@gmail.com)
-;; Created: December, 2009
-;; Keywords: soap, web-services, comm, hypermedia
-;; Homepage: http://code.google.com/p/emacs-soap-client
-;;
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 ;;
@@ -322,13 +324,18 @@ added to the namespace."
     ;; if name is nil, use TARGET as a name...
     (cond ((soap-element-p target)
            (setq name (soap-element-name target)))
+          ((consp target)               ; a fq name: (namespace . name)
+           (setq name (cdr target)))
           ((stringp target)
            (cond ((string-match "^\\(.*\\):\\(.*\\)$" target)
                   (setq name (match-string 2 target)))
                  (t
                   (setq name target))))))
 
-  (assert name)                         ; by now, name should be valid
+  ;; by now, name should be valid
+  (assert (and name (not (equal name "")))
+          nil
+          "Cannot determine name for namespace link")
   (push (make-soap-namespace-link :name name :target target)
         (gethash name (soap-namespace-elements ns))))
 
@@ -722,9 +729,7 @@ traverse an element tree."
                               (incf nprocessed)
                               (soap-resolve-references-for-element e wsdl)
                               (setf (soap-element-namespace-tag e) nstag))))))
-                 (soap-namespace-elements ns))))
-
-    (message "Processed %d" nprocessed))
+                 (soap-namespace-elements ns)))))
     wsdl)
 
 ;;;;; Loading WSDL from XML documents
@@ -889,7 +894,11 @@ Return a SOAP-NAMESPACE containing the elements."
       (when (consp c)               ; skip string nodes, which are whitespace
         (let ((node-name (soap-l2wk (xml-node-name c))))
           (cond
-            ((eq node-name 'xsd:sequence)
+            ;; The difference between xsd:all and xsd:sequence is that fields
+            ;; in xsd:all are not ordered and they can occur only once.  We
+            ;; don't care about that difference in soap-client.el
+            ((or (eq node-name 'xsd:sequence)
+                 (eq node-name 'xsd:all))
              (setq type (soap-parse-complex-type-sequence c)))
             ((eq node-name 'xsd:complexContent)
              (setq type (soap-parse-complex-type-complex-content c)))
@@ -908,9 +917,10 @@ NODE is assumed to be an xsd:sequence node.  In that case, each
 of its children is assumed to be a sequence element.  Each
 sequence element is parsed constructing the corresponding type.
 A list of these types is returned."
-  (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:sequence)
+  (assert (let ((n (soap-l2wk (xml-node-name node))))
+            (memq n '(xsd:sequence xsd:all)))
           nil
-          "soap-parse-sequence: expecting xsd:sequence node, got %s"
+          "soap-parse-sequence: expecting xsd:sequence or xsd:all node, got %s"
           (soap-l2wk (xml-node-name node)))
   (let (elements)
     (dolist (e (soap-xml-get-children1 node 'xsd:element))
@@ -1702,10 +1712,6 @@ operations in a WSDL document."
                     ;; error)
                     (warn "Error in SOAP response: HTTP code %s"
                          url-http-response-status))
-                                 (when (> (buffer-size) 1000000)
-                                   (soap-warning
-                                   "Received large message: %s bytes"
-                                   (buffer-size)))
                 (let ((mime-part (mm-dissect-buffer t t)))
                   (unless mime-part
                     (error "Failed to decode response from server"))
@@ -1733,8 +1739,7 @@ operations in a WSDL document."
 
 \f
 ;;; Local Variables:
-;;; mode: emacs-lisp
-;;; mode: outline-minor
+;;; eval: (outline-minor-mode 1)
 ;;; outline-regexp: ";;;;+"
 ;;; End: