-;;;; soap-client.el -- Access SOAP web services -*- lexical-binding: t -*-
+;;; soap-client.el --- Access SOAP web services -*- lexical-binding: t -*-
-;; Copyright (C) 2009-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
;; Created: December, 2009
-;; Version: 3.0.1
+;; Version: 3.0.2
;; Keywords: soap, web-services, comm, hypermedia
;; Package: soap-client
;; Homepage: https://github.com/alex-hhh/emacs-soap-client
+;; Package-Requires: ((cl-lib "0.5"))
;; This file is part of GNU Emacs.
;;; Code:
(eval-when-compile (require 'cl))
+(require 'cl-lib)
(require 'xml)
(require 'xsd-regexp)
(require 'mm-decode)
(defsubst soap-warning (message &rest args)
- "Display a warning MESSAGE with ARGS, using the 'soap-client warning type."
- (display-warning 'soap-client (apply #'format-message message args)
- :warning))
+ "Display a warning MESSAGE with ARGS, using the `soap-client' warning type."
+ ;; Do not use #'format-message, to support older Emacs versions.
+ (display-warning 'soap-client (apply #'format message args) :warning))
(defgroup soap-client nil
"Access SOAP web services from Emacs."
replaced with DATATYPE, a symbol representing the XSD primitive
datatype. This symbol can be used to determine which fields
apply and which don't when it's not already clear from context.
-For example a datatype of 'time means the year, month and day
+For example a datatype of `time' means the year, month and day
fields should be ignored.
This function will throw an error if DATE-TIME-STRING represents
(error (push (cadr error-object) messages))))
(when messages
(error (mapconcat 'identity (nreverse messages) "; and: "))))
- (cl-flet ((fail-with-message (format value)
- (push (format format value) messages)
- (throw 'invalid nil)))
+ (cl-labels ((fail-with-message (format value)
+ (push (format format value) messages)
+ (throw 'invalid nil)))
(catch 'invalid
(let ((enumeration (soap-xs-simple-type-enumeration type)))
(when (and (> (length enumeration) 1)
;;;; Soap Envelope parsing
-(define-error 'soap-error "SOAP error")
+(if (fboundp 'define-error)
+ (define-error 'soap-error "SOAP error")
+ ;; Support older Emacs versions that do not have define-error, so
+ ;; that soap-client can remain unchanged in GNU ELPA.
+ (put 'soap-error
+ 'error-conditions
+ '(error soap-error))
+ (put 'soap-error 'error-message "SOAP error"))
(defun soap-parse-envelope (node operation wsdl)
"Parse the SOAP envelope in NODE and return the response.
NOTE: The SOAP service provider should document the available
operations and their parameters for the service. You can also
use the `soap-inspect' function to browse the available
-operations in a WSDL document."
+operations in a WSDL document.
+
+NOTE: `soap-invoke' base64-decodes xsd:base64Binary return values
+into unibyte strings; these byte-strings require further
+interpretation by the caller."
(apply #'soap-invoke-internal nil nil wsdl service operation-name parameters))
(defun soap-invoke-async (callback cbargs wsdl service operation-name