2015-11-12 04:43:50 +00:00
|
|
|
|
;;; soap-client.el --- Access SOAP web services -*- lexical-binding: t -*-
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2019-01-01 00:59:58 +00:00
|
|
|
|
;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2011-03-05 10:32:10 +00:00
|
|
|
|
;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
|
2011-02-17 04:41:29 +00:00
|
|
|
|
;; Created: December, 2009
|
2018-10-16 17:44:16 +00:00
|
|
|
|
;; Version: 3.1.5
|
2011-02-17 04:41:29 +00:00
|
|
|
|
;; Keywords: soap, web-services, comm, hypermedia
|
2011-03-05 10:32:10 +00:00
|
|
|
|
;; Package: soap-client
|
Sync with soap-client repository, version 3.0.1
* soap-client.el, soap-inspect.el: Bump version to 3.0.1.
* soap-client.el, soap-inspect.el: Update home page.
* soap-client.el, soap-inspect.el: Bump version to 3.0.0.
* soap-inspect.el: Merge in changes from Emacs master branch.
* soap-client.el: Merge in changes from Emacs master branch.
* soap-inspect.el: Shorten first line description.
* soap-client.el: Make a small whitespace fix.
* soap-inspect.el: Update copyright years.
* soap-client.el (soap-encoded-namespaces): Move above first use
in soap-encode-xs-element.
* soap-client.el (soap-type-is-array?): new defun
(soap-encode-xs-element): handle array elements in this function
(soap-encode-xs-complex-type): flag error if asked to encode an
array type, this is handled in `soap-encode-xs-element'
* soap-inspect.el (soap-inspect-xs-attribute-group): Do not print
type for attribute group.
* soap-inspect.el (soap-sample-value-for-xs-attribute-group): New
function.
(soap-inspect-xs-attribute-group): Likewise.
* soap-inspect.el
(soap-resolve-references-for-xs-attribute-group): Resolve
references of attributes in an attribute group.
* soap-client.el (soap-decode-xs-attributes): Process attribute
type directly, not through soap-wsdl-get.
* soap-client.el (soap-xs-parse-attribute): Leave reference nil if
reference attribute is nil.
* soap-client.el (soap-resolve-references-for-xs-attribute):
Convert XML schema attributes to xsd:string.
* soap-inspect.el (soap-sample-value-for-xs-attribute): New
function.
(soap-sample-value-for-xs-simple-type): Prepend attributes to
result.
(soap-sample-value-for-xs-complex-type): Likewise.
(soap-inspect-xs-attribute): New function.
(soap-inspect-xs-simple-type): Print attributes.
(soap-inspect-xs-complex-type): Likewise.
* soap-inspect.el (soap-resolve-references-for-xs-simple-type):
Resolve references for attributes.
(soap-resolve-references-for-xs-complex-type): Likewise.
* soap-client.el (soap-xml-node-find-matching-child): Rename from
soap-xml-node-first-child.
(soap-xs-parse-attribute): Call soap-xml-node-find-matching-child.
(soap-xs-parse-simple-type): Likewise.
* soap-client.el (soap-invoke-async): Add error checking.
* soap-client.el (soap-invoke-internal): New function.
(soap-invoke-async): Call soap-invoke-internal.
(soap-invoke): Likewise.
* soap-client.el (soap-invoke-async): Ensure buffer passed to
url-retrieve callback is killed.
* soap-client.el (soap-parse-wsdl-phase-validate-node): Rename
function.
(soap-parse-wsdl-phase-fetch-imports): Likewise.
(soap-parse-wsdl-phase-parse-schema): Likewise.
(soap-parse-wsdl-phase-fetch-schema): Likewise.
(soap-parse-wsdl-phase-finish-parsing): Likewise.
(soap-parse-wsdl): Update calls.
* soap-client.el (soap-invoke-async): Fix callback invocation.
* soap-client.el (soap-invoke-async): New function.
(soap-invoke): Reimplement using soap-invoke-async.
* soap-client.el (soap-parse-server-response): Improve docstring.
(soap-invoke): Inline call to soap-parse-server-response.
* soap-client.el (soap-decode-xs-complex-type): Prevent incorrect
warning.
* soap-client.el (soap-parse-server-response): Rename
soap-process-url-response. Destroy the mime part.
(soap-invoke): Call soap-parse-server-response.
* soap-client.el: Update copyright date.
* soap-client.el: Fix checkdoc issues.
* soap-client.el: Fix indentation and long lines.
* soap-client.el (soap-time-format): Remove variable.
(soap-encode-xs-basic-type): Simplify date-time format detection.
(soap-decode-xs-basic-type): Remove soap-time-format support.
* soap-client.el (soap-process-url-response): New function.
(soap-fetch-xml-from-url): Call soap-process-url-response.
(soap-parse-wsdl-phase-1): New function.
(soap-parse-wsdl-phase-2): Likewise.
(soap-parse-wsdl-phase-3): Likewise.
(soap-parse-wsdl-phase-4): Likewise.
(soap-parse-wsdl-phase-5): Likewise.
(soap-parse-wsdl): Call phase functions.
* soap-client.el (soap-decode-xs-basic-type): Remove one-argument
and call.
* soap-client.el (soap-decode-date-time): Improve docstring.
* soap-client.el (soap-xmlschema-imports): Remove variable.
(soap-parse-schema): Add wsdl argument. Look up XML schema
imports from wsdl.
(soap-load-wsdl): Do not set soap-xmlschema-imports.
(soap-parse-wsdl): Get XML schema imports from wsdl.
* soap-client.el (soap-current-file): Remove variable.
(soap-wsdl): Add current-file slot.
(soap-fetch-xml-from-url): Add wsdl argument. Look up current
file from wsdl.
(soap-fetch-xml-from-file): Likewise.
(soap-fetch-xml): Likewise.
(soap-load-wsdl): Always create wsdl object first.
(soap-parse-wsdl): Pass wsdl to soap-fetch-xml.
* soap-client.el (soap-xs-element): Add is-group slot.
(soap-xs-parse-element): Set is-group slot.
(soap-resolve-references-for-xs-element): Skip is-group elements.
(soap-xs-complex-type): Add is-group slot.
(soap-xs-parse-complex-type): Set is-group slot.
(soap-xs-parse-sequence): Parse xsd:group elements.
(soap-resolve-references-for-xs-complex-type): Inline elements
from referenced xsd:group nodes.
(soap-parse-schema): Parse xsd:group nodes.
* soap-client.el (soap-invoke): Don't set url-http-version to 1.0.
* soap-client.el (soap-decode-xs-complex-type): Allow choice nodes
to accept multiple values.
* soap-client.el (soap-encode-body): Check parameters argument for
extra header values.
* soap-client.el (soap-well-known-xmlns): Add wsa and wsaw tags.
(soap-operation): Add input-action and output-action slots.
(soap-parse-operation): Parse wsaw:Action nodes.
(soap-encode-body): Encode service-url for WS-Addressing.
(soap-create-envelope): Likewise.
(soap-invoke): Update soap-create-envelope call to provide
service-url argument.
* soap-client.el (soap-decode-xs-complex-type): Support xsi:type
override attribute.
(soap-decode-array): Likewise.
* soap-client.el (soap-parse-schema): Handle location attribute.
* soap-client.el (soap-decode-type): Check that multiRef matched
validation regexp.
* soap-client.el (soap-encode-xs-simple-type): Encode xsd:list
nodes.
(soap-decode-xs-simple-type): Decode xsd:list nodes.
* soap-client.el (soap-get-candidate-elements): Fix reference
handling.
* soap-client.el (soap-xs-simple-type): Add is-list slot.
(soap-xs-parse-simple-type): Call soap-xs-add-list for xsd:list
nodes.
(soap-xs-add-list): New function.
* soap-client.el (soap-encode-xs-element): When a boolean is
expected, interpret nil as "false".
* soap-client.el (soap-make-xs-basic-types): Add gYearMonth,
gYear, gMonthDay, gDay and gMonth.
* soap-client.el (soap-time-format): New variable.
(soap-encode-xs-basic-type): Handle dateTime, time, date,
gYearMonth, gYear, gMonthDay, gDay and gMonth.
(soap-decode-date-time): New function.
(soap-decode-xs-basic-type): Use soap-decode-date-time.
* soap-client.el (soap-encode-xs-basic-type): Validate value after
encoding.
(soap-decode-xs-basic-type): Validate value before decoding.
* soap-client.el (soap-validate-xs-basic-type): New function.
(soap-validate-xs-simple-type): Call soap-validate-xs-basic-type.
* soap-client.el (soap-xs-add-union): Append result to base
instead of overwriting it.
(soap-validate-xs-simple-type): Add union support.
* soap-client.el (soap-xs-add-restriction): Translate pattern to
Emacs regexp using xsdre-translate.
(soap-validate-xs-simple-type): Validate value against pattern.
* soap-client.el (soap-xs-add-union): Preserve WSDL order of
inline simpleType nodes.
(soap-decode-type): Handle union types.
* soap-client.el (soap-decode-xs-attributes): Decode basic-type
attributes.
* soap-client.el (soap-get-xs-attributes-from-groups): renamed
from soap-xs-attribute-group-consolidate, all callers updated
(soap-get-xs-attributes): renamed from
soap-xs-attributes-consolidate, all callers updated
* soap-client.el (soap-xs-type): Add attribute-group slot.
(soap-xs-attribute-group): New type.
(soap-xs-parse-attribute-group): New function.
(soap-resolve-references-for-xs-attribute-group): Likewise.
(soap-xs-add-extension): Handle attribute groups.
(soap-resolve-references-for-xs-simple-type): Likewise.
(soap-xs-parse-complex-type): Likewise.
(soap-xs-parse-extension-or-restriction): Likewise.
(soap-resolve-references-for-xs-complex-type): Likewise.
(soap-xs-attribute-group-consolidate): New function.
(soap-xs-attributes-consolidate): Handle attribute groups.
(soap-parse-schema): Likewise.
* soap-client.el (soap-encode-xs-basic-type): Fix boolean
encoding.
* soap-client.el (soap-encode-xs-complex-type): Print ref element
names in warnings.
* soap-client.el (soap-decode-xs-complex-type): Fix splicing.
* soap-client.el (soap-decode-xs-complex-type): Eliminate invalid
warnings for choice types.
* soap-client.el (soap-encode-xs-complex-type-attributes): Also
encode base type attributes.
* soap-client.el (soap-encode-xs-complex-type): Fix compilation
warning. Print e-name in warnings, or element if e-name is nil.
* soap-client.el (soap-xs-element): Add alternatives slot.
(soap-xs-parse-element): Set substitution-group.
(soap-resolve-references-for-xs-element): Populate alternatives
slot.
(soap-get-candidate-elements): New function.
(soap-encode-xs-complex-type): Iterate through all candidate
elements. Handle types with nil type indicator. Fix warning
logic.
* soap-client.el (soap-current-wsdl): moved declaration earlier in
the file to prevent compiler warning.
* soap-client.el (soap-node-optional): New function.
(soap-node-multiple): Likewise.
(soap-xs-parse-element): Call soap-node-optional and
soap-node-multiple.
(soap-xs-complex-type): Add optional? and multiple? slots.
(soap-xml-get-children-fq): New function.
(soap-xs-element-get-fq-name): Likewise.
(soap-xs-complex-type-optional-p): Likewise.
(soap-xs-complex-type-multiple-p): Likewise.
(soap-xs-attributes-consolidate): Likewise.
(soap-decode-xs-attributes): Likewise.
(soap-decode-xs-complex-type): Decode types with nil type
indicator. Support children that use local namespaces. Decode
attributes. Add type considerations to optional? and multiple?
warnings.
* soap-client.el (soap-xs-parse-extension-or-restriction): Store
parsed attributes.
(soap-encode-xs-complex-type-attributes): Encode custom
attributes.
* soap-client.el (soap-encode-xs-complex-type-attributes): don't
add the xsi:type attribute (Exchange refuses requests which have
this attribute)
* soap-client.el, soap-inspect.el: converted to lexical binding,
corrected compiler warnings about unused function arguments and
local variables.
* soap-client.el (soap-decode-xs-complex-type): Handle nil type
indicator.
(soap-parse-envelope): Handle response headers.
(soap-parse-response): Likewise. Only return non-nil decoded
values.
* soap-client.el (soap-validate-xs-simple-type): Return validated
value.
* soap-client.el (soap-xs-parse-element)
(soap-xs-parse-simple-type)
(soap-xs-parse-complex-type)
(soap-parse-message)
(soap-parse-operation): add the current namespace to the element
being created
(soap-resolve-references-for-xs-element)
(soap-resolve-references-for-xs-simple-type)
(soap-resolve-references-for-xs-complex-type)
(soap-resolve-references-for-operation): resolve the namespace to
the namespace tag
(soap-make-wsdl): specify a namespace tag when creating the xsd
and soapenc namespaces
(soap-wsdl-resolve-references): don't update namespace tags in
elements here
(soap-parse-port-type): bind the urn: to soap-target-xmlns
(soap-encode-body): don't add nil namespace tags to
soap-encoded-namespaces
* soap-inspect.el: use `soap-make-wsdl` to construct the object
for registering the soap-inspect method.Make debbugs tests pass
* soap-client.el (soap-decode-any-type): use soap-l2fq on the type
name, also skip string only nodes when decoding a structure.
(soap-xs-parse-complex-type): (BUG) dispatch parsing for choice
types too
(soap-encode-body): grab the header value from the param table
* soap-client.el (soap-should-encode-value-for-xs-element): new
function
(soap-encode-xs-element): don't encode nil value unless needed
* soap-client.el (soap-bound-operation): new slot `soap-body`
(soap-parse-binding): parse the message parts required in the body
(soap-encode-body): encode only the parts that are declared to be
part of the body
* soap-client.el (soap-encode-xs-element): use the fq name when
writing out the tag.
(soap-encode-body): remove hack that inserts the xmlns in the
element attributes list.
* soap-client.el (soap-xs-attribute): add "default" slot
(soap-xs-parse-attribute): default slot is set from the XML
"fixed" attribute.
(soap-encode-xs-complex-type-attributes): encode any attributes
that have a default value. Also, don't put the xsi:nil attribute
when the complex type has no content anyway.
* soap-client.el (soap-well-known-xmlns): add the xml namespace
(soap-local-xmlns): start with the xml namespace
(soap-xml-node-first-child): skip xsd:annotation nodes too
(soap-make-xs-basic-types): more xsd types added
(soap-encode-xs-basic-type, soap-decode-xs-basic-type): handle
"language", "time", "date", "nonNegativeInteger"
(soap-resolve-references-for-xs-element): don't signal an error if
the element does not have a type.
(soap-xs-parse-simple-type): subtypes are handled with ecase,
added stum for xsd:list
(soap-xs-add-union): call soap-l2fq on all union members
(soap-xs-add-extension): call soap-l2fq on the base member
(soap-resolve-references-for-xs-simple-type): don't signal an
error if the simple type has no base.
(soap-resolve-references-for-xs-simple-type): bugfix, call
soap-wsdl-get on each type of the base
* soap-client.el (soap-resolve-references-for-xs-attribute):
referenced type can be eiher a simple type or a basic type
(soap-xs-add-restriction)
(soap-xs-parse-extension-or-restriction): use `soap-l2fq' on base
(soap-make-xs-basic-types)
(soap-encode-xs-basic-type, soap-decode-xs-basic-type): add
support for more XMLSchema basic types
(soap-current-file, soap-xmlschema-imports): new defvars
(soap-parse-schema): add locations from xsd:import tags to
`soap-xmlschema-imports'
(soap-wsdl): make destructor private
(soap-make-wsdl): new defun, SOAP-WSDL object constructor
(soap-wsdl-add-alias): check if we try to replace aliases
(soap-fetch-xml-from-url, soap-fetch-xml-from-file)
(soap-fetch-xml): new defuns
(soap-load-wsdl): updated to load the WSDL from either a file or
an url
(soap-load-wsdl-from-url): now an alias to `soap-load-wsdl'
(soap-parse-wsdl): process wsdl:import tags and imports from
`soap-xmlschema-imports'
* soap-client.el (soap-l2wk): bugfix: call symbolp instead of
symbol-name
(soap-l2fq): make the name part always a string
(soap-name-p): new defun, used for name tests
* soap-inspect.el (soap-sample-value-for-xs-complex-type): supply
sample values for choice types with a special tag
* soap-client.el (soap-encode-xs-complex-type): handle anonymous
elements correctly
(soap-encode-value): accept nodes that have no namespace tag
* soap-client.el (soap-invoke): encode the string for
`url-request-data' as UTF-8. Fixes issue 16
Co-authored-by: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
2015-10-25 21:00:37 +00:00
|
|
|
|
;; Homepage: https://github.com/alex-hhh/emacs-soap-client
|
2017-05-24 18:32:00 +00:00
|
|
|
|
;; Package-Requires: ((cl-lib "0.6.1"))
|
2011-02-17 04:41:29 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2011-02-16 09:25:37 +00:00
|
|
|
|
;; 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.
|
|
|
|
|
|
2011-02-17 04:41:29 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2011-02-16 09:25:37 +00:00
|
|
|
|
;; 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
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
2011-02-16 19:33:35 +00:00
|
|
|
|
;;
|
2011-02-16 09:25:37 +00:00
|
|
|
|
;; To use the SOAP client, you first need to load the WSDL document for the
|
|
|
|
|
;; service you want to access, using `soap-load-wsdl-from-url'. A WSDL
|
|
|
|
|
;; document describes the available operations of the SOAP service, how their
|
|
|
|
|
;; parameters and responses are encoded. To invoke operations, you use the
|
|
|
|
|
;; `soap-invoke' method passing it the WSDL, the service name, the operation
|
|
|
|
|
;; you wish to invoke and any required parameters.
|
|
|
|
|
;;
|
2011-11-13 07:48:23 +00:00
|
|
|
|
;; Ideally, the service you want to access will have some documentation about
|
2011-02-16 09:25:37 +00:00
|
|
|
|
;; the operations it supports. If it does not, you can try using
|
|
|
|
|
;; `soap-inspect' to browse the WSDL document and see the available operations
|
|
|
|
|
;; and their parameters.
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2015-11-12 04:43:50 +00:00
|
|
|
|
(require 'cl-lib)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(require 'xml)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(require 'xsd-regexp)
|
|
|
|
|
(require 'rng-xsd)
|
|
|
|
|
(require 'rng-dt)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(require 'warnings)
|
|
|
|
|
(require 'url)
|
|
|
|
|
(require 'url-http)
|
|
|
|
|
(require 'url-util)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(require 'url-vars)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(require 'mm-decode)
|
|
|
|
|
|
|
|
|
|
(defsubst soap-warning (message &rest args)
|
2015-11-17 23:28:50 +00:00
|
|
|
|
"Display a warning MESSAGE with ARGS, using the `soap-client' warning type."
|
2015-11-12 04:43:50 +00:00
|
|
|
|
;; Do not use #'format-message, to support older Emacs versions.
|
|
|
|
|
(display-warning 'soap-client (apply #'format message args) :warning))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defgroup soap-client nil
|
|
|
|
|
"Access SOAP web services from Emacs."
|
Add missing :version tags to new defgroups and defcustoms
* window.el (window-sides-slots):
* tool-bar.el (tool-bar-position):
* term/xterm.el (xterm-extra-capabilities):
* ses.el (ses-self-reference-early-detection):
* progmodes/verilog-mode.el (verilog-auto-declare-nettype)
(verilog-auto-wire-type)
(verilog-auto-delete-trailing-whitespace)
(verilog-auto-reset-blocking-in-non, verilog-auto-inst-sort)
(verilog-auto-tieoff-declaration):
* progmodes/sql.el (sql-login-hook, sql-ansi-statement-starters)
(sql-oracle-statement-starters, sql-oracle-scan-on):
* progmodes/prolog.el (prolog-align-comments-flag)
(prolog-indent-mline-comments-flag, prolog-object-end-to-0-flag)
(prolog-left-indent-regexp, prolog-paren-indent-p)
(prolog-paren-indent, prolog-parse-mode, prolog-keywords)
(prolog-types, prolog-mode-specificators)
(prolog-determinism-specificators, prolog-directives)
(prolog-electric-newline-flag, prolog-hungry-delete-key-flag)
(prolog-electric-dot-flag)
(prolog-electric-dot-full-predicate-template)
(prolog-electric-underscore-flag, prolog-electric-tab-flag)
(prolog-electric-if-then-else-flag, prolog-electric-colon-flag)
(prolog-electric-dash-flag, prolog-old-sicstus-keys-flag)
(prolog-program-switches, prolog-prompt-regexp)
(prolog-debug-on-string, prolog-debug-off-string)
(prolog-trace-on-string, prolog-trace-off-string)
(prolog-zip-on-string, prolog-zip-off-string)
(prolog-use-standard-consult-compile-method-flag)
(prolog-use-prolog-tokenizer-flag, prolog-imenu-flag)
(prolog-imenu-max-lines, prolog-info-predicate-index)
(prolog-underscore-wordchar-flag, prolog-use-sicstus-sd)
(prolog-char-quote-workaround):
* progmodes/cc-vars.el (c-defun-tactic):
* net/tramp.el (tramp-encoding-command-interactive)
(tramp-local-end-of-line):
* net/soap-client.el (soap-client):
* net/netrc.el (netrc-file):
* net/gnutls.el (gnutls):
* minibuffer.el (completion-category-overrides)
(completion-cycle-threshold)
(completion-pcm-complete-word-inserts-delimiters):
* man.el (Man-name-local-regexp):
* mail/feedmail.el (feedmail-display-full-frame):
* international/characters.el (glyphless-char-display-control):
* eshell/em-ls.el (eshell-ls-date-format):
* emacs-lisp/cl-indent.el (lisp-lambda-list-keyword-alignment)
(lisp-lambda-list-keyword-parameter-indentation)
(lisp-lambda-list-keyword-parameter-alignment):
* doc-view.el (doc-view-image-width, doc-view-unoconv-program):
* dired-x.el (dired-omit-verbose):
* cus-theme.el (custom-theme-allow-multiple-selections):
* calc/calc.el (calc-highlight-selections-with-faces)
(calc-lu-field-reference, calc-lu-power-reference)
(calc-note-threshold):
* battery.el (battery-mode-line-limit):
* arc-mode.el (archive-7z-extract, archive-7z-expunge)
(archive-7z-update):
* allout.el (allout-prefixed-keybindings)
(allout-unprefixed-keybindings)
(allout-inhibit-auto-fill-on-headline)
(allout-flattened-numbering-abbreviation):
* allout-widgets.el (allout-widgets-auto-activation)
(allout-widgets-icons-dark-subdir)
(allout-widgets-icons-light-subdir, allout-widgets-icon-types)
(allout-widgets-theme-dark-background)
(allout-widgets-theme-light-background)
(allout-widgets-item-image-properties-emacs)
(allout-widgets-item-image-properties-xemacs)
(allout-widgets-run-unit-tests-on-load)
(allout-widgets-time-decoration-activity)
(allout-widgets-hook-error-post-time)
(allout-widgets-track-decoration):
* gnus/sieve-manage.el (sieve-manage-default-stream):
* gnus/shr.el (shr):
* gnus/nnir.el (nnir-ignored-newsgroups, nnir-summary-line-format)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-notmuch-program)
(nnir-notmuch-additional-switches, nnir-notmuch-remove-prefix)
(nnir-method-default-engines):
* gnus/message.el (message-cite-reply-position):
* gnus/gssapi.el (gssapi-program):
* gnus/gravatar.el (gravatar):
* gnus/gnus-sum.el (gnus-refer-thread-use-nnir):
* gnus/gnus-registry.el (gnus-registry-unfollowed-addresses)
(gnus-registry-max-pruned-entries):
* gnus/gnus-picon.el (gnus-picon-inhibit-top-level-domains):
* gnus/gnus-int.el (gnus-after-set-mark-hook)
(gnus-before-update-mark-hook):
* gnus/gnus-async.el (gnus-async-post-fetch-function):
* gnus/auth-source.el (auth-source-cache-expiry):
Add missing :version tags to new defcustoms and defgroups.
2012-02-11 22:13:29 +00:00
|
|
|
|
:version "24.1"
|
2011-02-16 09:25:37 +00:00
|
|
|
|
:group 'tools)
|
|
|
|
|
|
|
|
|
|
;;;; Support for parsing XML documents with namespaces
|
|
|
|
|
|
|
|
|
|
;; XML documents with namespaces are difficult to parse because the names of
|
|
|
|
|
;; the nodes depend on what "xmlns" aliases have been defined in the document.
|
|
|
|
|
;; To work with such documents, we introduce a translation layer between a
|
|
|
|
|
;; "well known" namespace tag and the local namespace tag in the document
|
|
|
|
|
;; being parsed.
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(defconst soap-well-known-xmlns
|
2011-02-16 09:25:37 +00:00
|
|
|
|
'(("apachesoap" . "http://xml.apache.org/xml-soap")
|
|
|
|
|
("soapenc" . "http://schemas.xmlsoap.org/soap/encoding/")
|
|
|
|
|
("wsdl" . "http://schemas.xmlsoap.org/wsdl/")
|
|
|
|
|
("wsdlsoap" . "http://schemas.xmlsoap.org/wsdl/soap/")
|
|
|
|
|
("xsd" . "http://www.w3.org/2001/XMLSchema")
|
|
|
|
|
("xsi" . "http://www.w3.org/2001/XMLSchema-instance")
|
2015-10-24 12:33:18 +00:00
|
|
|
|
("wsa" . "http://www.w3.org/2005/08/addressing")
|
|
|
|
|
("wsaw" . "http://www.w3.org/2006/05/addressing/wsdl")
|
2011-02-16 09:25:37 +00:00
|
|
|
|
("soap" . "http://schemas.xmlsoap.org/soap/envelope/")
|
|
|
|
|
("soap12" . "http://schemas.xmlsoap.org/wsdl/soap12/")
|
|
|
|
|
("http" . "http://schemas.xmlsoap.org/wsdl/http/")
|
2015-10-24 12:33:18 +00:00
|
|
|
|
("mime" . "http://schemas.xmlsoap.org/wsdl/mime/")
|
|
|
|
|
("xml" . "http://www.w3.org/XML/1998/namespace"))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"A list of well known xml namespaces and their aliases.")
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defvar soap-local-xmlns
|
|
|
|
|
'(("xml" . "http://www.w3.org/XML/1998/namespace"))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"A list of local namespace aliases.
|
|
|
|
|
This is a dynamically bound variable, controlled by
|
|
|
|
|
`soap-with-local-xmlns'.")
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(defvar soap-default-xmlns nil
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"The default XML namespaces.
|
|
|
|
|
Names in this namespace will be unqualified. This is a
|
|
|
|
|
dynamically bound variable, controlled by
|
|
|
|
|
`soap-with-local-xmlns'")
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(defvar soap-target-xmlns nil
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"The target XML namespace.
|
|
|
|
|
New XSD elements will be defined in this namespace, unless they
|
|
|
|
|
are fully qualified for a different namespace. This is a
|
|
|
|
|
dynamically bound variable, controlled by
|
|
|
|
|
`soap-with-local-xmlns'")
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defvar soap-current-wsdl nil
|
|
|
|
|
"The current WSDL document used when decoding the SOAP response.
|
|
|
|
|
This is a dynamically bound variable.")
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(defun soap-wk2l (well-known-name)
|
|
|
|
|
"Return local variant of WELL-KNOWN-NAME.
|
|
|
|
|
This is done by looking up the namespace in the
|
2011-02-16 19:56:31 +00:00
|
|
|
|
`soap-well-known-xmlns' table and resolving the namespace to
|
2011-02-16 09:25:37 +00:00
|
|
|
|
the local name based on the current local translation table
|
2011-02-16 19:56:31 +00:00
|
|
|
|
`soap-local-xmlns'. See also `soap-with-local-xmlns'."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((wk-name-1 (if (symbolp well-known-name)
|
|
|
|
|
(symbol-name well-known-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
well-known-name)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(cond
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((string-match "^\\(.*\\):\\(.*\\)$" wk-name-1)
|
|
|
|
|
(let ((ns (match-string 1 wk-name-1))
|
|
|
|
|
(name (match-string 2 wk-name-1)))
|
|
|
|
|
(let ((namespace (cdr (assoc ns soap-well-known-xmlns))))
|
|
|
|
|
(cond ((equal namespace soap-default-xmlns)
|
|
|
|
|
;; Name is unqualified in the default namespace
|
|
|
|
|
(if (symbolp well-known-name)
|
|
|
|
|
(intern name)
|
|
|
|
|
name))
|
|
|
|
|
(t
|
|
|
|
|
(let* ((local-ns (car (rassoc namespace soap-local-xmlns)))
|
|
|
|
|
(local-name (concat local-ns ":" name)))
|
|
|
|
|
(if (symbolp well-known-name)
|
|
|
|
|
(intern local-name)
|
|
|
|
|
local-name)))))))
|
|
|
|
|
(t well-known-name))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-l2wk (local-name)
|
|
|
|
|
"Convert LOCAL-NAME into a well known name.
|
|
|
|
|
The namespace of LOCAL-NAME is looked up in the
|
2011-02-16 19:56:31 +00:00
|
|
|
|
`soap-well-known-xmlns' table and a well known namespace tag is
|
2011-02-16 09:25:37 +00:00
|
|
|
|
used in the name.
|
|
|
|
|
|
|
|
|
|
nil is returned if there is no well-known namespace for the
|
|
|
|
|
namespace of LOCAL-NAME."
|
|
|
|
|
(let ((l-name-1 (if (symbolp local-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(symbol-name local-name)
|
|
|
|
|
local-name))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
namespace name)
|
|
|
|
|
(cond
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((string-match "^\\(.*\\):\\(.*\\)$" l-name-1)
|
|
|
|
|
(setq name (match-string 2 l-name-1))
|
|
|
|
|
(let ((ns (match-string 1 l-name-1)))
|
|
|
|
|
(setq namespace (cdr (assoc ns soap-local-xmlns)))
|
|
|
|
|
(unless namespace
|
|
|
|
|
(error "Soap-l2wk(%s): no namespace for alias %s" local-name ns))))
|
|
|
|
|
(t
|
|
|
|
|
(setq name l-name-1)
|
|
|
|
|
(setq namespace soap-default-xmlns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(if namespace
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let ((well-known-ns (car (rassoc namespace soap-well-known-xmlns))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if well-known-ns
|
|
|
|
|
(let ((well-known-name (concat well-known-ns ":" name)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(if (symbolp local-name)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(intern well-known-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
well-known-name))
|
|
|
|
|
nil))
|
|
|
|
|
;; if no namespace is defined, just return the unqualified name
|
|
|
|
|
name)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-l2fq (local-name &optional use-tns)
|
|
|
|
|
"Convert LOCAL-NAME into a fully qualified name.
|
|
|
|
|
A fully qualified name is a cons of the namespace name and the
|
|
|
|
|
name of the element itself. For example \"xsd:string\" is
|
2015-10-24 12:33:18 +00:00
|
|
|
|
converted to (\"http://www.w3.org/2001/XMLSchema\" . \"string\").
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
The USE-TNS argument specifies what to do when LOCAL-NAME has no
|
2011-02-16 19:56:31 +00:00
|
|
|
|
namespace tag. If USE-TNS is non-nil, the `soap-target-xmlns'
|
2011-02-16 09:25:37 +00:00
|
|
|
|
will be used as the element's namespace, otherwise
|
2011-02-16 19:56:31 +00:00
|
|
|
|
`soap-default-xmlns' will be used.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
This is needed because different parts of a WSDL document can use
|
|
|
|
|
different namespace aliases for the same element."
|
|
|
|
|
(let ((local-name-1 (if (symbolp local-name)
|
|
|
|
|
(symbol-name local-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
local-name)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(cond ((string-match "^\\(.*\\):\\(.*\\)$" local-name-1)
|
|
|
|
|
(let ((ns (match-string 1 local-name-1))
|
|
|
|
|
(name (match-string 2 local-name-1)))
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let ((namespace (cdr (assoc ns soap-local-xmlns))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if namespace
|
|
|
|
|
(cons namespace name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(error "Soap-l2fq(%s): unknown alias %s" local-name ns)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(t
|
|
|
|
|
(cons (if use-tns
|
2011-02-16 19:56:31 +00:00
|
|
|
|
soap-target-xmlns
|
2015-10-24 12:33:18 +00:00
|
|
|
|
soap-default-xmlns)
|
|
|
|
|
local-name-1)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-name-p (name)
|
2017-06-14 00:56:25 +00:00
|
|
|
|
"Return t if NAME is a valid name for XMLSchema types.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
A valid name is either a string or a cons of (NAMESPACE . NAME)."
|
|
|
|
|
(or (stringp name)
|
|
|
|
|
(and (consp name)
|
|
|
|
|
(stringp (car name))
|
|
|
|
|
(stringp (cdr name)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-extract-xmlns (node &optional xmlns-table)
|
|
|
|
|
"Return a namespace alias table for NODE by extending XMLNS-TABLE."
|
|
|
|
|
(let (xmlns default-ns target-ns)
|
|
|
|
|
(dolist (a (xml-node-attributes node))
|
|
|
|
|
(let ((name (symbol-name (car a)))
|
|
|
|
|
(value (cdr a)))
|
|
|
|
|
(cond ((string= name "targetNamespace")
|
|
|
|
|
(setq target-ns value))
|
|
|
|
|
((string= name "xmlns")
|
|
|
|
|
(setq default-ns value))
|
|
|
|
|
((string-match "^xmlns:\\(.*\\)$" name)
|
|
|
|
|
(push (cons (match-string 1 name) value) xmlns)))))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((tns (assoc "tns" xmlns)))
|
|
|
|
|
(cond ((and tns target-ns)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
;; If a tns alias is defined for this node, it must match
|
|
|
|
|
;; the target namespace.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(unless (equal target-ns (cdr tns))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(soap-warning
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"soap-extract-xmlns(%s): tns alias and targetNamespace mismatch"
|
|
|
|
|
(xml-node-name node))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
((and tns (not target-ns))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(setq target-ns (cdr tns)))))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(list default-ns target-ns (append xmlns xmlns-table))))
|
|
|
|
|
|
|
|
|
|
(defmacro soap-with-local-xmlns (node &rest body)
|
|
|
|
|
"Install a local alias table from NODE and execute BODY."
|
|
|
|
|
(declare (debug (form &rest form)) (indent 1))
|
|
|
|
|
(let ((xmlns (make-symbol "xmlns")))
|
2011-02-16 19:56:31 +00:00
|
|
|
|
`(let ((,xmlns (soap-extract-xmlns ,node soap-local-xmlns)))
|
|
|
|
|
(let ((soap-default-xmlns (or (nth 0 ,xmlns) soap-default-xmlns))
|
|
|
|
|
(soap-target-xmlns (or (nth 1 ,xmlns) soap-target-xmlns))
|
|
|
|
|
(soap-local-xmlns (nth 2 ,xmlns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
,@body))))
|
|
|
|
|
|
|
|
|
|
(defun soap-get-target-namespace (node)
|
|
|
|
|
"Return the target namespace of NODE.
|
|
|
|
|
This is the namespace in which new elements will be defined."
|
|
|
|
|
(or (xml-get-attribute-or-nil node 'targetNamespace)
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(cdr (assoc "tns" soap-local-xmlns))
|
|
|
|
|
soap-target-xmlns))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-xml-get-children1 (node child-name)
|
|
|
|
|
"Return the children of NODE named CHILD-NAME.
|
|
|
|
|
This is the same as `xml-get-children', but CHILD-NAME can have
|
|
|
|
|
namespace tag."
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (c (xml-node-children node))
|
|
|
|
|
(when (and (consp c)
|
|
|
|
|
(soap-with-local-xmlns c
|
|
|
|
|
;; We use `ignore-errors' here because we want to silently
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; skip nodes when we cannot convert them to a well-known
|
|
|
|
|
;; name.
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(eq (ignore-errors (soap-l2wk (xml-node-name c)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
child-name)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(push c result)))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-xml-node-find-matching-child (node set)
|
|
|
|
|
"Return the first child of NODE whose name is a member of SET."
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (child (xml-node-children node))
|
|
|
|
|
(when (and (consp child)
|
|
|
|
|
(memq (soap-l2wk (xml-node-name child)) set))
|
|
|
|
|
(throw 'found child)))))
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(defun soap-xml-get-attribute-or-nil1 (node attribute)
|
|
|
|
|
"Return the NODE's ATTRIBUTE, or nil if it does not exist.
|
|
|
|
|
This is the same as `xml-get-attribute-or-nil', but ATTRIBUTE can
|
|
|
|
|
be tagged with a namespace tag."
|
|
|
|
|
(catch 'found
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
(dolist (a (xml-node-attributes node))
|
|
|
|
|
;; We use `ignore-errors' here because we want to silently skip
|
|
|
|
|
;; attributes for which we cannot convert them to a well-known name.
|
|
|
|
|
(when (eq (ignore-errors (soap-l2wk (car a))) attribute)
|
|
|
|
|
(throw 'found (cdr a)))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; XML namespaces
|
|
|
|
|
|
|
|
|
|
;; An element in an XML namespace, "things" stored in soap-xml-namespaces will
|
|
|
|
|
;; be derived from this object.
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct soap-element
|
2011-02-16 09:25:37 +00:00
|
|
|
|
name
|
|
|
|
|
;; The "well-known" namespace tag for the element. For example, while
|
|
|
|
|
;; parsing XML documents, we can have different tags for the XMLSchema
|
|
|
|
|
;; namespace, but internally all our XMLSchema elements will have the "xsd"
|
|
|
|
|
;; tag.
|
|
|
|
|
namespace-tag)
|
|
|
|
|
|
|
|
|
|
(defun soap-element-fq-name (element)
|
|
|
|
|
"Return a fully qualified name for ELEMENT.
|
|
|
|
|
A fq name is the concatenation of the namespace tag and the
|
|
|
|
|
element name."
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(cond ((soap-element-namespace-tag element)
|
|
|
|
|
(concat (soap-element-namespace-tag element)
|
|
|
|
|
":" (soap-element-name element)))
|
|
|
|
|
((soap-element-name element)
|
|
|
|
|
(soap-element-name element))
|
|
|
|
|
(t
|
|
|
|
|
"*unnamed*")))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;; a namespace link stores an alias for an object in once namespace to a
|
|
|
|
|
;; "target" object possibly in a different namespace
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-namespace-link (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
target)
|
|
|
|
|
|
|
|
|
|
;; A namespace is a collection of soap-element objects under a name (the name
|
|
|
|
|
;; of the namespace).
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct soap-namespace
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(name nil :read-only t) ; e.g "http://xml.apache.org/xml-soap"
|
|
|
|
|
(elements (make-hash-table :test 'equal) :read-only t))
|
|
|
|
|
|
|
|
|
|
(defun soap-namespace-put (element ns)
|
|
|
|
|
"Store ELEMENT in NS.
|
|
|
|
|
Multiple elements with the same name can be stored in a
|
|
|
|
|
namespace. When retrieving the element you can specify a
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-20 22:27:53 +00:00
|
|
|
|
discriminant predicate to `soap-namespace-get'."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((name (soap-element-name element)))
|
|
|
|
|
(push element (gethash name (soap-namespace-elements ns)))))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-namespace-put-link (name target ns)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"Store a link from NAME to TARGET in NS.
|
|
|
|
|
TARGET can be either a SOAP-ELEMENT or a string denoting an
|
|
|
|
|
element name into another namespace.
|
|
|
|
|
|
|
|
|
|
If NAME is nil, an element with the same name as TARGET will be
|
|
|
|
|
added to the namespace."
|
|
|
|
|
|
|
|
|
|
(unless (and name (not (equal name "")))
|
|
|
|
|
;; if name is nil, use TARGET as a name...
|
|
|
|
|
(cond ((soap-element-p target)
|
|
|
|
|
(setq name (soap-element-name target)))
|
2011-03-05 10:32:10 +00:00
|
|
|
|
((consp target) ; a fq name: (namespace . name)
|
|
|
|
|
(setq name (cdr target)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
((stringp target)
|
|
|
|
|
(cond ((string-match "^\\(.*\\):\\(.*\\)$" target)
|
|
|
|
|
(setq name (match-string 2 target)))
|
|
|
|
|
(t
|
|
|
|
|
(setq name target))))))
|
|
|
|
|
|
2011-03-05 10:32:10 +00:00
|
|
|
|
;; by now, name should be valid
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (and name (not (equal name "")))
|
|
|
|
|
nil
|
|
|
|
|
"Cannot determine name for namespace link")
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(push (make-soap-namespace-link :name name :target target)
|
|
|
|
|
(gethash name (soap-namespace-elements ns))))
|
|
|
|
|
|
|
|
|
|
(defun soap-namespace-get (name ns &optional discriminant-predicate)
|
|
|
|
|
"Retrieve an element with NAME from the namespace NS.
|
|
|
|
|
If multiple elements with the same name exist,
|
|
|
|
|
DISCRIMINANT-PREDICATE is used to pick one of them. This allows
|
|
|
|
|
storing elements of different types (like a message type and a
|
|
|
|
|
binding) but the same name."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (stringp name))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((elements (gethash name (soap-namespace-elements ns))))
|
|
|
|
|
(cond (discriminant-predicate
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (e elements)
|
|
|
|
|
(when (funcall discriminant-predicate e)
|
|
|
|
|
(throw 'found e)))))
|
|
|
|
|
((= (length elements) 1) (car elements))
|
|
|
|
|
((> (length elements) 1)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(error
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"Soap-namespace-get(%s): multiple elements, discriminant needed"
|
|
|
|
|
name))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(t
|
|
|
|
|
nil))))
|
|
|
|
|
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;;;; XML Schema
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; SOAP WSDL documents use XML Schema to define the types that are part of the
|
|
|
|
|
;; message exchange. We include here an XML schema model with a parser and
|
2015-11-10 18:22:29 +00:00
|
|
|
|
;; serializer/deserializer.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-type (:include soap-element))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
id
|
|
|
|
|
attributes
|
|
|
|
|
attribute-groups)
|
2012-04-25 10:28:29 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;;;;; soap-xs-basic-type
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-basic-type (:include soap-xs-type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; Basic types are "built in" and we know how to handle them directly.
|
|
|
|
|
;; Other type definitions reference basic types, so we need to create them
|
|
|
|
|
;; in a namespace (see `soap-make-xs-basic-types')
|
|
|
|
|
|
|
|
|
|
;; a symbol of: string, dateTime, long, int, etc
|
|
|
|
|
kind
|
2011-02-16 09:25:37 +00:00
|
|
|
|
)
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-make-xs-basic-types (namespace-name &optional namespace-tag)
|
|
|
|
|
"Construct NAMESPACE-NAME containing the XMLSchema basic types.
|
|
|
|
|
An optional NAMESPACE-TAG can also be specified."
|
|
|
|
|
(let ((ns (make-soap-namespace :name namespace-name)))
|
|
|
|
|
(dolist (type '("string" "language" "ID" "IDREF"
|
|
|
|
|
"dateTime" "time" "date" "boolean"
|
|
|
|
|
"gYearMonth" "gYear" "gMonthDay" "gDay" "gMonth"
|
|
|
|
|
"long" "short" "int" "integer" "nonNegativeInteger"
|
|
|
|
|
"unsignedLong" "unsignedShort" "unsignedInt"
|
|
|
|
|
"decimal" "duration"
|
|
|
|
|
"byte" "unsignedByte"
|
|
|
|
|
"float" "double"
|
|
|
|
|
"base64Binary" "anyType" "anyURI" "QName" "Array" "byte[]"))
|
|
|
|
|
(soap-namespace-put
|
|
|
|
|
(make-soap-xs-basic-type :name type
|
|
|
|
|
:namespace-tag namespace-tag
|
|
|
|
|
:kind (intern type))
|
|
|
|
|
ns))
|
|
|
|
|
ns))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-basic-type-attributes (value type)
|
|
|
|
|
"Encode the XML attributes for VALUE according to TYPE.
|
|
|
|
|
The xsi:type and an optional xsi:nil attributes are added. The
|
|
|
|
|
attributes are inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-attributes' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
|
|
|
|
(let ((xsi-type (soap-element-fq-name type))
|
|
|
|
|
(basic-type (soap-xs-basic-type-kind type)))
|
|
|
|
|
;; try to classify the type based on the value type and use that type when
|
|
|
|
|
;; encoding
|
|
|
|
|
(when (eq basic-type 'anyType)
|
|
|
|
|
(cond ((stringp value)
|
|
|
|
|
(setq xsi-type "xsd:string" basic-type 'string))
|
|
|
|
|
((integerp value)
|
|
|
|
|
(setq xsi-type "xsd:int" basic-type 'int))
|
|
|
|
|
((memq value '(t nil))
|
|
|
|
|
(setq xsi-type "xsd:boolean" basic-type 'boolean))
|
|
|
|
|
(t
|
|
|
|
|
(error "Cannot classify anyType value"))))
|
|
|
|
|
|
|
|
|
|
(insert " xsi:type=\"" xsi-type "\"")
|
|
|
|
|
;; We have some ambiguity here, as a nil value represents "false" when the
|
|
|
|
|
;; type is boolean, we will never have a "nil" boolean type...
|
|
|
|
|
(unless (or value (eq basic-type 'boolean))
|
|
|
|
|
(insert " xsi:nil=\"true\""))))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-basic-type (value type)
|
|
|
|
|
"Encode the VALUE according to TYPE.
|
|
|
|
|
The data is inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-value' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
2019-07-24 08:45:07 +00:00
|
|
|
|
(let ((kind (soap-xs-basic-type-kind type))
|
|
|
|
|
;; Handle conversions of this form:
|
|
|
|
|
;; (Element (AttrA . "A") (AttrB . "B") "Value here")
|
|
|
|
|
;; to:
|
|
|
|
|
;; <ns:Element AttrA="A" AttrB="B">Value here</ns:Element>
|
|
|
|
|
;; by assuming that if this is a list, it must have attributes
|
|
|
|
|
;; preceding the basic value.
|
|
|
|
|
(value (if (listp value) (progn (car (last value))) value)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when (eq kind 'anyType)
|
|
|
|
|
(cond ((stringp value)
|
|
|
|
|
(setq kind 'string))
|
|
|
|
|
((integerp value)
|
|
|
|
|
(setq kind 'int))
|
|
|
|
|
((memq value '(t nil))
|
|
|
|
|
(setq kind 'boolean))
|
|
|
|
|
(t
|
|
|
|
|
(error "Cannot classify anyType value"))))
|
|
|
|
|
|
|
|
|
|
;; NOTE: a nil value is not encoded, as an xsi:nil="true" attribute was
|
|
|
|
|
;; encoded for it. However, we have some ambiguity here, as a nil value
|
|
|
|
|
;; also represents "false" when the type is boolean...
|
|
|
|
|
|
|
|
|
|
(when (or value (eq kind 'boolean))
|
|
|
|
|
(let ((value-string
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case kind
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((string anyURI QName ID IDREF language)
|
|
|
|
|
(unless (stringp value)
|
|
|
|
|
(error "Not a string value: %s" value))
|
|
|
|
|
(url-insert-entities-in-string value))
|
|
|
|
|
((dateTime time date gYearMonth gYear gMonthDay gDay gMonth)
|
|
|
|
|
(cond ((consp value)
|
|
|
|
|
;; Value is a (current-time) style value,
|
|
|
|
|
;; convert to the ISO 8601-inspired XSD
|
|
|
|
|
;; string format in UTC.
|
|
|
|
|
(format-time-string
|
|
|
|
|
(concat
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-ecase kind
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dateTime "%Y-%m-%dT%H:%M:%S")
|
|
|
|
|
(time "%H:%M:%S")
|
|
|
|
|
(date "%Y-%m-%d")
|
|
|
|
|
(gYearMonth "%Y-%m")
|
|
|
|
|
(gYear "%Y")
|
|
|
|
|
(gMonthDay "--%m-%d")
|
|
|
|
|
(gDay "---%d")
|
|
|
|
|
(gMonth "--%m"))
|
|
|
|
|
;; Internal time is always in UTC.
|
|
|
|
|
"Z")
|
|
|
|
|
value t))
|
|
|
|
|
((stringp value)
|
|
|
|
|
;; Value is a string in the ISO 8601-inspired XSD
|
|
|
|
|
;; format. Validate it.
|
|
|
|
|
(soap-decode-date-time value kind)
|
|
|
|
|
(url-insert-entities-in-string value))
|
|
|
|
|
(t
|
|
|
|
|
(error "Invalid date-time format"))))
|
|
|
|
|
(boolean
|
|
|
|
|
(unless (memq value '(t nil))
|
|
|
|
|
(error "Not a boolean value"))
|
|
|
|
|
(if value "true" "false"))
|
|
|
|
|
|
|
|
|
|
((long short int integer byte unsignedInt unsignedLong
|
|
|
|
|
unsignedShort nonNegativeInteger decimal duration)
|
|
|
|
|
(unless (integerp value)
|
|
|
|
|
(error "Not an integer value"))
|
|
|
|
|
(when (and (memq kind '(unsignedInt unsignedLong
|
|
|
|
|
unsignedShort
|
|
|
|
|
nonNegativeInteger))
|
|
|
|
|
(< value 0))
|
|
|
|
|
(error "Not a positive integer"))
|
|
|
|
|
(number-to-string value))
|
|
|
|
|
|
|
|
|
|
((float double)
|
|
|
|
|
(unless (numberp value)
|
|
|
|
|
(error "Not a number"))
|
|
|
|
|
(number-to-string value))
|
|
|
|
|
|
|
|
|
|
(base64Binary
|
|
|
|
|
(unless (stringp value)
|
|
|
|
|
(error "Not a string value for base64Binary"))
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(base64-encode-string value))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(otherwise
|
|
|
|
|
(error "Don't know how to encode %s for type %s"
|
|
|
|
|
value (soap-element-fq-name type))))))
|
|
|
|
|
(soap-validate-xs-basic-type value-string type)
|
|
|
|
|
(insert value-string)))))
|
|
|
|
|
|
|
|
|
|
;; Inspired by rng-xsd-convert-date-time.
|
|
|
|
|
(defun soap-decode-date-time (date-time-string datatype)
|
|
|
|
|
"Decode DATE-TIME-STRING as DATATYPE.
|
|
|
|
|
DATE-TIME-STRING should be in ISO 8601 basic or extended format.
|
|
|
|
|
DATATYPE is one of dateTime, time, date, gYearMonth, gYear,
|
|
|
|
|
gMonthDay, gDay or gMonth.
|
|
|
|
|
|
|
|
|
|
Return a list in a format (SEC MINUTE HOUR DAY MONTH YEAR
|
|
|
|
|
SEC-FRACTION DATATYPE ZONE). This format is meant to be similar
|
|
|
|
|
to that returned by `decode-time' (and compatible with
|
More-compatible subsecond calendrical timestamps
Instead of appending a subseconds member to the result of
‘decode-time’, this keeps the format unchanged unless you give
a new optional argument to ‘decode-time’. Also, the augmented
format now puts the subsecond info in the SECONDS element, so
the total number of elements is unchanged; this is more
compatible with code that expects the traditional 9 elements,
such as ‘(pcase decoded-time (`(,SEC ,MIN ,HOUR ,DAY ,MON
,YEAR ,DOW ,DST ,ZONE) ...) ...)’.
* doc/lispref/os.texi, doc/misc/emacs-mime.texi, etc/NEWS:
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/simple.el (decoded-time):
Document the new behavior.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
* lisp/calendar/iso8601.el (iso8601-parse)
(iso8601-parse-time, iso8601-parse-duration)
(iso8601--decoded-time):
* lisp/calendar/parse-time.el (parse-time-string):
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-second):
* lisp/org/org.el (org-parse-time-string):
* lisp/simple.el (decoded-time):
* src/timefns.c (Fdecode_time, Fencode_time):
* test/lisp/calendar/icalendar-tests.el:
(icalendar--decode-isodatetime):
* test/lisp/calendar/iso8601-tests.el (test-iso8601-date-years)
(test-iso8601-date-dates, test-iso8601-date-obsolete)
(test-iso8601-date-weeks, test-iso8601-date-ordinals)
(test-iso8601-time, test-iso8601-combined)
(test-iso8601-duration, test-iso8601-intervals)
(standard-test-dates, standard-test-time-of-day-fractions)
(standard-test-time-of-day-beginning-of-day)
(standard-test-time-of-day-utc)
(standard-test-time-of-day-zone)
(standard-test-date-and-time-of-day, standard-test-interval):
* test/lisp/calendar/parse-time-tests.el (parse-time-tests):
* test/src/timefns-tests.el (format-time-string-with-zone)
(encode-time-dst-numeric-zone):
Revert recent changes that added a SUBSECS member to
calendrical timestamps, since that component is no longer
present (the info, if any, is now in the SECONDS member).
* lisp/calendar/time-date.el (decoded-time-add)
(decoded-time--alter-second):
Support fractional seconds in the new form. Simplify.
* src/timefns.c (Fdecode_time): Support new arg FORM.
(Fencode_time): Support subsecond resolution.
* test/src/timefns-tests.el (format-time-string-with-zone)
(decode-then-encode-time): Test subsecond calendrical timestamps.
2019-08-17 05:09:04 +00:00
|
|
|
|
`encode-time'). The differences are the SEC (seconds)
|
|
|
|
|
field is always an integer, the DOW (day-of-week) field
|
2015-10-24 12:33:18 +00:00
|
|
|
|
is replaced with SEC-FRACTION, a float representing the
|
|
|
|
|
fractional seconds, and the DST (daylight savings time) field is
|
|
|
|
|
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.
|
2015-11-17 23:28:50 +00:00
|
|
|
|
For example a datatype of `time' means the year, month and day
|
2015-10-24 12:33:18 +00:00
|
|
|
|
fields should be ignored.
|
|
|
|
|
|
|
|
|
|
This function will throw an error if DATE-TIME-STRING represents
|
|
|
|
|
a leap second, since the XML Schema 1.1 standard explicitly
|
|
|
|
|
disallows them."
|
|
|
|
|
(let* ((datetime-regexp (cadr (get datatype 'rng-xsd-convert)))
|
|
|
|
|
(year-sign (progn
|
|
|
|
|
(string-match datetime-regexp date-time-string)
|
|
|
|
|
(match-string 1 date-time-string)))
|
|
|
|
|
(year (match-string 2 date-time-string))
|
|
|
|
|
(month (match-string 3 date-time-string))
|
|
|
|
|
(day (match-string 4 date-time-string))
|
|
|
|
|
(hour (match-string 5 date-time-string))
|
|
|
|
|
(minute (match-string 6 date-time-string))
|
|
|
|
|
(second (match-string 7 date-time-string))
|
|
|
|
|
(second-fraction (match-string 8 date-time-string))
|
|
|
|
|
(has-time-zone (match-string 9 date-time-string))
|
|
|
|
|
(time-zone-sign (match-string 10 date-time-string))
|
|
|
|
|
(time-zone-hour (match-string 11 date-time-string))
|
|
|
|
|
(time-zone-minute (match-string 12 date-time-string)))
|
|
|
|
|
(setq year-sign (if year-sign -1 1))
|
|
|
|
|
(setq year
|
|
|
|
|
(if year
|
|
|
|
|
(* year-sign
|
|
|
|
|
(string-to-number year))
|
|
|
|
|
;; By defaulting to the epoch date, a time value can be treated as
|
|
|
|
|
;; a relative number of seconds.
|
|
|
|
|
1970))
|
|
|
|
|
(setq month
|
|
|
|
|
(if month (string-to-number month) 1))
|
|
|
|
|
(setq day
|
|
|
|
|
(if day (string-to-number day) 1))
|
|
|
|
|
(setq hour
|
|
|
|
|
(if hour (string-to-number hour) 0))
|
|
|
|
|
(setq minute
|
|
|
|
|
(if minute (string-to-number minute) 0))
|
|
|
|
|
(setq second
|
|
|
|
|
(if second (string-to-number second) 0))
|
|
|
|
|
(setq second-fraction
|
|
|
|
|
(if second-fraction
|
|
|
|
|
(float (string-to-number second-fraction))
|
|
|
|
|
0.0))
|
|
|
|
|
(setq has-time-zone (and has-time-zone t))
|
|
|
|
|
(setq time-zone-sign
|
|
|
|
|
(if (equal time-zone-sign "-") -1 1))
|
|
|
|
|
(setq time-zone-hour
|
|
|
|
|
(if time-zone-hour (string-to-number time-zone-hour) 0))
|
|
|
|
|
(setq time-zone-minute
|
|
|
|
|
(if time-zone-minute (string-to-number time-zone-minute) 0))
|
|
|
|
|
(unless (and
|
|
|
|
|
;; XSD does not allow year 0.
|
|
|
|
|
(> year 0)
|
|
|
|
|
(>= month 1) (<= month 12)
|
|
|
|
|
(>= day 1) (<= day (rng-xsd-days-in-month year month))
|
|
|
|
|
(>= hour 0) (<= hour 23)
|
|
|
|
|
(>= minute 0) (<= minute 59)
|
|
|
|
|
;; 60 represents a leap second, but leap seconds are explicitly
|
|
|
|
|
;; disallowed by the XML Schema 1.1 specification. This agrees
|
|
|
|
|
;; with typical Emacs installations, which don't count leap
|
|
|
|
|
;; seconds in time values.
|
|
|
|
|
(>= second 0) (<= second 59)
|
|
|
|
|
(>= time-zone-hour 0)
|
|
|
|
|
(<= time-zone-hour 23)
|
|
|
|
|
(>= time-zone-minute 0)
|
|
|
|
|
(<= time-zone-minute 59))
|
|
|
|
|
(error "Invalid or unsupported time: %s" date-time-string))
|
|
|
|
|
;; Return a value in a format similar to that returned by decode-time, and
|
Simplify use of encode-time
Most uses of (apply #'encode-time foo) can now be replaced
with (encode-time foo). Make similar simplifications.
* lisp/calendar/time-date.el (date-to-time):
* lisp/calendar/timeclock.el (timeclock-when-to-leave)
(timeclock-day-base, timeclock-generate-report):
* lisp/emacs-lisp/timer.el (timer-set-idle-time):
* lisp/eshell/esh-util.el (eshell-parse-ange-ls):
* lisp/gnus/gnus-art.el (article-make-date-line):
* lisp/gnus/gnus-delay.el (gnus-delay-article)
(gnus-delay-send-queue):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--decode-datefield):
* lisp/gnus/gnus-logic.el (gnus-advanced-date):
* lisp/gnus/message.el (message-make-expires-date):
* lisp/gnus/nndiary.el (nndiary-compute-reminders):
* lisp/mail/ietf-drums.el (ietf-drums-parse-date):
* lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p):
* lisp/org/org-agenda.el (org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-show-clocking-issues):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-get-sum-start, org-clock-sum)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-colview-construct-allowed-dates)
* lisp/org/org-macro.el (org-macro--vc-modified-time):
* lisp/org/org-table.el (org-table-eval-formula):
* lisp/org/org.el (org-current-time, org-store-link)
(org-time-today, org-read-date, org-read-date-display)
(org-display-custom-time, org-time-string-to-time)
(org-timestamp-change, org-timestamp--to-internal-time):
* lisp/url/url-dav.el (url-dav-process-date-property):
* lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time)
(vc-cvs-parse-entry):
Simplify use of encode-time.
* lisp/org/org-clock.el (org-clock-get-clocked-time):
(org-clock-resolve, org-resolve-clocks, org_clock_out)
(org-clock-update-time-maybe):
Avoid some rounding problems with encode-time and float-time.
* lisp/org/org-clock.el (org-clock-in, org-clock-update-time-maybe):
* lisp/org/org-colview.el (org-columns--age-to-minutes):
* lisp/org/org.el (org-get-scheduled-time, org-get-deadline-time)
(org-add-planning-info, org-2ft, org-time-string-to-absolute)
(org-closest-date):
Use org-time-string-to-time instead of doing it by hand with
encode-time.
* lisp/org/org.el (org-current-time): Simplify rounding.
(org-read-date): Avoid extra trip through encode-time.
2019-02-11 04:25:22 +00:00
|
|
|
|
;; suitable for (apply #'encode-time ...).
|
2019-08-04 16:57:27 +00:00
|
|
|
|
;; FIXME: Nobody uses this idiosyncratic value. Perhaps stop returning it?
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(list second minute hour day month year second-fraction datatype
|
|
|
|
|
(if has-time-zone
|
|
|
|
|
(* (rng-xsd-time-to-seconds
|
|
|
|
|
time-zone-hour
|
|
|
|
|
time-zone-minute
|
|
|
|
|
0)
|
|
|
|
|
time-zone-sign)
|
|
|
|
|
;; UTC.
|
|
|
|
|
0))))
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-xs-basic-type (type node)
|
|
|
|
|
"Use TYPE, a `soap-xs-basic-type', to decode the contents of NODE.
|
|
|
|
|
A LISP value is returned based on the contents of NODE and the
|
|
|
|
|
type-info stored in TYPE.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-decode-type' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
|
|
|
|
(let ((contents (xml-node-children node))
|
|
|
|
|
(kind (soap-xs-basic-type-kind type))
|
|
|
|
|
(attributes (xml-node-attributes node))
|
|
|
|
|
(validate-type type)
|
|
|
|
|
(is-nil nil))
|
|
|
|
|
|
|
|
|
|
(dolist (attribute attributes)
|
|
|
|
|
(let ((attribute-type (soap-l2fq (car attribute)))
|
|
|
|
|
(attribute-value (cdr attribute)))
|
|
|
|
|
;; xsi:type can override an element's expected type.
|
|
|
|
|
(when (equal attribute-type (soap-l2fq "xsi:type"))
|
|
|
|
|
(setq validate-type
|
|
|
|
|
(soap-wsdl-get attribute-value soap-current-wsdl)))
|
|
|
|
|
;; xsi:nil can specify that an element is nil in which case we don't
|
|
|
|
|
;; validate it.
|
|
|
|
|
(when (equal attribute-type (soap-l2fq "xsi:nil"))
|
|
|
|
|
(setq is-nil (string= (downcase attribute-value) "true")))))
|
|
|
|
|
|
|
|
|
|
(unless is-nil
|
|
|
|
|
;; For validation purposes, when xml-node-children returns nil, treat it
|
|
|
|
|
;; as the empty string.
|
|
|
|
|
(soap-validate-xs-basic-type (car (or contents (list ""))) validate-type))
|
|
|
|
|
|
|
|
|
|
(if (null contents)
|
|
|
|
|
nil
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-ecase kind
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((string anyURI QName ID IDREF language) (car contents))
|
|
|
|
|
((dateTime time date gYearMonth gYear gMonthDay gDay gMonth)
|
|
|
|
|
(car contents))
|
|
|
|
|
((long short int integer
|
|
|
|
|
unsignedInt unsignedLong unsignedShort nonNegativeInteger
|
|
|
|
|
decimal byte float double duration)
|
|
|
|
|
(string-to-number (car contents)))
|
|
|
|
|
(boolean (string= (downcase (car contents)) "true"))
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(base64Binary (base64-decode-string (car contents)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(anyType (soap-decode-any-type node))
|
|
|
|
|
(Array (soap-decode-array node))))))
|
|
|
|
|
|
2018-07-18 02:22:15 +00:00
|
|
|
|
(defalias 'soap-type-of
|
|
|
|
|
(if (eq 'soap-xs-basic-type (type-of (make-soap-xs-basic-type)))
|
|
|
|
|
;; `type-of' in Emacs ≥ 26 already does what we need.
|
|
|
|
|
#'type-of
|
|
|
|
|
;; For Emacs < 26, use our own function.
|
|
|
|
|
(lambda (element)
|
|
|
|
|
"Return the type of ELEMENT."
|
|
|
|
|
(if (vectorp element)
|
|
|
|
|
(aref element 0) ;Assume this vector is actually a struct!
|
|
|
|
|
;; This should never happen.
|
|
|
|
|
(type-of element)))))
|
2018-06-09 02:41:28 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; Register methods for `soap-xs-basic-type'
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((tag (soap-type-of (make-soap-xs-basic-type))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(put tag 'soap-attribute-encoder #'soap-encode-xs-basic-type-attributes)
|
|
|
|
|
(put tag 'soap-encoder #'soap-encode-xs-basic-type)
|
|
|
|
|
(put tag 'soap-decoder #'soap-decode-xs-basic-type))
|
|
|
|
|
|
|
|
|
|
;;;;; soap-xs-element
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-element (:include soap-element))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; NOTE: we don't support exact number of occurrences via minOccurs,
|
|
|
|
|
;; maxOccurs. Instead we support optional? and multiple?
|
|
|
|
|
|
|
|
|
|
id
|
|
|
|
|
type^ ; note: use soap-xs-element-type to retrieve this member
|
|
|
|
|
optional?
|
|
|
|
|
multiple?
|
|
|
|
|
reference
|
|
|
|
|
substitution-group
|
|
|
|
|
;; contains a list of elements who point to this one via their
|
|
|
|
|
;; substitution-group slot
|
|
|
|
|
alternatives
|
|
|
|
|
is-group)
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-element-type (element)
|
|
|
|
|
"Retrieve the type of ELEMENT.
|
|
|
|
|
This is normally stored in the TYPE^ slot, but if this element
|
2015-11-10 18:22:29 +00:00
|
|
|
|
contains a reference, retrieve the type of the reference."
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(if (soap-xs-element-reference element)
|
|
|
|
|
(soap-xs-element-type (soap-xs-element-reference element))
|
|
|
|
|
(soap-xs-element-type^ element)))
|
|
|
|
|
|
|
|
|
|
(defun soap-node-optional (node)
|
|
|
|
|
"Return t if NODE specifies an optional element."
|
|
|
|
|
(or (equal (xml-get-attribute-or-nil node 'nillable) "true")
|
|
|
|
|
(let ((e (xml-get-attribute-or-nil node 'minOccurs)))
|
|
|
|
|
(and e (equal e "0")))))
|
|
|
|
|
|
|
|
|
|
(defun soap-node-multiple (node)
|
|
|
|
|
"Return t if NODE permits multiple elements."
|
|
|
|
|
(let* ((e (xml-get-attribute-or-nil node 'maxOccurs)))
|
|
|
|
|
(and e (not (equal e "1")))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-element (node)
|
|
|
|
|
"Construct a `soap-xs-element' from NODE."
|
|
|
|
|
(let ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
(id (xml-get-attribute-or-nil node 'id))
|
|
|
|
|
(type (xml-get-attribute-or-nil node 'type))
|
|
|
|
|
(optional? (soap-node-optional node))
|
|
|
|
|
(multiple? (soap-node-multiple node))
|
|
|
|
|
(ref (xml-get-attribute-or-nil node 'ref))
|
|
|
|
|
(substitution-group (xml-get-attribute-or-nil node 'substitutionGroup))
|
|
|
|
|
(node-name (soap-l2wk (xml-node-name node))))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (memq node-name '(xsd:element xsd:group))
|
|
|
|
|
"expecting xsd:element or xsd:group, got %s" node-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(when type
|
|
|
|
|
(setq type (soap-l2fq type 'tns)))
|
|
|
|
|
|
|
|
|
|
(when ref
|
|
|
|
|
(setq ref (soap-l2fq ref 'tns)))
|
|
|
|
|
|
|
|
|
|
(when substitution-group
|
|
|
|
|
(setq substitution-group (soap-l2fq substitution-group 'tns)))
|
|
|
|
|
|
|
|
|
|
(unless (or ref type)
|
|
|
|
|
;; no type specified and this is not a reference. Must be a type
|
|
|
|
|
;; defined within this node.
|
|
|
|
|
(let ((simple-type (soap-xml-get-children1 node 'xsd:simpleType)))
|
|
|
|
|
(if simple-type
|
|
|
|
|
(setq type (soap-xs-parse-simple-type (car simple-type)))
|
|
|
|
|
;; else
|
|
|
|
|
(let ((complex-type (soap-xml-get-children1 node 'xsd:complexType)))
|
|
|
|
|
(if complex-type
|
|
|
|
|
(setq type (soap-xs-parse-complex-type (car complex-type)))
|
|
|
|
|
;; else
|
|
|
|
|
(error "Soap-xs-parse-element: missing type or ref"))))))
|
|
|
|
|
|
|
|
|
|
(make-soap-xs-element :name name
|
|
|
|
|
;; Use the full namespace name for now, we will
|
|
|
|
|
;; convert it to a nstag in
|
|
|
|
|
;; `soap-resolve-references-for-xs-element'
|
|
|
|
|
:namespace-tag soap-target-xmlns
|
|
|
|
|
:id id :type^ type
|
|
|
|
|
:optional? optional? :multiple? multiple?
|
|
|
|
|
:reference ref
|
|
|
|
|
:substitution-group substitution-group
|
|
|
|
|
:is-group (eq node-name 'xsd:group))))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-xs-element (element wsdl)
|
|
|
|
|
"Replace names in ELEMENT with the referenced objects in the WSDL.
|
|
|
|
|
This is a specialization of `soap-resolve-references' for
|
|
|
|
|
`soap-xs-element' objects.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
|
|
|
|
|
(let ((namespace (soap-element-namespace-tag element)))
|
|
|
|
|
(when namespace
|
|
|
|
|
(let ((nstag (car (rassoc namespace (soap-wsdl-alias-table wsdl)))))
|
|
|
|
|
(when nstag
|
|
|
|
|
(setf (soap-element-namespace-tag element) nstag)))))
|
|
|
|
|
|
|
|
|
|
(let ((type (soap-xs-element-type^ element)))
|
|
|
|
|
(cond ((soap-name-p type)
|
|
|
|
|
(setf (soap-xs-element-type^ element)
|
|
|
|
|
(soap-wsdl-get type wsdl 'soap-xs-type-p)))
|
|
|
|
|
((soap-xs-type-p type)
|
|
|
|
|
;; an inline defined type, this will not be reached from anywhere
|
|
|
|
|
;; else, so we must resolve references now.
|
|
|
|
|
(soap-resolve-references type wsdl))))
|
|
|
|
|
(let ((reference (soap-xs-element-reference element)))
|
|
|
|
|
(when (and (soap-name-p reference)
|
|
|
|
|
;; xsd:group reference nodes will be converted to inline types
|
|
|
|
|
;; by soap-resolve-references-for-xs-complex-type, so skip them
|
|
|
|
|
;; here.
|
|
|
|
|
(not (soap-xs-element-is-group element)))
|
|
|
|
|
(setf (soap-xs-element-reference element)
|
|
|
|
|
(soap-wsdl-get reference wsdl 'soap-xs-element-p))))
|
|
|
|
|
|
|
|
|
|
(let ((subst (soap-xs-element-substitution-group element)))
|
|
|
|
|
(when (soap-name-p subst)
|
|
|
|
|
(let ((target (soap-wsdl-get subst wsdl)))
|
|
|
|
|
(if target
|
|
|
|
|
(push element (soap-xs-element-alternatives target))
|
|
|
|
|
(soap-warning "No target found for substitution-group" subst))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-element-attributes (value element)
|
|
|
|
|
"Encode the XML attributes for VALUE according to ELEMENT.
|
|
|
|
|
Currently no attributes are needed.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-attributes' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
|
|
|
|
;; Use the variables to suppress checkdoc and compiler warnings.
|
|
|
|
|
(list value element)
|
|
|
|
|
nil)
|
|
|
|
|
|
|
|
|
|
(defun soap-should-encode-value-for-xs-element (value element)
|
|
|
|
|
"Return t if VALUE should be encoded for ELEMENT, nil otherwise."
|
|
|
|
|
(cond
|
|
|
|
|
;; if value is not nil, attempt to encode it
|
|
|
|
|
(value)
|
|
|
|
|
|
|
|
|
|
;; value is nil, but the element's type is a boolean, so nil in this case
|
|
|
|
|
;; means "false". We need to encode it.
|
|
|
|
|
((let ((type (soap-xs-element-type element)))
|
|
|
|
|
(and (soap-xs-basic-type-p type)
|
|
|
|
|
(eq (soap-xs-basic-type-kind type) 'boolean))))
|
|
|
|
|
|
|
|
|
|
;; This is not an optional element. Force encoding it (although this
|
|
|
|
|
;; might fail at the validation step, but this is what we intend.
|
|
|
|
|
|
|
|
|
|
;; value is nil, but the element's type has some attributes which supply a
|
|
|
|
|
;; default value. We need to encode it.
|
|
|
|
|
|
|
|
|
|
((let ((type (soap-xs-element-type element)))
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (a (soap-xs-type-attributes type))
|
|
|
|
|
(when (soap-xs-attribute-default a)
|
|
|
|
|
(throw 'found t))))))
|
|
|
|
|
|
|
|
|
|
;; otherwise, we don't need to encode it
|
|
|
|
|
(t nil)))
|
|
|
|
|
|
|
|
|
|
(defun soap-type-is-array? (type)
|
|
|
|
|
"Return t if TYPE defines an ARRAY."
|
|
|
|
|
(and (soap-xs-complex-type-p type)
|
|
|
|
|
(eq (soap-xs-complex-type-indicator type) 'array)))
|
|
|
|
|
|
|
|
|
|
(defvar soap-encoded-namespaces nil
|
|
|
|
|
"A list of namespace tags used during encoding a message.
|
|
|
|
|
This list is populated by `soap-encode-value' and used by
|
|
|
|
|
`soap-create-envelope' to add aliases for these namespace to the
|
|
|
|
|
XML request.
|
|
|
|
|
|
|
|
|
|
This variable is dynamically bound in `soap-create-envelope'.")
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-element (value element)
|
|
|
|
|
"Encode the VALUE according to ELEMENT.
|
|
|
|
|
The data is inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-value' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
|
|
|
|
(let ((fq-name (soap-element-fq-name element))
|
|
|
|
|
(type (soap-xs-element-type element)))
|
|
|
|
|
;; Only encode the element if it has a name. NOTE: soap-element-fq-name
|
|
|
|
|
;; will return *unnamed* for such elements
|
|
|
|
|
(if (soap-element-name element)
|
|
|
|
|
;; Don't encode this element if value is nil. However, even if value
|
|
|
|
|
;; is nil we still want to encode this element if it has any attributes
|
|
|
|
|
;; with default values.
|
|
|
|
|
(when (soap-should-encode-value-for-xs-element value element)
|
|
|
|
|
(progn
|
|
|
|
|
(insert "<" fq-name)
|
|
|
|
|
(soap-encode-attributes value type)
|
|
|
|
|
;; If value is nil and type is boolean encode the value as "false".
|
|
|
|
|
;; Otherwise don't encode the value.
|
|
|
|
|
(if (or value (and (soap-xs-basic-type-p type)
|
|
|
|
|
(eq (soap-xs-basic-type-kind type) 'boolean)))
|
|
|
|
|
(progn (insert ">")
|
|
|
|
|
;; ARRAY's need special treatment, as each element of
|
|
|
|
|
;; the array is encoded with the same tag as the
|
|
|
|
|
;; current element...
|
|
|
|
|
(if (soap-type-is-array? type)
|
|
|
|
|
(let ((new-element (copy-soap-xs-element element)))
|
|
|
|
|
(when (soap-element-namespace-tag type)
|
|
|
|
|
(add-to-list 'soap-encoded-namespaces
|
|
|
|
|
(soap-element-namespace-tag type)))
|
|
|
|
|
(setf (soap-xs-element-type^ new-element)
|
|
|
|
|
(soap-xs-complex-type-base type))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-loop for i below (length value)
|
2017-05-24 18:28:32 +00:00
|
|
|
|
do (soap-encode-xs-element
|
|
|
|
|
(aref value i) new-element)))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(soap-encode-value value type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(insert "</" fq-name ">\n"))
|
|
|
|
|
;; else
|
|
|
|
|
(insert "/>\n"))))
|
|
|
|
|
(when (soap-should-encode-value-for-xs-element value element)
|
|
|
|
|
(soap-encode-value value type)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-xs-element (element node)
|
|
|
|
|
"Use ELEMENT, a `soap-xs-element', to decode the contents of NODE.
|
|
|
|
|
A LISP value is returned based on the contents of NODE and the
|
|
|
|
|
type-info stored in ELEMENT.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-decode-type' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
|
|
|
|
(let ((type (soap-xs-element-type element)))
|
|
|
|
|
(soap-decode-type type node)))
|
|
|
|
|
|
|
|
|
|
;; Register methods for `soap-xs-element'
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((tag (soap-type-of (make-soap-xs-element))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(put tag 'soap-resolve-references #'soap-resolve-references-for-xs-element)
|
|
|
|
|
(put tag 'soap-attribute-encoder #'soap-encode-xs-element-attributes)
|
|
|
|
|
(put tag 'soap-encoder #'soap-encode-xs-element)
|
|
|
|
|
(put tag 'soap-decoder #'soap-decode-xs-element))
|
|
|
|
|
|
|
|
|
|
;;;;; soap-xs-attribute
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-attribute (:include soap-element))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
type ; a simple type or basic type
|
|
|
|
|
default ; the default value, if any
|
|
|
|
|
reference)
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-attribute-group (:include soap-xs-type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
reference)
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-attribute (node)
|
|
|
|
|
"Construct a `soap-xs-attribute' from NODE."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:attribute)
|
|
|
|
|
"expecting xsd:attribute, got %s" (soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let* ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
(type (soap-l2fq (xml-get-attribute-or-nil node 'type)))
|
|
|
|
|
(default (xml-get-attribute-or-nil node 'fixed))
|
|
|
|
|
(attribute (xml-get-attribute-or-nil node 'ref))
|
|
|
|
|
(ref (when attribute (soap-l2fq attribute))))
|
|
|
|
|
(unless (or type ref)
|
|
|
|
|
(setq type (soap-xs-parse-simple-type
|
|
|
|
|
(soap-xml-node-find-matching-child
|
|
|
|
|
node '(xsd:restriction xsd:list xsd:union)))))
|
|
|
|
|
(make-soap-xs-attribute
|
|
|
|
|
:name name :type type :default default :reference ref)))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-attribute-group (node)
|
|
|
|
|
"Construct a `soap-xs-attribute-group' from NODE."
|
|
|
|
|
(let ((node-name (soap-l2wk (xml-node-name node))))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq node-name 'xsd:attributeGroup)
|
|
|
|
|
"expecting xsd:attributeGroup, got %s" node-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
(id (xml-get-attribute-or-nil node 'id))
|
|
|
|
|
(ref (xml-get-attribute-or-nil node 'ref))
|
|
|
|
|
attribute-group)
|
|
|
|
|
(when (and name ref)
|
|
|
|
|
(soap-warning "name and ref set for attribute group %s" node-name))
|
|
|
|
|
(setq attribute-group
|
|
|
|
|
(make-soap-xs-attribute-group :id id
|
|
|
|
|
:name name
|
|
|
|
|
:reference (and ref (soap-l2fq ref))))
|
|
|
|
|
(when (not ref)
|
|
|
|
|
(dolist (child (xml-node-children node))
|
|
|
|
|
;; Ignore whitespace.
|
|
|
|
|
(unless (stringp child)
|
|
|
|
|
;; Ignore optional annotation.
|
|
|
|
|
;; Ignore anyAttribute nodes.
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name child))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:attribute
|
|
|
|
|
(push (soap-xs-parse-attribute child)
|
|
|
|
|
(soap-xs-type-attributes attribute-group)))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(push (soap-xs-parse-attribute-group child)
|
|
|
|
|
(soap-xs-attribute-group-attribute-groups
|
|
|
|
|
attribute-group)))))))
|
|
|
|
|
attribute-group)))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-xs-attribute (attribute wsdl)
|
|
|
|
|
"Replace names in ATTRIBUTE with the referenced objects in the WSDL.
|
|
|
|
|
This is a specialization of `soap-resolve-references' for
|
|
|
|
|
`soap-xs-attribute' objects.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
(let* ((type (soap-xs-attribute-type attribute))
|
|
|
|
|
(reference (soap-xs-attribute-reference attribute))
|
|
|
|
|
(predicate 'soap-xs-element-p)
|
|
|
|
|
(xml-reference
|
|
|
|
|
(and (soap-name-p reference)
|
|
|
|
|
(equal (car reference) "http://www.w3.org/XML/1998/namespace"))))
|
|
|
|
|
(cond (xml-reference
|
|
|
|
|
;; Convert references to attributes defined by the XML
|
|
|
|
|
;; schema (xml:base, xml:lang, xml:space and xml:id) to
|
|
|
|
|
;; xsd:string, to avoid needing to bundle and parse
|
|
|
|
|
;; xml.xsd.
|
|
|
|
|
(setq reference '("http://www.w3.org/2001/XMLSchema" . "string"))
|
|
|
|
|
(setq predicate 'soap-xs-basic-type-p))
|
|
|
|
|
((soap-name-p type)
|
|
|
|
|
(setf (soap-xs-attribute-type attribute)
|
|
|
|
|
(soap-wsdl-get type wsdl
|
|
|
|
|
(lambda (type)
|
|
|
|
|
(or (soap-xs-basic-type-p type)
|
|
|
|
|
(soap-xs-simple-type-p type))))))
|
|
|
|
|
((soap-xs-type-p type)
|
|
|
|
|
;; an inline defined type, this will not be reached from anywhere
|
|
|
|
|
;; else, so we must resolve references now.
|
|
|
|
|
(soap-resolve-references type wsdl)))
|
|
|
|
|
(when (soap-name-p reference)
|
|
|
|
|
(setf (soap-xs-attribute-reference attribute)
|
|
|
|
|
(soap-wsdl-get reference wsdl predicate)))))
|
|
|
|
|
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-xs-attribute))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
'soap-resolve-references #'soap-resolve-references-for-xs-attribute)
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-xs-attribute-group (attribute-group wsdl)
|
|
|
|
|
"Set slots in ATTRIBUTE-GROUP to the referenced objects in the WSDL.
|
|
|
|
|
This is a specialization of `soap-resolve-references' for
|
|
|
|
|
`soap-xs-attribute-group' objects.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
(let ((reference (soap-xs-attribute-group-reference attribute-group)))
|
|
|
|
|
(when (soap-name-p reference)
|
|
|
|
|
(let ((resolved (soap-wsdl-get reference wsdl
|
|
|
|
|
'soap-xs-attribute-group-p)))
|
|
|
|
|
(dolist (attribute (soap-xs-attribute-group-attributes resolved))
|
|
|
|
|
(soap-resolve-references attribute wsdl))
|
|
|
|
|
(setf (soap-xs-attribute-group-name attribute-group)
|
|
|
|
|
(soap-xs-attribute-group-name resolved))
|
|
|
|
|
(setf (soap-xs-attribute-group-id attribute-group)
|
|
|
|
|
(soap-xs-attribute-group-id resolved))
|
|
|
|
|
(setf (soap-xs-attribute-group-reference attribute-group) nil)
|
|
|
|
|
(setf (soap-xs-attribute-group-attributes attribute-group)
|
|
|
|
|
(soap-xs-attribute-group-attributes resolved))
|
|
|
|
|
(setf (soap-xs-attribute-group-attribute-groups attribute-group)
|
|
|
|
|
(soap-xs-attribute-group-attribute-groups resolved))))))
|
|
|
|
|
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-xs-attribute-group))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
'soap-resolve-references #'soap-resolve-references-for-xs-attribute-group)
|
|
|
|
|
|
|
|
|
|
;;;;; soap-xs-simple-type
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-simple-type (:include soap-xs-type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; A simple type is an extension on the basic type to which some
|
|
|
|
|
;; restrictions can be added. For example we can define a simple type based
|
|
|
|
|
;; off "string" with the restrictions that only the strings "one", "two" and
|
|
|
|
|
;; "three" are valid values (this is an enumeration).
|
|
|
|
|
|
|
|
|
|
base ; can be a single type, or a list of types for union types
|
|
|
|
|
enumeration ; nil, or list of permitted values for the type
|
|
|
|
|
pattern ; nil, or value must match this pattern
|
|
|
|
|
length-range ; a cons of (min . max) length, inclusive range.
|
|
|
|
|
; For exact length, use (l, l).
|
|
|
|
|
; nil means no range,
|
|
|
|
|
; (nil . l) means no min range,
|
|
|
|
|
; (l . nil) means no max range.
|
|
|
|
|
integer-range ; a pair of (min, max) integer values, inclusive range,
|
|
|
|
|
; same meaning as `length-range'
|
|
|
|
|
is-list ; t if this is an xs:list, nil otherwise
|
2011-02-16 09:25:37 +00:00
|
|
|
|
)
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-xs-parse-simple-type (node)
|
|
|
|
|
"Construct an `soap-xs-simple-type' object from the XML NODE."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (memq (soap-l2wk (xml-node-name node))
|
|
|
|
|
'(xsd:simpleType xsd:simpleContent))
|
|
|
|
|
nil
|
|
|
|
|
"expecting xsd:simpleType or xsd:simpleContent node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
;; NOTE: name can be nil for inline types. Such types cannot be added to a
|
|
|
|
|
;; namespace.
|
|
|
|
|
(let ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
(id (xml-get-attribute-or-nil node 'id)))
|
|
|
|
|
|
|
|
|
|
(let ((type (make-soap-xs-simple-type
|
|
|
|
|
:name name :namespace-tag soap-target-xmlns :id id))
|
|
|
|
|
(def (soap-xml-node-find-matching-child
|
|
|
|
|
node '(xsd:restriction xsd:extension xsd:union xsd:list))))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-ecase (soap-l2wk (xml-node-name def))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:restriction (soap-xs-add-restriction def type))
|
|
|
|
|
(xsd:extension (soap-xs-add-extension def type))
|
|
|
|
|
(xsd:union (soap-xs-add-union def type))
|
|
|
|
|
(xsd:list (soap-xs-add-list def type)))
|
|
|
|
|
|
|
|
|
|
type)))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-add-restriction (node type)
|
|
|
|
|
"Add restrictions defined in XML NODE to TYPE, an `soap-xs-simple-type'."
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:restriction)
|
|
|
|
|
nil
|
|
|
|
|
"expecting xsd:restriction node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(soap-l2fq (xml-get-attribute node 'base)))
|
|
|
|
|
|
|
|
|
|
(dolist (r (xml-node-children node))
|
|
|
|
|
(unless (stringp r) ; skip the white space
|
|
|
|
|
(let ((value (xml-get-attribute r 'value)))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name r))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:enumeration
|
|
|
|
|
(push value (soap-xs-simple-type-enumeration type)))
|
|
|
|
|
(xsd:pattern
|
|
|
|
|
(setf (soap-xs-simple-type-pattern type)
|
|
|
|
|
(concat "\\`" (xsdre-translate value) "\\'")))
|
|
|
|
|
(xsd:length
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-length-range type)
|
|
|
|
|
(cons value value))))
|
|
|
|
|
(xsd:minLength
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-length-range type)
|
|
|
|
|
(if (soap-xs-simple-type-length-range type)
|
|
|
|
|
(cons value
|
|
|
|
|
(cdr (soap-xs-simple-type-length-range type)))
|
|
|
|
|
;; else
|
|
|
|
|
(cons value nil)))))
|
|
|
|
|
(xsd:maxLength
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-length-range type)
|
|
|
|
|
(if (soap-xs-simple-type-length-range type)
|
|
|
|
|
(cons (car (soap-xs-simple-type-length-range type))
|
|
|
|
|
value)
|
|
|
|
|
;; else
|
|
|
|
|
(cons nil value)))))
|
|
|
|
|
(xsd:minExclusive
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(if (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(cons (1+ value)
|
|
|
|
|
(cdr (soap-xs-simple-type-integer-range type)))
|
|
|
|
|
;; else
|
|
|
|
|
(cons (1+ value) nil)))))
|
|
|
|
|
(xsd:maxExclusive
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(if (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(cons (car (soap-xs-simple-type-integer-range type))
|
|
|
|
|
(1- value))
|
|
|
|
|
;; else
|
|
|
|
|
(cons nil (1- value))))))
|
|
|
|
|
(xsd:minInclusive
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(if (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(cons value
|
|
|
|
|
(cdr (soap-xs-simple-type-integer-range type)))
|
|
|
|
|
;; else
|
|
|
|
|
(cons value nil)))))
|
|
|
|
|
(xsd:maxInclusive
|
|
|
|
|
(let ((value (string-to-number value)))
|
|
|
|
|
(setf (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(if (soap-xs-simple-type-integer-range type)
|
|
|
|
|
(cons (car (soap-xs-simple-type-integer-range type))
|
|
|
|
|
value)
|
|
|
|
|
;; else
|
|
|
|
|
(cons nil value))))))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-add-union (node type)
|
|
|
|
|
"Add union members defined in XML NODE to TYPE, an `soap-xs-simple-type'."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:union)
|
|
|
|
|
nil
|
2017-05-24 18:28:32 +00:00
|
|
|
|
"expecting xsd:union node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(mapcar 'soap-l2fq
|
|
|
|
|
(split-string
|
|
|
|
|
(or (xml-get-attribute-or-nil node 'memberTypes) ""))))
|
|
|
|
|
|
|
|
|
|
;; Additional simple types can be defined inside the union node. Add them
|
|
|
|
|
;; to the base list. The "memberTypes" members will have to be resolved by
|
|
|
|
|
;; the "resolve-references" method, the inline types will not.
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (simple-type (soap-xml-get-children1 node 'xsd:simpleType))
|
|
|
|
|
(push (soap-xs-parse-simple-type simple-type) result))
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(append (soap-xs-simple-type-base type) (nreverse result)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-add-list (node type)
|
|
|
|
|
"Add list defined in XML NODE to TYPE, a `soap-xs-simple-type'."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:list)
|
|
|
|
|
nil
|
|
|
|
|
"expecting xsd:list node, got %s" (soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
;; A simple type can be defined inline inside the list node or referenced by
|
|
|
|
|
;; the itemType attribute, in which case it will be resolved by the
|
|
|
|
|
;; resolve-references method.
|
|
|
|
|
(let* ((item-type (xml-get-attribute-or-nil node 'itemType))
|
|
|
|
|
(children (soap-xml-get-children1 node 'xsd:simpleType)))
|
|
|
|
|
(if item-type
|
|
|
|
|
(if (= (length children) 0)
|
|
|
|
|
(setf (soap-xs-simple-type-base type) (soap-l2fq item-type))
|
|
|
|
|
(soap-warning
|
|
|
|
|
"xsd:list node with itemType has more than zero children: %s"
|
|
|
|
|
(soap-xs-type-name type)))
|
|
|
|
|
(if (= (length children) 1)
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(soap-xs-parse-simple-type
|
|
|
|
|
(car (soap-xml-get-children1 node 'xsd:simpleType))))
|
|
|
|
|
(soap-warning "xsd:list node has more than one child %s"
|
|
|
|
|
(soap-xs-type-name type))))
|
|
|
|
|
(setf (soap-xs-simple-type-is-list type) t)))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-add-extension (node type)
|
|
|
|
|
"Add the extended type defined in XML NODE to TYPE, an `soap-xs-simple-type'."
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(soap-l2fq (xml-get-attribute node 'base)))
|
|
|
|
|
(dolist (attribute (soap-xml-get-children1 node 'xsd:attribute))
|
|
|
|
|
(push (soap-xs-parse-attribute attribute)
|
|
|
|
|
(soap-xs-type-attributes type)))
|
|
|
|
|
(dolist (attribute-group (soap-xml-get-children1 node 'xsd:attributeGroup))
|
|
|
|
|
(push (soap-xs-parse-attribute-group attribute-group)
|
|
|
|
|
(soap-xs-type-attribute-groups type))))
|
|
|
|
|
|
|
|
|
|
(defun soap-validate-xs-basic-type (value type)
|
|
|
|
|
"Validate VALUE against the basic type TYPE."
|
|
|
|
|
(let* ((kind (soap-xs-basic-type-kind type)))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case kind
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((anyType Array byte[])
|
|
|
|
|
value)
|
|
|
|
|
(t
|
|
|
|
|
(let ((convert (get kind 'rng-xsd-convert)))
|
|
|
|
|
(if convert
|
|
|
|
|
(if (rng-dt-make-value convert value)
|
|
|
|
|
value
|
|
|
|
|
(error "Invalid %s: %s" (symbol-name kind) value))
|
|
|
|
|
(error "Don't know how to convert %s" kind)))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-validate-xs-simple-type (value type)
|
|
|
|
|
"Validate VALUE against the restrictions of TYPE."
|
|
|
|
|
|
|
|
|
|
(let* ((base-type (soap-xs-simple-type-base type))
|
|
|
|
|
(messages nil))
|
|
|
|
|
(if (listp base-type)
|
|
|
|
|
(catch 'valid
|
|
|
|
|
(dolist (base base-type)
|
|
|
|
|
(condition-case error-object
|
|
|
|
|
(cond ((soap-xs-simple-type-p base)
|
|
|
|
|
(throw 'valid
|
|
|
|
|
(soap-validate-xs-simple-type value base)))
|
|
|
|
|
((soap-xs-basic-type-p base)
|
|
|
|
|
(throw 'valid
|
|
|
|
|
(soap-validate-xs-basic-type value base))))
|
|
|
|
|
(error (push (cadr error-object) messages))))
|
|
|
|
|
(when messages
|
|
|
|
|
(error (mapconcat 'identity (nreverse messages) "; and: "))))
|
2015-11-12 04:43:50 +00:00
|
|
|
|
(cl-labels ((fail-with-message (format value)
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(push (format format value) messages)
|
|
|
|
|
(throw 'invalid nil)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(catch 'invalid
|
|
|
|
|
(let ((enumeration (soap-xs-simple-type-enumeration type)))
|
|
|
|
|
(when (and (> (length enumeration) 1)
|
|
|
|
|
(not (member value enumeration)))
|
|
|
|
|
(fail-with-message "bad value, should be one of %s" enumeration)))
|
|
|
|
|
|
|
|
|
|
(let ((pattern (soap-xs-simple-type-pattern type)))
|
|
|
|
|
(when (and pattern (not (string-match-p pattern value)))
|
|
|
|
|
(fail-with-message "bad value, should match pattern %s" pattern)))
|
|
|
|
|
|
|
|
|
|
(let ((length-range (soap-xs-simple-type-length-range type)))
|
|
|
|
|
(when length-range
|
|
|
|
|
(unless (stringp value)
|
|
|
|
|
(fail-with-message
|
|
|
|
|
"bad value, should be a string with length range %s"
|
|
|
|
|
length-range))
|
|
|
|
|
(when (car length-range)
|
|
|
|
|
(unless (>= (length value) (car length-range))
|
|
|
|
|
(fail-with-message "short string, should be at least %s chars"
|
|
|
|
|
(car length-range))))
|
|
|
|
|
(when (cdr length-range)
|
|
|
|
|
(unless (<= (length value) (cdr length-range))
|
|
|
|
|
(fail-with-message "long string, should be at most %s chars"
|
|
|
|
|
(cdr length-range))))))
|
|
|
|
|
|
|
|
|
|
(let ((integer-range (soap-xs-simple-type-integer-range type)))
|
|
|
|
|
(when integer-range
|
|
|
|
|
(unless (numberp value)
|
|
|
|
|
(fail-with-message "bad value, should be a number with range %s"
|
|
|
|
|
integer-range))
|
|
|
|
|
(when (car integer-range)
|
|
|
|
|
(unless (>= value (car integer-range))
|
|
|
|
|
(fail-with-message "small value, should be at least %s"
|
|
|
|
|
(car integer-range))))
|
|
|
|
|
(when (cdr integer-range)
|
|
|
|
|
(unless (<= value (cdr integer-range))
|
|
|
|
|
(fail-with-message "big value, should be at most %s"
|
|
|
|
|
(cdr integer-range))))))))
|
|
|
|
|
(when messages
|
|
|
|
|
(error "Xs-simple-type(%s, %s): %s"
|
|
|
|
|
value (or (soap-xs-type-name type) (soap-xs-type-id type))
|
|
|
|
|
(car messages)))))
|
|
|
|
|
;; Return the validated value.
|
|
|
|
|
value)
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-xs-simple-type (type wsdl)
|
|
|
|
|
"Replace names in TYPE with the referenced objects in the WSDL.
|
|
|
|
|
This is a specialization of `soap-resolve-references' for
|
|
|
|
|
`soap-xs-simple-type' objects.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
|
|
|
|
|
(let ((namespace (soap-element-namespace-tag type)))
|
|
|
|
|
(when namespace
|
|
|
|
|
(let ((nstag (car (rassoc namespace (soap-wsdl-alias-table wsdl)))))
|
|
|
|
|
(when nstag
|
|
|
|
|
(setf (soap-element-namespace-tag type) nstag)))))
|
|
|
|
|
|
|
|
|
|
(let ((base (soap-xs-simple-type-base type)))
|
|
|
|
|
(cond
|
|
|
|
|
((soap-name-p base)
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(soap-wsdl-get base wsdl 'soap-xs-type-p)))
|
|
|
|
|
((soap-xs-type-p base)
|
|
|
|
|
(soap-resolve-references base wsdl))
|
|
|
|
|
((listp base)
|
|
|
|
|
(setf (soap-xs-simple-type-base type)
|
|
|
|
|
(mapcar (lambda (type)
|
|
|
|
|
(cond ((soap-name-p type)
|
|
|
|
|
(soap-wsdl-get type wsdl 'soap-xs-type-p))
|
|
|
|
|
((soap-xs-type-p type)
|
|
|
|
|
(soap-resolve-references type wsdl)
|
|
|
|
|
type)
|
|
|
|
|
(t ; signal an error?
|
|
|
|
|
type)))
|
|
|
|
|
base)))
|
|
|
|
|
(t (error "Oops"))))
|
|
|
|
|
(dolist (attribute (soap-xs-type-attributes type))
|
|
|
|
|
(soap-resolve-references attribute wsdl))
|
|
|
|
|
(dolist (attribute-group (soap-xs-type-attribute-groups type))
|
|
|
|
|
(soap-resolve-references attribute-group wsdl)))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-simple-type-attributes (value type)
|
|
|
|
|
"Encode the XML attributes for VALUE according to TYPE.
|
2019-07-24 08:54:31 +00:00
|
|
|
|
The attributes are inserted in the current buffer at the current
|
|
|
|
|
position. If TYPE has no attributes, the xsi:type attribute and
|
|
|
|
|
an optional xsi:nil attribute are added.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-attributes' for
|
|
|
|
|
`soap-xs-simple-type' objects."
|
2019-07-24 08:54:31 +00:00
|
|
|
|
(let ((attributes (soap-get-xs-attributes type)))
|
|
|
|
|
(dolist (a attributes)
|
|
|
|
|
(let ((element-name (soap-element-name a)))
|
|
|
|
|
(if (soap-xs-attribute-default a)
|
|
|
|
|
(insert " " element-name
|
|
|
|
|
"=\"" (soap-xs-attribute-default a) "\"")
|
|
|
|
|
(dolist (value-pair value)
|
|
|
|
|
(when (equal element-name (symbol-name (car-safe value-pair)))
|
|
|
|
|
(insert " " element-name
|
|
|
|
|
"=\"" (cdr value-pair) "\""))))))
|
|
|
|
|
(unless attributes
|
|
|
|
|
(insert " xsi:type=\"" (soap-element-fq-name type) "\"")
|
|
|
|
|
(unless value (insert " xsi:nil=\"true\"")))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-simple-type (value type)
|
|
|
|
|
"Encode the VALUE according to TYPE.
|
|
|
|
|
The data is inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-value' for
|
|
|
|
|
`soap-xs-simple-type' objects."
|
|
|
|
|
(soap-validate-xs-simple-type value type)
|
|
|
|
|
(if (soap-xs-simple-type-is-list type)
|
|
|
|
|
(progn
|
|
|
|
|
(dolist (v (butlast value))
|
|
|
|
|
(soap-encode-value v (soap-xs-simple-type-base type))
|
|
|
|
|
(insert " "))
|
|
|
|
|
(soap-encode-value (car (last value)) (soap-xs-simple-type-base type)))
|
|
|
|
|
(soap-encode-value value (soap-xs-simple-type-base type))))
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-xs-simple-type (type node)
|
|
|
|
|
"Use TYPE, a `soap-xs-simple-type', to decode the contents of NODE.
|
|
|
|
|
A LISP value is returned based on the contents of NODE and the
|
|
|
|
|
type-info stored in TYPE.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-decode-type' for
|
|
|
|
|
`soap-xs-simple-type' objects."
|
|
|
|
|
(if (soap-xs-simple-type-is-list type)
|
|
|
|
|
;; Technically, we could construct fake XML NODEs and pass them to
|
|
|
|
|
;; soap-decode-value...
|
|
|
|
|
(split-string (car (xml-node-children node)))
|
|
|
|
|
(let ((value (soap-decode-type (soap-xs-simple-type-base type) node)))
|
|
|
|
|
(soap-validate-xs-simple-type value type))))
|
|
|
|
|
|
|
|
|
|
;; Register methods for `soap-xs-simple-type'
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((tag (soap-type-of (make-soap-xs-simple-type))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(put tag 'soap-resolve-references
|
|
|
|
|
#'soap-resolve-references-for-xs-simple-type)
|
|
|
|
|
(put tag 'soap-attribute-encoder #'soap-encode-xs-simple-type-attributes)
|
|
|
|
|
(put tag 'soap-encoder #'soap-encode-xs-simple-type)
|
|
|
|
|
(put tag 'soap-decoder #'soap-decode-xs-simple-type))
|
|
|
|
|
|
|
|
|
|
;;;;; soap-xs-complex-type
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-xs-complex-type (:include soap-xs-type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
indicator ; sequence, choice, all, array
|
|
|
|
|
base
|
|
|
|
|
elements
|
|
|
|
|
optional?
|
|
|
|
|
multiple?
|
|
|
|
|
is-group)
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-complex-type (node)
|
|
|
|
|
"Construct a `soap-xs-complex-type' by parsing the XML NODE."
|
|
|
|
|
(let ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
(id (xml-get-attribute-or-nil node 'id))
|
|
|
|
|
(node-name (soap-l2wk (xml-node-name node)))
|
|
|
|
|
type
|
|
|
|
|
attributes
|
|
|
|
|
attribute-groups)
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (memq node-name '(xsd:complexType xsd:complexContent xsd:group))
|
|
|
|
|
nil "unexpected node: %s" node-name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(dolist (def (xml-node-children node))
|
|
|
|
|
(when (consp def) ; skip text nodes
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name def))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:attribute (push (soap-xs-parse-attribute def) attributes))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(push (soap-xs-parse-attribute-group def)
|
|
|
|
|
attribute-groups))
|
|
|
|
|
(xsd:simpleContent (setq type (soap-xs-parse-simple-type def)))
|
|
|
|
|
((xsd:sequence xsd:all xsd:choice)
|
|
|
|
|
(setq type (soap-xs-parse-sequence def)))
|
|
|
|
|
(xsd:complexContent
|
|
|
|
|
(dolist (def (xml-node-children def))
|
|
|
|
|
(when (consp def)
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name def))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:attribute
|
|
|
|
|
(push (soap-xs-parse-attribute def) attributes))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(push (soap-xs-parse-attribute-group def)
|
|
|
|
|
attribute-groups))
|
|
|
|
|
((xsd:extension xsd:restriction)
|
|
|
|
|
(setq type
|
|
|
|
|
(soap-xs-parse-extension-or-restriction def)))
|
|
|
|
|
((xsd:sequence xsd:all xsd:choice)
|
|
|
|
|
(soap-xs-parse-sequence def)))))))))
|
|
|
|
|
(unless type
|
|
|
|
|
;; the type has not been built, this is a shortcut for a simpleContent
|
|
|
|
|
;; node
|
|
|
|
|
(setq type (make-soap-xs-complex-type)))
|
|
|
|
|
|
|
|
|
|
(setf (soap-xs-type-name type) name)
|
|
|
|
|
(setf (soap-xs-type-namespace-tag type) soap-target-xmlns)
|
|
|
|
|
(setf (soap-xs-type-id type) id)
|
|
|
|
|
(setf (soap-xs-type-attributes type)
|
|
|
|
|
(append attributes (soap-xs-type-attributes type)))
|
|
|
|
|
(setf (soap-xs-type-attribute-groups type)
|
|
|
|
|
(append attribute-groups (soap-xs-type-attribute-groups type)))
|
|
|
|
|
(when (soap-xs-complex-type-p type)
|
|
|
|
|
(setf (soap-xs-complex-type-is-group type)
|
|
|
|
|
(eq node-name 'xsd:group)))
|
|
|
|
|
type))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-sequence (node)
|
|
|
|
|
"Parse a sequence definition from XML NODE.
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-20 22:27:53 +00:00
|
|
|
|
Returns a `soap-xs-complex-type'."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (memq (soap-l2wk (xml-node-name node))
|
|
|
|
|
'(xsd:sequence xsd:choice xsd:all))
|
|
|
|
|
nil
|
|
|
|
|
"unexpected node: %s" (soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(let ((type (make-soap-xs-complex-type)))
|
|
|
|
|
|
|
|
|
|
(setf (soap-xs-complex-type-indicator type)
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-ecase (soap-l2wk (xml-node-name node))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:sequence 'sequence)
|
|
|
|
|
(xsd:all 'all)
|
|
|
|
|
(xsd:choice 'choice)))
|
|
|
|
|
|
|
|
|
|
(setf (soap-xs-complex-type-optional? type) (soap-node-optional node))
|
|
|
|
|
(setf (soap-xs-complex-type-multiple? type) (soap-node-multiple node))
|
|
|
|
|
|
|
|
|
|
(dolist (r (xml-node-children node))
|
|
|
|
|
(unless (stringp r) ; skip the white space
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name r))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((xsd:element xsd:group)
|
|
|
|
|
(push (soap-xs-parse-element r)
|
|
|
|
|
(soap-xs-complex-type-elements type)))
|
|
|
|
|
((xsd:sequence xsd:choice xsd:all)
|
|
|
|
|
;; an inline sequence, choice or all node
|
|
|
|
|
(let ((choice (soap-xs-parse-sequence r)))
|
|
|
|
|
(push (make-soap-xs-element :name nil :type^ choice)
|
|
|
|
|
(soap-xs-complex-type-elements type))))
|
|
|
|
|
(xsd:attribute
|
|
|
|
|
(push (soap-xs-parse-attribute r)
|
|
|
|
|
(soap-xs-type-attributes type)))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(push (soap-xs-parse-attribute-group r)
|
|
|
|
|
(soap-xs-type-attribute-groups type))))))
|
|
|
|
|
|
|
|
|
|
(setf (soap-xs-complex-type-elements type)
|
|
|
|
|
(nreverse (soap-xs-complex-type-elements type)))
|
|
|
|
|
|
|
|
|
|
type))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-parse-extension-or-restriction (node)
|
|
|
|
|
"Parse an extension or restriction definition from XML NODE.
|
|
|
|
|
Return a `soap-xs-complex-type'."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (memq (soap-l2wk (xml-node-name node))
|
|
|
|
|
'(xsd:extension xsd:restriction))
|
|
|
|
|
nil
|
|
|
|
|
"unexpected node: %s" (soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let (type
|
|
|
|
|
attributes
|
|
|
|
|
attribute-groups
|
|
|
|
|
array?
|
|
|
|
|
(base (xml-get-attribute-or-nil node 'base)))
|
|
|
|
|
|
|
|
|
|
;; Array declarations are recognized specially, it is unclear to me how
|
|
|
|
|
;; they could be treated generally...
|
|
|
|
|
(setq array?
|
|
|
|
|
(and (eq (soap-l2wk (xml-node-name node)) 'xsd:restriction)
|
|
|
|
|
(equal base (soap-wk2l "soapenc:Array"))))
|
|
|
|
|
|
|
|
|
|
(dolist (def (xml-node-children node))
|
|
|
|
|
(when (consp def) ; skip text nodes
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name def))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((xsd:sequence xsd:choice xsd:all)
|
|
|
|
|
(setq type (soap-xs-parse-sequence def)))
|
|
|
|
|
(xsd:attribute
|
|
|
|
|
(if array?
|
|
|
|
|
(let ((array-type
|
|
|
|
|
(soap-xml-get-attribute-or-nil1 def 'wsdl:arrayType)))
|
|
|
|
|
(when (and array-type
|
|
|
|
|
(string-match "^\\(.*\\)\\[\\]$" array-type))
|
|
|
|
|
;; Override
|
|
|
|
|
(setq base (match-string 1 array-type))))
|
|
|
|
|
;; else
|
|
|
|
|
(push (soap-xs-parse-attribute def) attributes)))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(push (soap-xs-parse-attribute-group def) attribute-groups)))))
|
|
|
|
|
|
|
|
|
|
(unless type
|
|
|
|
|
(setq type (make-soap-xs-complex-type))
|
|
|
|
|
(when array?
|
|
|
|
|
(setf (soap-xs-complex-type-indicator type) 'array)))
|
|
|
|
|
|
|
|
|
|
(setf (soap-xs-complex-type-base type) (soap-l2fq base))
|
|
|
|
|
(setf (soap-xs-complex-type-attributes type) attributes)
|
|
|
|
|
(setf (soap-xs-complex-type-attribute-groups type) attribute-groups)
|
|
|
|
|
type))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-xs-complex-type (type wsdl)
|
|
|
|
|
"Replace names in TYPE with the referenced objects in the WSDL.
|
|
|
|
|
This is a specialization of `soap-resolve-references' for
|
|
|
|
|
`soap-xs-complex-type' objects.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
|
|
|
|
|
(let ((namespace (soap-element-namespace-tag type)))
|
|
|
|
|
(when namespace
|
|
|
|
|
(let ((nstag (car (rassoc namespace (soap-wsdl-alias-table wsdl)))))
|
|
|
|
|
(when nstag
|
|
|
|
|
(setf (soap-element-namespace-tag type) nstag)))))
|
|
|
|
|
|
|
|
|
|
(let ((base (soap-xs-complex-type-base type)))
|
|
|
|
|
(cond ((soap-name-p base)
|
|
|
|
|
(setf (soap-xs-complex-type-base type)
|
|
|
|
|
(soap-wsdl-get base wsdl 'soap-xs-type-p)))
|
|
|
|
|
((soap-xs-type-p base)
|
|
|
|
|
(soap-resolve-references base wsdl))))
|
|
|
|
|
(let (all-elements)
|
|
|
|
|
(dolist (element (soap-xs-complex-type-elements type))
|
|
|
|
|
(if (soap-xs-element-is-group element)
|
|
|
|
|
;; This is an xsd:group element that references an xsd:group node,
|
|
|
|
|
;; which we treat as a complex type. We replace the reference
|
|
|
|
|
;; element by inlining the elements of the referenced xsd:group
|
|
|
|
|
;; (complex type) node.
|
|
|
|
|
(let ((type (soap-wsdl-get
|
|
|
|
|
(soap-xs-element-reference element)
|
|
|
|
|
wsdl (lambda (type)
|
|
|
|
|
(and
|
|
|
|
|
(soap-xs-complex-type-p type)
|
|
|
|
|
(soap-xs-complex-type-is-group type))))))
|
|
|
|
|
(dolist (element (soap-xs-complex-type-elements type))
|
|
|
|
|
(soap-resolve-references element wsdl)
|
|
|
|
|
(push element all-elements)))
|
|
|
|
|
;; This is a non-xsd:group node so just add it directly.
|
|
|
|
|
(soap-resolve-references element wsdl)
|
|
|
|
|
(push element all-elements)))
|
|
|
|
|
(setf (soap-xs-complex-type-elements type) (nreverse all-elements)))
|
|
|
|
|
(dolist (attribute (soap-xs-type-attributes type))
|
|
|
|
|
(soap-resolve-references attribute wsdl))
|
|
|
|
|
(dolist (attribute-group (soap-xs-type-attribute-groups type))
|
|
|
|
|
(soap-resolve-references attribute-group wsdl)))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-complex-type-attributes (value type)
|
|
|
|
|
"Encode the XML attributes for encoding VALUE according to TYPE.
|
|
|
|
|
The xsi:type and optional xsi:nil attributes are added, plus
|
|
|
|
|
additional attributes needed for arrays types, if applicable. The
|
|
|
|
|
attributes are inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-attributes' for
|
|
|
|
|
`soap-xs-complex-type' objects."
|
|
|
|
|
(if (eq (soap-xs-complex-type-indicator type) 'array)
|
|
|
|
|
(let ((element-type (soap-xs-complex-type-base type)))
|
|
|
|
|
(insert " xsi:type=\"soapenc:Array\"")
|
|
|
|
|
(insert " soapenc:arrayType=\""
|
|
|
|
|
(soap-element-fq-name element-type)
|
|
|
|
|
"[" (format "%s" (length value)) "]" "\""))
|
|
|
|
|
;; else
|
|
|
|
|
(progn
|
|
|
|
|
(dolist (a (soap-get-xs-attributes type))
|
|
|
|
|
(let ((element-name (soap-element-name a)))
|
|
|
|
|
(if (soap-xs-attribute-default a)
|
|
|
|
|
(insert " " element-name
|
|
|
|
|
"=\"" (soap-xs-attribute-default a) "\"")
|
|
|
|
|
(dolist (value-pair value)
|
|
|
|
|
(when (equal element-name (symbol-name (car value-pair)))
|
|
|
|
|
(insert " " element-name
|
|
|
|
|
"=\"" (cdr value-pair) "\""))))))
|
|
|
|
|
;; If this is not an empty type, and we have no value, mark it as nil
|
|
|
|
|
(when (and (soap-xs-complex-type-indicator type) (null value))
|
|
|
|
|
(insert " xsi:nil=\"true\"")))))
|
|
|
|
|
|
|
|
|
|
(defun soap-get-candidate-elements (element)
|
|
|
|
|
"Return a list of elements that are compatible with ELEMENT.
|
|
|
|
|
The returned list includes ELEMENT's references and
|
|
|
|
|
alternatives."
|
|
|
|
|
(let ((reference (soap-xs-element-reference element)))
|
|
|
|
|
;; If the element is a reference, append the reference and its
|
|
|
|
|
;; alternatives...
|
|
|
|
|
(if reference
|
|
|
|
|
(append (list reference)
|
|
|
|
|
(soap-xs-element-alternatives reference))
|
|
|
|
|
;; ...otherwise append the element itself and its alternatives.
|
|
|
|
|
(append (list element)
|
|
|
|
|
(soap-xs-element-alternatives element)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-encode-xs-complex-type (value type)
|
|
|
|
|
"Encode the VALUE according to TYPE.
|
|
|
|
|
The data is inserted in the current buffer at the current
|
|
|
|
|
position.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-encode-value' for
|
|
|
|
|
`soap-xs-complex-type' objects."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-xs-complex-type-indicator type)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(array
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(error "Arrays of type soap-encode-xs-complex-type are handled elsewhere"))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((sequence choice all nil)
|
2019-07-24 08:56:59 +00:00
|
|
|
|
(let ((type-list (list type))
|
|
|
|
|
(type-elements '()))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
;; Collect all base types
|
|
|
|
|
(let ((base (soap-xs-complex-type-base type)))
|
|
|
|
|
(while base
|
|
|
|
|
(push base type-list)
|
|
|
|
|
(setq base (soap-xs-complex-type-base base))))
|
|
|
|
|
|
2019-07-24 08:56:59 +00:00
|
|
|
|
;; Collect type elements, eliminating duplicates from the type
|
|
|
|
|
;; hierarchy.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dolist (type type-list)
|
|
|
|
|
(dolist (element (soap-xs-complex-type-elements type))
|
2019-07-24 08:56:59 +00:00
|
|
|
|
(unless (member element type-elements)
|
|
|
|
|
(setq type-elements (append type-elements (list element))))))
|
|
|
|
|
|
|
|
|
|
(dolist (element type-elements)
|
|
|
|
|
(catch 'done
|
|
|
|
|
(let ((instance-count 0))
|
|
|
|
|
(dolist (candidate (soap-get-candidate-elements element))
|
|
|
|
|
(let ((e-name (soap-xs-element-name candidate)))
|
|
|
|
|
(if e-name
|
|
|
|
|
(let ((e-name (intern e-name)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dolist (v value)
|
2019-07-24 08:56:59 +00:00
|
|
|
|
(when (equal (car v) e-name)
|
|
|
|
|
(cl-incf instance-count)
|
|
|
|
|
(soap-encode-value (cdr v) candidate))))
|
|
|
|
|
(if (soap-xs-complex-type-indicator type)
|
|
|
|
|
(let ((current-point (point)))
|
|
|
|
|
;; Check if encoding happened by checking if
|
|
|
|
|
;; characters were inserted in the buffer.
|
|
|
|
|
(soap-encode-value value candidate)
|
|
|
|
|
(when (not (equal current-point (point)))
|
|
|
|
|
(cl-incf instance-count)))
|
|
|
|
|
(dolist (v value)
|
|
|
|
|
(let ((current-point (point)))
|
|
|
|
|
(soap-encode-value v candidate)
|
|
|
|
|
(when (not (equal current-point (point)))
|
|
|
|
|
(cl-incf instance-count))))))))
|
|
|
|
|
;; Do some sanity checking
|
|
|
|
|
(let* ((indicator (soap-xs-complex-type-indicator type))
|
|
|
|
|
(element-type (soap-xs-element-type element))
|
|
|
|
|
(reference (soap-xs-element-reference element))
|
|
|
|
|
(e-name (or (soap-xs-element-name element)
|
|
|
|
|
(and reference
|
|
|
|
|
(soap-xs-element-name reference)))))
|
|
|
|
|
(cond ((and (eq indicator 'choice)
|
|
|
|
|
(> instance-count 0))
|
|
|
|
|
;; This was a choice node and we encoded
|
|
|
|
|
;; one instance.
|
|
|
|
|
(throw 'done t))
|
|
|
|
|
((and (not (eq indicator 'choice))
|
|
|
|
|
(= instance-count 0)
|
|
|
|
|
(not (soap-xs-element-optional? element))
|
|
|
|
|
(and (soap-xs-complex-type-p element-type)
|
|
|
|
|
(not (soap-xs-complex-type-optional-p
|
|
|
|
|
element-type))))
|
|
|
|
|
(soap-warning
|
|
|
|
|
"While encoding %s: missing non-nillable slot %s"
|
|
|
|
|
value e-name))
|
|
|
|
|
((and (> instance-count 1)
|
|
|
|
|
(not (soap-xs-element-multiple? element))
|
|
|
|
|
(and (soap-xs-complex-type-p element-type)
|
|
|
|
|
(not (soap-xs-complex-type-multiple-p
|
|
|
|
|
element-type))))
|
|
|
|
|
(soap-warning
|
|
|
|
|
(concat "While encoding %s: expected single,"
|
|
|
|
|
" found multiple elements for slot %s")
|
|
|
|
|
value e-name)))))))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(t
|
|
|
|
|
(error "Don't know how to encode complex type: %s"
|
|
|
|
|
(soap-xs-complex-type-indicator type)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xml-get-children-fq (node child-name)
|
|
|
|
|
"Return the children of NODE named CHILD-NAME.
|
|
|
|
|
This is the same as `xml-get-children1', but NODE's local
|
|
|
|
|
namespace is used to resolve the children's namespace tags."
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (c (xml-node-children node))
|
|
|
|
|
(when (and (consp c)
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
;; We use `ignore-errors' here because we want to silently
|
|
|
|
|
;; skip nodes for which we cannot convert them to a
|
|
|
|
|
;; well-known name.
|
|
|
|
|
(equal (ignore-errors
|
|
|
|
|
(soap-l2fq (xml-node-name c)))
|
|
|
|
|
child-name)))
|
|
|
|
|
(push c result)))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-element-get-fq-name (element wsdl)
|
|
|
|
|
"Return ELEMENT's fully-qualified name using WSDL's alias table.
|
|
|
|
|
Return nil if ELEMENT does not have a name."
|
|
|
|
|
(let* ((ns-aliases (soap-wsdl-alias-table wsdl))
|
|
|
|
|
(ns-name (cdr (assoc
|
|
|
|
|
(soap-element-namespace-tag element)
|
|
|
|
|
ns-aliases))))
|
|
|
|
|
(when ns-name
|
|
|
|
|
(cons ns-name (soap-element-name element)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-complex-type-optional-p (type)
|
|
|
|
|
"Return t if TYPE or any of TYPE's ancestor types is optional.
|
|
|
|
|
Return nil otherwise."
|
|
|
|
|
(when type
|
|
|
|
|
(or (soap-xs-complex-type-optional? type)
|
|
|
|
|
(and (soap-xs-complex-type-p type)
|
|
|
|
|
(soap-xs-complex-type-optional-p
|
|
|
|
|
(soap-xs-complex-type-base type))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-xs-complex-type-multiple-p (type)
|
|
|
|
|
"Return t if TYPE or any of TYPE's ancestor types permits multiple elements.
|
|
|
|
|
Return nil otherwise."
|
|
|
|
|
(when type
|
|
|
|
|
(or (soap-xs-complex-type-multiple? type)
|
|
|
|
|
(and (soap-xs-complex-type-p type)
|
|
|
|
|
(soap-xs-complex-type-multiple-p
|
|
|
|
|
(soap-xs-complex-type-base type))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-get-xs-attributes-from-groups (attribute-groups)
|
|
|
|
|
"Return a list of attributes from all ATTRIBUTE-GROUPS."
|
|
|
|
|
(let (attributes)
|
|
|
|
|
(dolist (group attribute-groups)
|
|
|
|
|
(let ((sub-groups (soap-xs-attribute-group-attribute-groups group)))
|
|
|
|
|
(setq attributes (append attributes
|
|
|
|
|
(soap-get-xs-attributes-from-groups sub-groups)
|
|
|
|
|
(soap-xs-attribute-group-attributes group)))))
|
|
|
|
|
attributes))
|
|
|
|
|
|
|
|
|
|
(defun soap-get-xs-attributes (type)
|
|
|
|
|
"Return a list of all of TYPE's and TYPE's ancestors' attributes."
|
|
|
|
|
(let* ((base (and (soap-xs-complex-type-p type)
|
|
|
|
|
(soap-xs-complex-type-base type)))
|
|
|
|
|
(attributes (append (soap-xs-type-attributes type)
|
|
|
|
|
(soap-get-xs-attributes-from-groups
|
|
|
|
|
(soap-xs-type-attribute-groups type)))))
|
|
|
|
|
(if base
|
|
|
|
|
(append attributes (soap-get-xs-attributes base))
|
|
|
|
|
attributes)))
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-xs-attributes (type node)
|
|
|
|
|
"Use TYPE, a `soap-xs-complex-type', to decode the attributes of NODE."
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (attribute (soap-get-xs-attributes type))
|
|
|
|
|
(let* ((name (soap-xs-attribute-name attribute))
|
|
|
|
|
(attribute-type (soap-xs-attribute-type attribute))
|
|
|
|
|
(symbol (intern name))
|
|
|
|
|
(value (xml-get-attribute-or-nil node symbol)))
|
|
|
|
|
;; We don't support attribute uses: required, optional, prohibited.
|
|
|
|
|
(cond
|
|
|
|
|
((soap-xs-basic-type-p attribute-type)
|
|
|
|
|
;; Basic type values are validated by xml.el.
|
|
|
|
|
(when value
|
|
|
|
|
(push (cons symbol
|
|
|
|
|
;; Create a fake XML node to satisfy the
|
|
|
|
|
;; soap-decode-xs-basic-type API.
|
|
|
|
|
(soap-decode-xs-basic-type attribute-type
|
|
|
|
|
(list symbol nil value)))
|
|
|
|
|
result)))
|
|
|
|
|
((soap-xs-simple-type-p attribute-type)
|
|
|
|
|
(when value
|
|
|
|
|
(push (cons symbol
|
|
|
|
|
(soap-validate-xs-simple-type value attribute-type))
|
|
|
|
|
result)))
|
|
|
|
|
(t
|
|
|
|
|
(error (concat "Attribute %s is of type %s which is"
|
|
|
|
|
" not a basic or simple type")
|
|
|
|
|
name (soap-name-p attribute))))))
|
|
|
|
|
result))
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-xs-complex-type (type node)
|
|
|
|
|
"Use TYPE, a `soap-xs-complex-type', to decode the contents of NODE.
|
|
|
|
|
A LISP value is returned based on the contents of NODE and the
|
|
|
|
|
type-info stored in TYPE.
|
|
|
|
|
|
|
|
|
|
This is a specialization of `soap-decode-type' for
|
|
|
|
|
`soap-xs-basic-type' objects."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-xs-complex-type-indicator type)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(array
|
|
|
|
|
(let ((result nil)
|
|
|
|
|
(element-type (soap-xs-complex-type-base type)))
|
|
|
|
|
(dolist (node (xml-node-children node))
|
|
|
|
|
(when (consp node)
|
|
|
|
|
(push (soap-decode-type element-type node) result)))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
((sequence choice all nil)
|
|
|
|
|
(let ((result nil)
|
|
|
|
|
(base (soap-xs-complex-type-base type)))
|
|
|
|
|
(when base
|
|
|
|
|
(setq result (nreverse (soap-decode-type base node))))
|
|
|
|
|
(catch 'done
|
|
|
|
|
(dolist (element (soap-xs-complex-type-elements type))
|
|
|
|
|
(let* ((instance-count 0)
|
|
|
|
|
(e-name (soap-xs-element-name element))
|
|
|
|
|
;; Heuristic: guess if we need to decode using local
|
|
|
|
|
;; namespaces.
|
|
|
|
|
(use-fq-names (string-match ":" (symbol-name (car node))))
|
|
|
|
|
(children (if e-name
|
|
|
|
|
(if use-fq-names
|
|
|
|
|
;; Find relevant children
|
|
|
|
|
;; using local namespaces by
|
|
|
|
|
;; searching for the element's
|
|
|
|
|
;; fully-qualified name.
|
|
|
|
|
(soap-xml-get-children-fq
|
|
|
|
|
node
|
|
|
|
|
(soap-xs-element-get-fq-name
|
|
|
|
|
element soap-current-wsdl))
|
|
|
|
|
;; No local namespace resolution
|
|
|
|
|
;; needed so use the element's
|
|
|
|
|
;; name unqualified.
|
|
|
|
|
(xml-get-children node (intern e-name)))
|
|
|
|
|
;; e-name is nil so a) we don't know which
|
|
|
|
|
;; children to operate on, and b) we want to
|
|
|
|
|
;; re-use soap-decode-xs-complex-type, which
|
|
|
|
|
;; expects a node argument with a complex
|
|
|
|
|
;; type; therefore we need to operate on the
|
|
|
|
|
;; entire node. We wrap node in a list so
|
|
|
|
|
;; that it will carry through as "node" in the
|
|
|
|
|
;; loop below.
|
|
|
|
|
;;
|
|
|
|
|
;; For example:
|
|
|
|
|
;;
|
|
|
|
|
;; Element Type:
|
|
|
|
|
;; <xs:complexType name="A">
|
|
|
|
|
;; <xs:sequence>
|
|
|
|
|
;; <xs:element name="B" type="t:BType"/>
|
|
|
|
|
;; <xs:choice>
|
|
|
|
|
;; <xs:element name="C" type="xs:string"/>
|
|
|
|
|
;; <xs:element name="D" type="t:DType"/>
|
|
|
|
|
;; </xs:choice>
|
|
|
|
|
;; </xs:sequence>
|
|
|
|
|
;; </xs:complexType>
|
|
|
|
|
;;
|
|
|
|
|
;; Node:
|
|
|
|
|
;; <t:A>
|
|
|
|
|
;; <t:B tag="b"/>
|
|
|
|
|
;; <t:C>1</C>
|
|
|
|
|
;; </t:A>
|
|
|
|
|
;;
|
|
|
|
|
;; soap-decode-type will be called below with:
|
|
|
|
|
;;
|
|
|
|
|
;; element =
|
|
|
|
|
;; <xs:choice>
|
|
|
|
|
;; <xs:element name="C" type="xs:string"/>
|
|
|
|
|
;; <xs:element name="D" type="t:DType"/>
|
|
|
|
|
;; </xs:choice>
|
|
|
|
|
;; node =
|
|
|
|
|
;; <t:A>
|
|
|
|
|
;; <t:B tag="b"/>
|
|
|
|
|
;; <t:C>1</C>
|
|
|
|
|
;; </t:A>
|
|
|
|
|
(list node)))
|
|
|
|
|
(element-type (soap-xs-element-type element)))
|
|
|
|
|
(dolist (node children)
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-incf instance-count)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let* ((attributes
|
|
|
|
|
(soap-decode-xs-attributes element-type node))
|
|
|
|
|
;; Attributes may specify xsi:type override.
|
|
|
|
|
(element-type
|
|
|
|
|
(if (soap-xml-get-attribute-or-nil1 node 'xsi:type)
|
|
|
|
|
(soap-wsdl-get
|
|
|
|
|
(soap-l2fq
|
|
|
|
|
(soap-xml-get-attribute-or-nil1 node
|
|
|
|
|
'xsi:type))
|
|
|
|
|
soap-current-wsdl 'soap-xs-type-p t)
|
|
|
|
|
element-type))
|
|
|
|
|
(decoded-child (soap-decode-type element-type node)))
|
|
|
|
|
(if e-name
|
|
|
|
|
(push (cons (intern e-name)
|
|
|
|
|
(append attributes decoded-child)) result)
|
|
|
|
|
;; When e-name is nil we don't want to introduce an extra
|
|
|
|
|
;; level of nesting, so we splice the decoding into
|
|
|
|
|
;; result.
|
|
|
|
|
(setq result (append decoded-child result)))))
|
|
|
|
|
(cond ((and (eq (soap-xs-complex-type-indicator type) 'choice)
|
|
|
|
|
;; Choices can allow multiple values.
|
|
|
|
|
(not (soap-xs-complex-type-multiple-p type))
|
|
|
|
|
(> instance-count 0))
|
|
|
|
|
;; This was a choice node, and we decoded one value.
|
|
|
|
|
(throw 'done t))
|
|
|
|
|
|
|
|
|
|
;; Do some sanity checking
|
|
|
|
|
((and (not (eq (soap-xs-complex-type-indicator type)
|
|
|
|
|
'choice))
|
|
|
|
|
(= instance-count 0)
|
|
|
|
|
(not (soap-xs-element-optional? element))
|
|
|
|
|
(and (soap-xs-complex-type-p element-type)
|
|
|
|
|
(not (soap-xs-complex-type-optional-p
|
|
|
|
|
element-type))))
|
|
|
|
|
(soap-warning "missing non-nillable slot %s" e-name))
|
|
|
|
|
((and (> instance-count 1)
|
|
|
|
|
(not (soap-xs-complex-type-multiple-p type))
|
|
|
|
|
(not (soap-xs-element-multiple? element))
|
|
|
|
|
(and (soap-xs-complex-type-p element-type)
|
|
|
|
|
(not (soap-xs-complex-type-multiple-p
|
|
|
|
|
element-type))))
|
|
|
|
|
(soap-warning "expected single %s slot, found multiple"
|
|
|
|
|
e-name))))))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
(t
|
|
|
|
|
(error "Don't know how to decode complex type: %s"
|
|
|
|
|
(soap-xs-complex-type-indicator type)))))
|
|
|
|
|
|
|
|
|
|
;; Register methods for `soap-xs-complex-type'
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((tag (soap-type-of (make-soap-xs-complex-type))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(put tag 'soap-resolve-references
|
|
|
|
|
#'soap-resolve-references-for-xs-complex-type)
|
|
|
|
|
(put tag 'soap-attribute-encoder #'soap-encode-xs-complex-type-attributes)
|
|
|
|
|
(put tag 'soap-encoder #'soap-encode-xs-complex-type)
|
|
|
|
|
(put tag 'soap-decoder #'soap-decode-xs-complex-type))
|
|
|
|
|
|
|
|
|
|
;;;; WSDL documents
|
|
|
|
|
;;;;; WSDL document elements
|
|
|
|
|
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-message (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
parts ; ALIST of NAME => WSDL-TYPE name
|
|
|
|
|
)
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-operation (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
parameter-order
|
|
|
|
|
input ; (NAME . MESSAGE)
|
|
|
|
|
output ; (NAME . MESSAGE)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
faults ; a list of (NAME . MESSAGE)
|
|
|
|
|
input-action ; WS-addressing action string
|
|
|
|
|
output-action) ; WS-addressing action string
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-port-type (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
operations) ; a namespace of operations
|
|
|
|
|
|
|
|
|
|
;; A bound operation is an operation which has a soap action and a use
|
|
|
|
|
;; method attached -- these are attached as part of a binding and we
|
|
|
|
|
;; can have different bindings for the same operations.
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct soap-bound-operation
|
2011-02-16 09:25:37 +00:00
|
|
|
|
operation ; SOAP-OPERATION
|
|
|
|
|
soap-action ; value for SOAPAction HTTP header
|
2015-10-24 12:33:18 +00:00
|
|
|
|
soap-headers ; list of (message part use)
|
|
|
|
|
soap-body ; message parts present in the body
|
2011-02-16 19:33:35 +00:00
|
|
|
|
use ; 'literal or 'encoded, see
|
2015-10-24 12:33:18 +00:00
|
|
|
|
; http://www.w3.org/TR/wsdl#_soap:body
|
2011-02-16 09:25:37 +00:00
|
|
|
|
)
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-binding (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
port-type
|
|
|
|
|
(operations (make-hash-table :test 'equal) :readonly t))
|
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-port (:include soap-element))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
service-url
|
|
|
|
|
binding)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;; The WSDL document
|
|
|
|
|
|
|
|
|
|
;; The WSDL data structure used for encoding/decoding SOAP messages
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-defstruct (soap-wsdl
|
|
|
|
|
;; NOTE: don't call this constructor, see `soap-make-wsdl'
|
|
|
|
|
(:constructor soap-make-wsdl^)
|
|
|
|
|
(:copier soap-copy-wsdl))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
origin ; file or URL from which this wsdl was loaded
|
2015-10-24 12:33:18 +00:00
|
|
|
|
current-file ; most-recently fetched file or URL
|
|
|
|
|
xmlschema-imports ; a list of schema imports
|
2011-02-16 09:25:37 +00:00
|
|
|
|
ports ; a list of SOAP-PORT instances
|
|
|
|
|
alias-table ; a list of namespace aliases
|
|
|
|
|
namespaces ; a list of namespaces
|
|
|
|
|
)
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-make-wsdl (origin)
|
2015-11-10 18:22:29 +00:00
|
|
|
|
"Create a new WSDL document, loaded from ORIGIN, and initialize it."
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((wsdl (soap-make-wsdl^ :origin origin)))
|
|
|
|
|
|
|
|
|
|
;; Add the XSD types to the wsdl document
|
|
|
|
|
(let ((ns (soap-make-xs-basic-types
|
|
|
|
|
"http://www.w3.org/2001/XMLSchema" "xsd")))
|
|
|
|
|
(soap-wsdl-add-namespace ns wsdl)
|
|
|
|
|
(soap-wsdl-add-alias "xsd" (soap-namespace-name ns) wsdl))
|
|
|
|
|
|
|
|
|
|
;; Add the soapenc types to the wsdl document
|
|
|
|
|
(let ((ns (soap-make-xs-basic-types
|
|
|
|
|
"http://schemas.xmlsoap.org/soap/encoding/" "soapenc")))
|
|
|
|
|
(soap-wsdl-add-namespace ns wsdl)
|
|
|
|
|
(soap-wsdl-add-alias "soapenc" (soap-namespace-name ns) wsdl))
|
|
|
|
|
|
|
|
|
|
wsdl))
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(defun soap-wsdl-add-alias (alias name wsdl)
|
|
|
|
|
"Add a namespace ALIAS for NAME to the WSDL document."
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((existing (assoc alias (soap-wsdl-alias-table wsdl))))
|
|
|
|
|
(if existing
|
|
|
|
|
(unless (equal (cdr existing) name)
|
|
|
|
|
(warn "Redefining alias %s from %s to %s"
|
|
|
|
|
alias (cdr existing) name)
|
|
|
|
|
(push (cons alias name) (soap-wsdl-alias-table wsdl)))
|
|
|
|
|
(push (cons alias name) (soap-wsdl-alias-table wsdl)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-wsdl-find-namespace (name wsdl)
|
|
|
|
|
"Find a namespace by NAME in the WSDL document."
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (ns (soap-wsdl-namespaces wsdl))
|
|
|
|
|
(when (equal name (soap-namespace-name ns))
|
|
|
|
|
(throw 'found ns)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-wsdl-add-namespace (ns wsdl)
|
|
|
|
|
"Add the namespace NS to the WSDL document.
|
|
|
|
|
If a namespace by this name already exists in WSDL, individual
|
|
|
|
|
elements will be added to it."
|
|
|
|
|
(let ((existing (soap-wsdl-find-namespace (soap-namespace-name ns) wsdl)))
|
|
|
|
|
(if existing
|
|
|
|
|
;; Add elements from NS to EXISTING, replacing existing values.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(maphash (lambda (_key value)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(dolist (v value)
|
|
|
|
|
(soap-namespace-put v existing)))
|
|
|
|
|
(soap-namespace-elements ns))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(push ns (soap-wsdl-namespaces wsdl)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-wsdl-get (name wsdl &optional predicate use-local-alias-table)
|
|
|
|
|
"Retrieve element NAME from the WSDL document.
|
|
|
|
|
|
|
|
|
|
PREDICATE is used to differentiate between elements when NAME
|
|
|
|
|
refers to multiple elements. A typical value for this would be a
|
|
|
|
|
structure predicate for the type of element you want to retrieve.
|
|
|
|
|
For example, to retrieve a message named \"foo\" when other
|
|
|
|
|
elements named \"foo\" exist in the WSDL you could use:
|
|
|
|
|
|
2015-09-03 22:31:12 +00:00
|
|
|
|
(soap-wsdl-get \"foo\" WSDL \\='soap-message-p)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
Fix minor quoting problems in doc strings
These were glitches regardless of how or whether we tackle the
problem of grave accent in doc strings.
* lisp/calc/calc-aent.el (math-restore-placeholders):
* lisp/ido.el (ido-ignore-buffers, ido-ignore-files):
* lisp/leim/quail/cyrillic.el ("bulgarian-alt-phonetic"):
* lisp/leim/quail/hebrew.el ("hebrew-new")
("hebrew-biblical-sil"):
* lisp/leim/quail/thai.el ("thai-kesmanee"):
* lisp/progmodes/idlw-shell.el (idlwave-shell-file-name-chars):
Used curved quotes to avoid ambiguities like ‘`''’ in doc strings.
* lisp/calendar/calendar.el (calendar-month-abbrev-array):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-cache-flush-fcn):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-copy)
(semantic-tag-components):
* lisp/cedet/srecode/cpp.el (srecode-semantic-handle-:cpp):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-all-constp):
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
* lisp/emacs-lisp/generator.el (iter-next):
* lisp/gnus/gnus-art.el (gnus-treat-strip-list-identifiers)
(gnus-article-mode-syntax-table):
* lisp/net/rlogin.el (rlogin-directory-tracking-mode):
* lisp/net/soap-client.el (soap-wsdl-get):
* lisp/net/telnet.el (telnet-mode):
* lisp/org/org-compat.el (org-number-sequence):
* lisp/org/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/org/ox-html.el (org-html-link-org-files-as-html):
* lisp/play/handwrite.el (handwrite-10pt, handwrite-11pt)
(handwrite-12pt, handwrite-13pt):
* lisp/progmodes/f90.el (f90-mode, f90-abbrev-start):
* lisp/progmodes/idlwave.el (idlwave-mode, idlwave-check-abbrev):
* lisp/progmodes/verilog-mode.el (verilog-tool)
(verilog-string-replace-matches, verilog-preprocess)
(verilog-auto-insert-lisp, verilog-auto-insert-last):
* lisp/textmodes/makeinfo.el (makeinfo-options):
* src/font.c (Ffont_spec):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.
* lisp/erc/erc-backend.el (erc-process-sentinel-2):
Fix minor quoting problem in other string.
* lisp/leim/quail/ethiopic.el ("ethiopic"):
* lisp/term/tvi970.el (tvi970-set-keypad-mode):
Omit unnecessary quotes.
* lisp/faces.el (set-face-attribute, set-face-underline)
(set-face-inverse-video, x-create-frame-with-faces):
* lisp/gnus/gnus-group.el (gnus-group-nnimap-edit-acl):
* lisp/mail/supercite.el (sc-attribs-%@-addresses)
(sc-attribs-!-addresses, sc-attribs-<>-addresses):
* lisp/net/tramp.el (tramp-methods):
* lisp/recentf.el (recentf-show-file-shortcuts-flag):
* lisp/textmodes/artist.el (artist-ellipse-right-char)
(artist-ellipse-left-char, artist-vaporize-fuzziness)
(artist-spray-chars, artist-mode, artist-replace-string)
(artist-put-pixel, artist-text-see-thru):
* lisp/vc/ediff-util.el (ediff-submit-report):
* lisp/vc/log-edit.el (log-edit-changelog-full-paragraphs):
Use double-quotes rather than TeX markup in doc strings.
* lisp/skeleton.el (skeleton-pair-insert-maybe):
Reword to avoid the need for grave accent and apostrophe.
* lisp/xt-mouse.el (xterm-mouse-tracking-enable-sequence):
Don't use grave and acute accents to quote.
2015-05-19 21:59:15 +00:00
|
|
|
|
If USE-LOCAL-ALIAS-TABLE is not nil, `soap-local-xmlns' will be
|
2011-02-16 09:25:37 +00:00
|
|
|
|
used to resolve the namespace alias."
|
|
|
|
|
(let ((alias-table (soap-wsdl-alias-table wsdl))
|
|
|
|
|
namespace element-name element)
|
|
|
|
|
|
|
|
|
|
(when (symbolp name)
|
|
|
|
|
(setq name (symbol-name name)))
|
|
|
|
|
|
|
|
|
|
(when use-local-alias-table
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(setq alias-table (append soap-local-xmlns alias-table)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(cond ((consp name) ; a fully qualified name, as returned by `soap-l2fq'
|
|
|
|
|
(setq element-name (cdr name))
|
|
|
|
|
(when (symbolp element-name)
|
|
|
|
|
(setq element-name (symbol-name element-name)))
|
|
|
|
|
(setq namespace (soap-wsdl-find-namespace (car name) wsdl))
|
|
|
|
|
(unless namespace
|
|
|
|
|
(error "Soap-wsdl-get(%s): unknown namespace: %s" name namespace)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
((string-match "^\\(.*\\):\\(.*\\)$" name)
|
|
|
|
|
(setq element-name (match-string 2 name))
|
|
|
|
|
|
|
|
|
|
(let* ((ns-alias (match-string 1 name))
|
|
|
|
|
(ns-name (cdr (assoc ns-alias alias-table))))
|
|
|
|
|
(unless ns-name
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(error "Soap-wsdl-get(%s): cannot find namespace alias %s"
|
2015-10-24 12:33:18 +00:00
|
|
|
|
name ns-alias))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setq namespace (soap-wsdl-find-namespace ns-name wsdl))
|
|
|
|
|
(unless namespace
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(error
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"Soap-wsdl-get(%s): unknown namespace %s, referenced as %s"
|
|
|
|
|
name ns-name ns-alias))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(t
|
|
|
|
|
(error "Soap-wsdl-get(%s): bad name" name)))
|
|
|
|
|
|
|
|
|
|
(setq element (soap-namespace-get
|
|
|
|
|
element-name namespace
|
|
|
|
|
(if predicate
|
|
|
|
|
(lambda (e)
|
|
|
|
|
(or (funcall 'soap-namespace-link-p e)
|
|
|
|
|
(funcall predicate e)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
nil)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(unless element
|
|
|
|
|
(error "Soap-wsdl-get(%s): cannot find element" name))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if (soap-namespace-link-p element)
|
|
|
|
|
;; NOTE: don't use the local alias table here
|
|
|
|
|
(soap-wsdl-get (soap-namespace-link-target element) wsdl predicate)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
element)))
|
|
|
|
|
|
|
|
|
|
;;;;; soap-parse-schema
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-schema (node wsdl)
|
|
|
|
|
"Parse a schema NODE, placing the results in WSDL.
|
|
|
|
|
Return a SOAP-NAMESPACE containing the elements."
|
|
|
|
|
(soap-with-local-xmlns node
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:schema)
|
|
|
|
|
nil
|
|
|
|
|
"expecting an xsd:schema node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(let ((ns (make-soap-namespace :name (soap-get-target-namespace node))))
|
|
|
|
|
|
|
|
|
|
(dolist (def (xml-node-children node))
|
|
|
|
|
(unless (stringp def) ; skip text nodes
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-case (soap-l2wk (xml-node-name def))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xsd:import
|
|
|
|
|
;; Imports will be processed later
|
|
|
|
|
;; NOTE: we should expand the location now!
|
|
|
|
|
(let ((location (or
|
|
|
|
|
(xml-get-attribute-or-nil def 'schemaLocation)
|
|
|
|
|
(xml-get-attribute-or-nil def 'location))))
|
|
|
|
|
(when location
|
|
|
|
|
(push location (soap-wsdl-xmlschema-imports wsdl)))))
|
|
|
|
|
(xsd:element
|
|
|
|
|
(soap-namespace-put (soap-xs-parse-element def) ns))
|
|
|
|
|
(xsd:attribute
|
|
|
|
|
(soap-namespace-put (soap-xs-parse-attribute def) ns))
|
|
|
|
|
(xsd:attributeGroup
|
|
|
|
|
(soap-namespace-put (soap-xs-parse-attribute-group def) ns))
|
|
|
|
|
(xsd:simpleType
|
|
|
|
|
(soap-namespace-put (soap-xs-parse-simple-type def) ns))
|
|
|
|
|
((xsd:complexType xsd:group)
|
|
|
|
|
(soap-namespace-put (soap-xs-parse-complex-type def) ns)))))
|
|
|
|
|
ns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;;;;; Resolving references for wsdl types
|
|
|
|
|
|
|
|
|
|
;; See `soap-wsdl-resolve-references', which is the main entry point for
|
|
|
|
|
;; resolving references
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-resolve-references (element wsdl)
|
|
|
|
|
"Replace names in ELEMENT with the referenced objects in the WSDL.
|
|
|
|
|
This is a generic function which invokes a specific resolver
|
|
|
|
|
function depending on the type of the ELEMENT.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
If ELEMENT has no resolver function, it is silently ignored."
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((resolver (get (soap-type-of element) 'soap-resolve-references)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(when resolver
|
|
|
|
|
(funcall resolver element wsdl))))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-message (message wsdl)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"Replace names in MESSAGE with the referenced objects in the WSDL.
|
|
|
|
|
This is a generic function, called by `soap-resolve-references',
|
|
|
|
|
you should use that function instead.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let (resolved-parts)
|
|
|
|
|
(dolist (part (soap-message-parts message))
|
|
|
|
|
(let ((name (car part))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(element (cdr part)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(when (stringp name)
|
|
|
|
|
(setq name (intern name)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(if (soap-name-p element)
|
|
|
|
|
(setq element (soap-wsdl-get
|
|
|
|
|
element wsdl
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(or (soap-xs-type-p x) (soap-xs-element-p x)))))
|
|
|
|
|
;; else, inline element, resolve recursively, as the element
|
|
|
|
|
;; won't be reached.
|
|
|
|
|
(soap-resolve-references element wsdl)
|
|
|
|
|
(unless (soap-element-namespace-tag element)
|
|
|
|
|
(setf (soap-element-namespace-tag element)
|
|
|
|
|
(soap-element-namespace-tag message))))
|
|
|
|
|
(push (cons name element) resolved-parts)))
|
|
|
|
|
(setf (soap-message-parts message) (nreverse resolved-parts))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-operation (operation wsdl)
|
|
|
|
|
"Resolve references for an OPERATION type using the WSDL document.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
See also `soap-resolve-references' and
|
2011-02-16 09:25:37 +00:00
|
|
|
|
`soap-wsdl-resolve-references'"
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
(let ((namespace (soap-element-namespace-tag operation)))
|
|
|
|
|
(when namespace
|
|
|
|
|
(let ((nstag (car (rassoc namespace (soap-wsdl-alias-table wsdl)))))
|
|
|
|
|
(when nstag
|
|
|
|
|
(setf (soap-element-namespace-tag operation) nstag)))))
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((input (soap-operation-input operation))
|
|
|
|
|
(counter 0))
|
|
|
|
|
(let ((name (car input))
|
|
|
|
|
(message (cdr input)))
|
|
|
|
|
;; Name this part if it was not named
|
|
|
|
|
(when (or (null name) (equal name ""))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(setq name (format "in%d" (cl-incf counter))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when (soap-name-p message)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-operation-input operation)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(cons (intern name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-wsdl-get message wsdl 'soap-message-p))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(let ((output (soap-operation-output operation))
|
|
|
|
|
(counter 0))
|
|
|
|
|
(let ((name (car output))
|
|
|
|
|
(message (cdr output)))
|
|
|
|
|
(when (or (null name) (equal name ""))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(setq name (format "out%d" (cl-incf counter))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when (soap-name-p message)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-operation-output operation)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(cons (intern name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-wsdl-get message wsdl 'soap-message-p))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(let ((resolved-faults nil)
|
|
|
|
|
(counter 0))
|
|
|
|
|
(dolist (fault (soap-operation-faults operation))
|
|
|
|
|
(let ((name (car fault))
|
|
|
|
|
(message (cdr fault)))
|
|
|
|
|
(when (or (null name) (equal name ""))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(setq name (format "fault%d" (cl-incf counter))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(if (soap-name-p message)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(push (cons (intern name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-wsdl-get message wsdl 'soap-message-p))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
resolved-faults)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(push fault resolved-faults))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-operation-faults operation) resolved-faults))
|
|
|
|
|
|
|
|
|
|
(when (= (length (soap-operation-parameter-order operation)) 0)
|
|
|
|
|
(setf (soap-operation-parameter-order operation)
|
|
|
|
|
(mapcar 'car (soap-message-parts
|
|
|
|
|
(cdr (soap-operation-input operation))))))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-operation-parameter-order operation)
|
|
|
|
|
(mapcar (lambda (p)
|
|
|
|
|
(if (stringp p)
|
|
|
|
|
(intern p)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
p))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-operation-parameter-order operation))))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-binding (binding wsdl)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"Resolve references for a BINDING type using the WSDL document.
|
|
|
|
|
See also `soap-resolve-references' and
|
2011-02-16 09:25:37 +00:00
|
|
|
|
`soap-wsdl-resolve-references'"
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when (soap-name-p (soap-binding-port-type binding))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-binding-port-type binding)
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(soap-wsdl-get (soap-binding-port-type binding)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
wsdl 'soap-port-type-p)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(let ((port-ops (soap-port-type-operations (soap-binding-port-type binding))))
|
|
|
|
|
(maphash (lambda (k v)
|
|
|
|
|
(setf (soap-bound-operation-operation v)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-namespace-get k port-ops 'soap-operation-p))
|
|
|
|
|
(let (resolved-headers)
|
|
|
|
|
(dolist (h (soap-bound-operation-soap-headers v))
|
|
|
|
|
(push (list (soap-wsdl-get (nth 0 h) wsdl)
|
|
|
|
|
(intern (nth 1 h))
|
|
|
|
|
(nth 2 h))
|
|
|
|
|
resolved-headers))
|
|
|
|
|
(setf (soap-bound-operation-soap-headers v)
|
|
|
|
|
(nreverse resolved-headers))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-binding-operations binding))))
|
|
|
|
|
|
|
|
|
|
(defun soap-resolve-references-for-port (port wsdl)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
"Replace names in PORT with the referenced objects in the WSDL.
|
|
|
|
|
This is a generic function, called by `soap-resolve-references',
|
|
|
|
|
you should use that function instead.
|
|
|
|
|
|
|
|
|
|
See also `soap-wsdl-resolve-references'."
|
|
|
|
|
(when (soap-name-p (soap-port-binding port))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(setf (soap-port-binding port)
|
|
|
|
|
(soap-wsdl-get (soap-port-binding port) wsdl 'soap-binding-p))))
|
|
|
|
|
|
|
|
|
|
;; Install resolvers for our types
|
|
|
|
|
(progn
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-message)) 'soap-resolve-references
|
2011-02-16 09:25:37 +00:00
|
|
|
|
'soap-resolve-references-for-message)
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-operation)) 'soap-resolve-references
|
2011-02-16 09:25:37 +00:00
|
|
|
|
'soap-resolve-references-for-operation)
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-binding)) 'soap-resolve-references
|
2011-02-16 09:25:37 +00:00
|
|
|
|
'soap-resolve-references-for-binding)
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(put (soap-type-of (make-soap-port)) 'soap-resolve-references
|
2011-02-16 09:25:37 +00:00
|
|
|
|
'soap-resolve-references-for-port))
|
|
|
|
|
|
|
|
|
|
(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
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(setq nstag (format "ns%d" (cl-incf nstag-id)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(unless (assoc nstag alias-table)
|
|
|
|
|
(soap-wsdl-add-alias nstag (soap-namespace-name ns) wsdl)
|
|
|
|
|
(throw 'done t)))))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(maphash (lambda (_name element)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(cond ((soap-element-p element) ; skip links
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-incf nprocessed)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-resolve-references element wsdl))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
((listp element)
|
|
|
|
|
(dolist (e element)
|
|
|
|
|
(when (soap-element-p e)
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-incf nprocessed)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-resolve-references e wsdl))))))
|
2011-06-30 23:15:02 +00:00
|
|
|
|
(soap-namespace-elements ns)))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
wsdl)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;;;;; Loading WSDL from XML documents
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-parse-server-response ()
|
|
|
|
|
"Error-check and parse the XML contents of the current buffer."
|
|
|
|
|
(let ((mime-part (mm-dissect-buffer t t)))
|
2018-10-16 17:44:16 +00:00
|
|
|
|
(when (and
|
|
|
|
|
(equal (mm-handle-media-type mime-part) "multipart/related")
|
|
|
|
|
(equal (get-text-property 0 'type (mm-handle-media-type mime-part))
|
|
|
|
|
"text/xml"))
|
|
|
|
|
(setq mime-part
|
|
|
|
|
(mm-make-handle
|
|
|
|
|
(get-text-property 0 'buffer (mm-handle-media-type mime-part))
|
|
|
|
|
`(,(get-text-property 0 'type (mm-handle-media-type mime-part))))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(unless mime-part
|
|
|
|
|
(error "Failed to decode response from server"))
|
|
|
|
|
(unless (equal (car (mm-handle-type mime-part)) "text/xml")
|
|
|
|
|
(error "Server response is not an XML document"))
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(mm-insert-part mime-part)
|
|
|
|
|
(prog1
|
|
|
|
|
(car (xml-parse-region (point-min) (point-max)))
|
|
|
|
|
(kill-buffer)
|
|
|
|
|
(mm-destroy-part mime-part)))))
|
|
|
|
|
|
2017-05-24 18:58:47 +00:00
|
|
|
|
(defvar url-http-response-status)
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-fetch-xml-from-url (url wsdl)
|
|
|
|
|
"Load an XML document from URL and return it.
|
|
|
|
|
The previously parsed URL is read from WSDL."
|
|
|
|
|
(message "Fetching from %s" url)
|
|
|
|
|
(let ((current-file (url-expand-file-name url (soap-wsdl-current-file wsdl)))
|
|
|
|
|
(url-request-method "GET")
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(url-package-name "soap-client.el")
|
|
|
|
|
(url-package-version "1.0")
|
|
|
|
|
(url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5")
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(url-http-attempt-keepalives t))
|
|
|
|
|
(setf (soap-wsdl-current-file wsdl) current-file)
|
|
|
|
|
(let ((buffer (url-retrieve-synchronously current-file)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(if (> url-http-response-status 299)
|
|
|
|
|
(error "Error retrieving WSDL: %s" url-http-response-status))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-parse-server-response)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-fetch-xml-from-file (file wsdl)
|
|
|
|
|
"Load an XML document from FILE and return it.
|
|
|
|
|
The previously parsed file is read from WSDL."
|
|
|
|
|
(let* ((current-file (soap-wsdl-current-file wsdl))
|
|
|
|
|
(expanded-file (expand-file-name file
|
|
|
|
|
(if current-file
|
|
|
|
|
(file-name-directory current-file)
|
|
|
|
|
default-directory))))
|
|
|
|
|
(setf (soap-wsdl-current-file wsdl) expanded-file)
|
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(insert-file-contents expanded-file)
|
|
|
|
|
(car (xml-parse-region (point-min) (point-max))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-fetch-xml (file-or-url wsdl)
|
|
|
|
|
"Load an XML document from FILE-OR-URL and return it.
|
|
|
|
|
The previously parsed file or URL is read from WSDL."
|
|
|
|
|
(let ((current-file (or (soap-wsdl-current-file wsdl) file-or-url)))
|
|
|
|
|
(if (or (and current-file (file-exists-p current-file))
|
|
|
|
|
(file-exists-p file-or-url))
|
|
|
|
|
(soap-fetch-xml-from-file file-or-url wsdl)
|
|
|
|
|
(soap-fetch-xml-from-url file-or-url wsdl))))
|
|
|
|
|
|
|
|
|
|
(defun soap-load-wsdl (file-or-url &optional wsdl)
|
|
|
|
|
"Load a document from FILE-OR-URL and return it.
|
|
|
|
|
Build on WSDL if it is provided."
|
|
|
|
|
(let* ((wsdl (or wsdl (soap-make-wsdl file-or-url)))
|
|
|
|
|
(xml (soap-fetch-xml file-or-url wsdl)))
|
|
|
|
|
(soap-wsdl-resolve-references (soap-parse-wsdl xml wsdl))
|
|
|
|
|
wsdl))
|
|
|
|
|
|
|
|
|
|
(defalias 'soap-load-wsdl-from-url 'soap-load-wsdl)
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-wsdl-phase-validate-node (node)
|
|
|
|
|
"Assert that NODE is valid."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-with-local-xmlns node
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((node-name (soap-l2wk (xml-node-name node))))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq node-name 'wsdl:definitions)
|
|
|
|
|
nil
|
|
|
|
|
"expecting wsdl:definitions node, got %s" node-name))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-parse-wsdl-phase-fetch-imports (node wsdl)
|
|
|
|
|
"Fetch and load files imported by NODE into WSDL."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-with-local-xmlns node
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:import))
|
|
|
|
|
(let ((location (xml-get-attribute-or-nil node 'location)))
|
|
|
|
|
(when location
|
|
|
|
|
(soap-load-wsdl location wsdl))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-parse-wsdl-phase-parse-schema (node wsdl)
|
|
|
|
|
"Load types found in NODE into WSDL."
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
;; Find all the 'xsd:schema nodes which are children of wsdl:types nodes and
|
|
|
|
|
;; build our type-library.
|
|
|
|
|
(let ((types (car (soap-xml-get-children1 node 'wsdl:types))))
|
|
|
|
|
(dolist (node (xml-node-children types))
|
|
|
|
|
;; We cannot use (xml-get-children node (soap-wk2l 'xsd:schema)) because
|
|
|
|
|
;; each node can install its own alias type so the schema nodes might
|
|
|
|
|
;; have a different prefix.
|
|
|
|
|
(when (consp node)
|
|
|
|
|
(soap-with-local-xmlns
|
|
|
|
|
node
|
|
|
|
|
(when (eq (soap-l2wk (xml-node-name node)) 'xsd:schema)
|
|
|
|
|
(soap-wsdl-add-namespace (soap-parse-schema node wsdl)
|
|
|
|
|
wsdl))))))))
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-wsdl-phase-fetch-schema (node wsdl)
|
|
|
|
|
"Fetch and load schema imports defined by NODE into WSDL."
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
(while (soap-wsdl-xmlschema-imports wsdl)
|
|
|
|
|
(let* ((import (pop (soap-wsdl-xmlschema-imports wsdl)))
|
|
|
|
|
(xml (soap-fetch-xml import wsdl)))
|
|
|
|
|
(soap-wsdl-add-namespace (soap-parse-schema xml wsdl) wsdl)))))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-parse-wsdl-phase-finish-parsing (node wsdl)
|
|
|
|
|
"Finish parsing NODE into WSDL."
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
(let ((ns (make-soap-namespace :name (soap-get-target-namespace node))))
|
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:message))
|
|
|
|
|
(soap-namespace-put (soap-parse-message node) ns))
|
|
|
|
|
|
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:portType))
|
|
|
|
|
(let ((port-type (soap-parse-port-type node)))
|
|
|
|
|
(soap-namespace-put port-type ns)
|
|
|
|
|
(soap-wsdl-add-namespace
|
|
|
|
|
(soap-port-type-operations port-type) wsdl)))
|
|
|
|
|
|
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:binding))
|
|
|
|
|
(soap-namespace-put (soap-parse-binding node) ns))
|
|
|
|
|
|
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:service))
|
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:port))
|
|
|
|
|
(let ((name (xml-get-attribute node 'name))
|
|
|
|
|
(binding (xml-get-attribute node 'binding))
|
|
|
|
|
(url (let ((n (car (soap-xml-get-children1
|
|
|
|
|
node 'wsdlsoap:address))))
|
|
|
|
|
(xml-get-attribute n 'location))))
|
|
|
|
|
(let ((port (make-soap-port
|
|
|
|
|
:name name :binding (soap-l2fq binding 'tns)
|
|
|
|
|
:service-url url)))
|
|
|
|
|
(soap-namespace-put port ns)
|
|
|
|
|
(push port (soap-wsdl-ports wsdl))))))
|
|
|
|
|
|
|
|
|
|
(soap-wsdl-add-namespace ns wsdl))))
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-wsdl (node wsdl)
|
|
|
|
|
"Construct from NODE a WSDL structure, which is an XML document."
|
|
|
|
|
;; Break this into phases to allow for asynchronous parsing.
|
|
|
|
|
(soap-parse-wsdl-phase-validate-node node)
|
|
|
|
|
;; Makes synchronous calls.
|
|
|
|
|
(soap-parse-wsdl-phase-fetch-imports node wsdl)
|
|
|
|
|
(soap-parse-wsdl-phase-parse-schema node wsdl)
|
|
|
|
|
;; Makes synchronous calls.
|
|
|
|
|
(soap-parse-wsdl-phase-fetch-schema node wsdl)
|
|
|
|
|
(soap-parse-wsdl-phase-finish-parsing node wsdl)
|
|
|
|
|
wsdl)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-parse-message (node)
|
|
|
|
|
"Parse NODE as a wsdl:message and return the corresponding type."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:message)
|
|
|
|
|
nil
|
|
|
|
|
"expecting wsdl:message node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((name (xml-get-attribute-or-nil node 'name))
|
|
|
|
|
parts)
|
|
|
|
|
(dolist (p (soap-xml-get-children1 node 'wsdl:part))
|
|
|
|
|
(let ((name (xml-get-attribute-or-nil p 'name))
|
|
|
|
|
(type (xml-get-attribute-or-nil p 'type))
|
|
|
|
|
(element (xml-get-attribute-or-nil p 'element)))
|
|
|
|
|
|
|
|
|
|
(when type
|
|
|
|
|
(setq type (soap-l2fq type 'tns)))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(if element
|
|
|
|
|
(setq element (soap-l2fq element 'tns))
|
|
|
|
|
;; else
|
|
|
|
|
(setq element (make-soap-xs-element
|
|
|
|
|
:name name
|
|
|
|
|
:namespace-tag soap-target-xmlns
|
|
|
|
|
:type^ type)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(push (cons name element) parts)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(make-soap-message :name name :parts (nreverse parts))))
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-port-type (node)
|
|
|
|
|
"Parse NODE as a wsdl:portType and return the corresponding port."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:portType)
|
|
|
|
|
nil
|
|
|
|
|
"expecting wsdl:portType node got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let* ((soap-target-xmlns (concat "urn:" (xml-get-attribute node 'name)))
|
|
|
|
|
(ns (make-soap-namespace :name soap-target-xmlns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(dolist (node (soap-xml-get-children1 node 'wsdl:operation))
|
|
|
|
|
(let ((o (soap-parse-operation node)))
|
|
|
|
|
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(let ((other-operation (soap-namespace-get
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-element-name o) ns 'soap-operation-p)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if other-operation
|
|
|
|
|
;; Unfortunately, the Confluence WSDL defines two operations
|
|
|
|
|
;; named "search" which differ only in parameter names...
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(soap-warning "Discarding duplicate operation: %s"
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-element-name o))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(progn
|
|
|
|
|
(soap-namespace-put o ns)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; link all messages from this namespace, as this namespace
|
|
|
|
|
;; will be used for decoding the response.
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-destructuring-bind (name . message) (soap-operation-input o)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-namespace-put-link name message ns))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-destructuring-bind (name . message) (soap-operation-output o)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-namespace-put-link name message ns))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dolist (fault (soap-operation-faults o))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-destructuring-bind (name . message) fault
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-namespace-put-link name message ns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(make-soap-port-type :name (xml-get-attribute node 'name)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
:operations ns)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-parse-operation (node)
|
|
|
|
|
"Parse NODE as a wsdl:operation and return the corresponding type."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:operation)
|
|
|
|
|
nil
|
|
|
|
|
"expecting wsdl:operation node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((name (xml-get-attribute node 'name))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(parameter-order (split-string
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(xml-get-attribute node 'parameterOrder)))
|
|
|
|
|
input output faults input-action output-action)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(dolist (n (xml-node-children node))
|
|
|
|
|
(when (consp n) ; skip string nodes which are whitespace
|
|
|
|
|
(let ((node-name (soap-l2wk (xml-node-name n))))
|
|
|
|
|
(cond
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((eq node-name 'wsdl:input)
|
|
|
|
|
(let ((message (xml-get-attribute n 'message))
|
|
|
|
|
(name (xml-get-attribute n 'name))
|
|
|
|
|
(action (soap-xml-get-attribute-or-nil1 n 'wsaw:Action)))
|
|
|
|
|
(setq input (cons name (soap-l2fq message 'tns)))
|
|
|
|
|
(setq input-action action)))
|
|
|
|
|
((eq node-name 'wsdl:output)
|
|
|
|
|
(let ((message (xml-get-attribute n 'message))
|
|
|
|
|
(name (xml-get-attribute n 'name))
|
|
|
|
|
(action (soap-xml-get-attribute-or-nil1 n 'wsaw:Action)))
|
|
|
|
|
(setq output (cons name (soap-l2fq message 'tns)))
|
|
|
|
|
(setq output-action action)))
|
|
|
|
|
((eq node-name 'wsdl:fault)
|
|
|
|
|
(let ((message (xml-get-attribute n 'message))
|
|
|
|
|
(name (xml-get-attribute n 'name)))
|
|
|
|
|
(push (cons name (soap-l2fq message 'tns)) faults)))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(make-soap-operation
|
|
|
|
|
:name name
|
2015-10-24 12:33:18 +00:00
|
|
|
|
:namespace-tag soap-target-xmlns
|
2011-02-16 09:25:37 +00:00
|
|
|
|
:parameter-order parameter-order
|
|
|
|
|
:input input
|
|
|
|
|
:output output
|
2015-10-24 12:33:18 +00:00
|
|
|
|
:faults (nreverse faults)
|
|
|
|
|
:input-action input-action
|
|
|
|
|
:output-action output-action)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-parse-binding (node)
|
|
|
|
|
"Parse NODE as a wsdl:binding and return the corresponding type."
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'wsdl:binding)
|
|
|
|
|
nil
|
|
|
|
|
"expecting wsdl:binding node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((name (xml-get-attribute node 'name))
|
|
|
|
|
(type (xml-get-attribute node 'type)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(let ((binding (make-soap-binding :name name
|
2015-10-24 12:33:18 +00:00
|
|
|
|
:port-type (soap-l2fq type 'tns))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(dolist (wo (soap-xml-get-children1 node 'wsdl:operation))
|
|
|
|
|
(let ((name (xml-get-attribute wo 'name))
|
|
|
|
|
soap-action
|
2015-10-24 12:33:18 +00:00
|
|
|
|
soap-headers
|
|
|
|
|
soap-body
|
2011-02-16 09:25:37 +00:00
|
|
|
|
use)
|
|
|
|
|
(dolist (so (soap-xml-get-children1 wo 'wsdlsoap:operation))
|
|
|
|
|
(setq soap-action (xml-get-attribute-or-nil so 'soapAction)))
|
|
|
|
|
|
|
|
|
|
;; Search a wsdlsoap:body node and find a "use" tag. The
|
|
|
|
|
;; same use tag is assumed to be present for both input and
|
|
|
|
|
;; output types (although the WDSL spec allows separate
|
|
|
|
|
;; "use"-s for each of them...
|
|
|
|
|
|
|
|
|
|
(dolist (i (soap-xml-get-children1 wo 'wsdl:input))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
|
|
|
|
;; There can be multiple headers ...
|
|
|
|
|
(dolist (h (soap-xml-get-children1 i 'wsdlsoap:header))
|
|
|
|
|
(let ((message (soap-l2fq (xml-get-attribute-or-nil h 'message)))
|
|
|
|
|
(part (xml-get-attribute-or-nil h 'part))
|
|
|
|
|
(use (xml-get-attribute-or-nil h 'use)))
|
|
|
|
|
(when (and message part)
|
|
|
|
|
(push (list message part use) soap-headers))))
|
|
|
|
|
|
|
|
|
|
;; ... but only one body
|
|
|
|
|
(let ((body (car (soap-xml-get-children1 i 'wsdlsoap:body))))
|
|
|
|
|
(setq soap-body (xml-get-attribute-or-nil body 'parts))
|
|
|
|
|
(when soap-body
|
|
|
|
|
(setq soap-body
|
|
|
|
|
(mapcar #'intern (split-string soap-body
|
|
|
|
|
nil
|
|
|
|
|
'omit-nulls))))
|
|
|
|
|
(setq use (xml-get-attribute-or-nil body 'use))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(unless use
|
|
|
|
|
(dolist (i (soap-xml-get-children1 wo 'wsdl:output))
|
|
|
|
|
(dolist (b (soap-xml-get-children1 i 'wsdlsoap:body))
|
|
|
|
|
(setq use (or use
|
|
|
|
|
(xml-get-attribute-or-nil b 'use))))))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(puthash name (make-soap-bound-operation
|
|
|
|
|
:operation name
|
|
|
|
|
:soap-action soap-action
|
|
|
|
|
:soap-headers (nreverse soap-headers)
|
|
|
|
|
:soap-body soap-body
|
|
|
|
|
:use (and use (intern use)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-binding-operations binding))))
|
|
|
|
|
binding)))
|
|
|
|
|
|
|
|
|
|
;;;; SOAP type decoding
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(defvar soap-multi-refs nil
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"The list of multi-ref nodes in the current SOAP response.
|
|
|
|
|
This is a dynamically bound variable used during decoding the
|
|
|
|
|
SOAP response.")
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(defvar soap-decoded-multi-refs nil
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"List of decoded multi-ref nodes in the current SOAP response.
|
|
|
|
|
This is a dynamically bound variable used during decoding the
|
|
|
|
|
SOAP response.")
|
|
|
|
|
|
|
|
|
|
(defun soap-decode-type (type node)
|
|
|
|
|
"Use TYPE (an xsd type) to decode the contents of NODE.
|
|
|
|
|
|
|
|
|
|
NODE is an XML node, representing some SOAP encoded value or a
|
|
|
|
|
reference to another XML node (a multiRef). This function will
|
|
|
|
|
resolve the multiRef reference, if any, than call a TYPE specific
|
|
|
|
|
decode function to perform the actual decoding."
|
|
|
|
|
(let ((href (xml-get-attribute-or-nil node 'href)))
|
|
|
|
|
(cond (href
|
|
|
|
|
(catch 'done
|
|
|
|
|
;; NODE is actually a HREF, find the target and decode that.
|
|
|
|
|
;; Check first if we already decoded this multiref.
|
|
|
|
|
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let ((decoded (cdr (assoc href soap-decoded-multi-refs))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(when decoded
|
|
|
|
|
(throw 'done decoded)))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(unless (string-match "^#\\(.*\\)$" href)
|
|
|
|
|
(error "Invalid multiRef: %s" href))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(let ((id (match-string 1 href)))
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(dolist (mr soap-multi-refs)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let ((mrid (xml-get-attribute mr 'id)))
|
|
|
|
|
(when (equal id mrid)
|
|
|
|
|
;; recurse here, in case there are multiple HREF's
|
|
|
|
|
(let ((decoded (soap-decode-type type mr)))
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(push (cons href decoded) soap-decoded-multi-refs)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(throw 'done decoded)))))
|
|
|
|
|
(error "Cannot find href %s" href))))
|
|
|
|
|
(t
|
|
|
|
|
(soap-with-local-xmlns node
|
|
|
|
|
(if (equal (soap-xml-get-attribute-or-nil1 node 'xsi:nil) "true")
|
|
|
|
|
nil
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; Handle union types.
|
|
|
|
|
(cond ((listp type)
|
|
|
|
|
(catch 'done
|
|
|
|
|
(dolist (union-member type)
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let* ((decoder (get (soap-type-of union-member)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
'soap-decoder))
|
|
|
|
|
(result (ignore-errors
|
|
|
|
|
(funcall decoder
|
|
|
|
|
union-member node))))
|
|
|
|
|
(when result (throw 'done result))))))
|
|
|
|
|
(t
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((decoder (get (soap-type-of type) 'soap-decoder)))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert decoder nil
|
2018-06-09 02:41:28 +00:00
|
|
|
|
"no soap-decoder for %s type"
|
|
|
|
|
(soap-type-of type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(funcall decoder type node))))))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-decode-any-type (node)
|
|
|
|
|
"Decode NODE using type information inside it."
|
|
|
|
|
;; If the NODE has type information, we use that...
|
|
|
|
|
(let ((type (soap-xml-get-attribute-or-nil1 node 'xsi:type)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when type
|
|
|
|
|
(setq type (soap-l2fq type)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if type
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((wtype (soap-wsdl-get type soap-current-wsdl 'soap-xs-type-p)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(if wtype
|
|
|
|
|
(soap-decode-type wtype node)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; The node has type info encoded in it, but we don't know how
|
|
|
|
|
;; to decode it...
|
|
|
|
|
(error "Node has unknown type: %s" type)))
|
|
|
|
|
|
|
|
|
|
;; No type info in the node...
|
|
|
|
|
|
|
|
|
|
(let ((contents (xml-node-children node)))
|
|
|
|
|
(if (and (= (length contents) 1) (stringp (car contents)))
|
|
|
|
|
;; contents is just a string
|
|
|
|
|
(car contents)
|
|
|
|
|
|
|
|
|
|
;; we assume the NODE is a sequence with every element a
|
|
|
|
|
;; structure name
|
|
|
|
|
(let (result)
|
|
|
|
|
(dolist (element contents)
|
|
|
|
|
;; skip any string contents, assume they are whitespace
|
|
|
|
|
(unless (stringp element)
|
|
|
|
|
(let ((key (xml-node-name element))
|
|
|
|
|
(value (soap-decode-any-type element)))
|
|
|
|
|
(push (cons key value) result))))
|
|
|
|
|
(nreverse result)))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-decode-array (node)
|
|
|
|
|
"Decode NODE as an Array using type information inside it."
|
|
|
|
|
(let ((type (soap-xml-get-attribute-or-nil1 node 'soapenc:arrayType))
|
|
|
|
|
(wtype nil)
|
|
|
|
|
(contents (xml-node-children node))
|
|
|
|
|
result)
|
|
|
|
|
(when type
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; Type is in the format "someType[NUM]" where NUM is the number of
|
|
|
|
|
;; elements in the array. We discard the [NUM] part.
|
|
|
|
|
(setq type (replace-regexp-in-string "\\[[0-9]+\\]\\'" "" type))
|
|
|
|
|
(setq wtype (soap-wsdl-get (soap-l2fq type)
|
|
|
|
|
soap-current-wsdl 'soap-xs-type-p))
|
|
|
|
|
(unless wtype
|
|
|
|
|
;; The node has type info encoded in it, but we don't know how to
|
|
|
|
|
;; decode it...
|
|
|
|
|
(error "Soap-decode-array: node has unknown type: %s" type)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(dolist (e contents)
|
|
|
|
|
(when (consp e)
|
|
|
|
|
(push (if wtype
|
|
|
|
|
(soap-decode-type wtype e)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-decode-any-type e))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
result)))
|
|
|
|
|
(nreverse result)))
|
|
|
|
|
|
|
|
|
|
;;;; Soap Envelope parsing
|
|
|
|
|
|
2015-11-12 04:43:50 +00:00
|
|
|
|
(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"))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(defun soap-parse-envelope (node operation wsdl)
|
|
|
|
|
"Parse the SOAP envelope in NODE and return the response.
|
|
|
|
|
OPERATION is the WSDL operation for which we expect the response,
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-20 22:27:53 +00:00
|
|
|
|
WSDL is used to decode the NODE."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(soap-with-local-xmlns node
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert (eq (soap-l2wk (xml-node-name node)) 'soap:Envelope)
|
|
|
|
|
nil
|
|
|
|
|
"expecting soap:Envelope node, got %s"
|
|
|
|
|
(soap-l2wk (xml-node-name node)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((headers (soap-xml-get-children1 node 'soap:Header))
|
|
|
|
|
(body (car (soap-xml-get-children1 node 'soap:Body))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(let ((fault (car (soap-xml-get-children1 body 'soap:Fault))))
|
|
|
|
|
(when fault
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(let ((fault-code (let ((n (car (xml-get-children
|
2015-10-24 12:33:18 +00:00
|
|
|
|
fault 'faultcode))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(car-safe (xml-node-children n))))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(fault-string (let ((n (car (xml-get-children
|
2012-04-25 10:28:29 +00:00
|
|
|
|
fault 'faultstring))))
|
|
|
|
|
(car-safe (xml-node-children n))))
|
|
|
|
|
(detail (xml-get-children fault 'detail)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(while t
|
|
|
|
|
(signal 'soap-error (list fault-code fault-string detail))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;; First (non string) element of the body is the root node of he
|
|
|
|
|
;; response
|
|
|
|
|
(let ((response (if (eq (soap-bound-operation-use operation) 'literal)
|
|
|
|
|
;; For 'literal uses, the response is the actual body
|
|
|
|
|
body
|
2015-10-24 12:33:18 +00:00
|
|
|
|
;; ...otherwise the first non string element
|
|
|
|
|
;; of the body is the response
|
|
|
|
|
(catch 'found
|
|
|
|
|
(dolist (n (xml-node-children body))
|
|
|
|
|
(when (consp n)
|
|
|
|
|
(throw 'found n)))))))
|
|
|
|
|
(soap-parse-response response operation wsdl headers body)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-parse-response (response-node operation wsdl soap-headers soap-body)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"Parse RESPONSE-NODE and return the result as a LISP value.
|
|
|
|
|
OPERATION is the WSDL operation for which we expect the response,
|
|
|
|
|
WSDL is used to decode the NODE.
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
SOAP-HEADERS is a list of the headers of the SOAP envelope or nil
|
|
|
|
|
if there are no headers.
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
SOAP-BODY is the body of the SOAP envelope (of which
|
|
|
|
|
RESPONSE-NODE is a sub-node). It is used in case RESPONSE-NODE
|
|
|
|
|
reference multiRef parts which are external to RESPONSE-NODE."
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let* ((soap-current-wsdl wsdl)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(op (soap-bound-operation-operation operation))
|
|
|
|
|
(use (soap-bound-operation-use operation))
|
|
|
|
|
(message (cdr (soap-operation-output op))))
|
|
|
|
|
|
|
|
|
|
(soap-with-local-xmlns response-node
|
|
|
|
|
|
|
|
|
|
(when (eq use 'encoded)
|
|
|
|
|
(let* ((received-message-name (soap-l2fq (xml-node-name response-node)))
|
2011-02-16 19:33:35 +00:00
|
|
|
|
(received-message (soap-wsdl-get
|
2015-10-24 12:33:18 +00:00
|
|
|
|
received-message-name wsdl 'soap-message-p)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(unless (eq received-message message)
|
|
|
|
|
(error "Unexpected message: got %s, expecting %s"
|
|
|
|
|
received-message-name
|
|
|
|
|
(soap-element-name message)))))
|
|
|
|
|
|
|
|
|
|
(let ((decoded-parts nil)
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(soap-multi-refs (xml-get-children soap-body 'multiRef))
|
|
|
|
|
(soap-decoded-multi-refs nil))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(dolist (part (soap-message-parts message))
|
|
|
|
|
(let ((tag (car part))
|
|
|
|
|
(type (cdr part))
|
|
|
|
|
node)
|
|
|
|
|
|
|
|
|
|
(setq node
|
|
|
|
|
(cond
|
2015-10-24 12:33:18 +00:00
|
|
|
|
((eq use 'encoded)
|
|
|
|
|
(car (xml-get-children response-node tag)))
|
|
|
|
|
|
|
|
|
|
((eq use 'literal)
|
|
|
|
|
(catch 'found
|
|
|
|
|
(let* ((ns-aliases (soap-wsdl-alias-table wsdl))
|
|
|
|
|
(ns-name (cdr (assoc
|
|
|
|
|
(soap-element-namespace-tag type)
|
|
|
|
|
ns-aliases)))
|
|
|
|
|
(fqname (cons ns-name (soap-element-name type))))
|
|
|
|
|
(dolist (c (append (mapcar (lambda (header)
|
|
|
|
|
(car (xml-node-children
|
|
|
|
|
header)))
|
|
|
|
|
soap-headers)
|
|
|
|
|
(xml-node-children response-node)))
|
|
|
|
|
(when (consp c)
|
|
|
|
|
(soap-with-local-xmlns c
|
|
|
|
|
(when (equal (soap-l2fq (xml-node-name c))
|
|
|
|
|
fqname)
|
|
|
|
|
(throw 'found c))))))))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(unless node
|
|
|
|
|
(error "Soap-parse-response(%s): cannot find message part %s"
|
|
|
|
|
(soap-element-name op) tag))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((decoded-value (soap-decode-type type node)))
|
|
|
|
|
(when decoded-value
|
|
|
|
|
(push decoded-value decoded-parts)))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
decoded-parts))))
|
|
|
|
|
|
|
|
|
|
;;;; SOAP type encoding
|
|
|
|
|
|
2018-07-18 02:22:15 +00:00
|
|
|
|
;; FIXME: Use `cl-defmethod' (but this requires Emacs-25).
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-encode-attributes (value type)
|
|
|
|
|
"Encode XML attributes for VALUE according to TYPE.
|
|
|
|
|
This is a generic function which determines the attribute encoder
|
|
|
|
|
for the type and calls that specialized function to do the work.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
Attributes are inserted in the current buffer at the current
|
|
|
|
|
position."
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((attribute-encoder (get (soap-type-of type) 'soap-attribute-encoder)))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(cl-assert attribute-encoder nil
|
2018-06-09 02:41:28 +00:00
|
|
|
|
"no soap-attribute-encoder for %s type" (soap-type-of type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(funcall attribute-encoder value type)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-encode-value (value type)
|
|
|
|
|
"Encode the VALUE using TYPE.
|
2011-02-16 09:25:37 +00:00
|
|
|
|
The resulting XML data is inserted in the current buffer
|
|
|
|
|
at (point)/
|
|
|
|
|
|
|
|
|
|
TYPE is one of the soap-*-type structures which defines how VALUE
|
|
|
|
|
is to be encoded. This is a generic function which finds an
|
|
|
|
|
encoder function based on TYPE and calls that encoder to do the
|
|
|
|
|
work."
|
2018-06-09 02:41:28 +00:00
|
|
|
|
(let ((encoder (get (soap-type-of type) 'soap-encoder)))
|
|
|
|
|
(cl-assert encoder nil "no soap-encoder for %s type" (soap-type-of type))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(funcall encoder value type))
|
|
|
|
|
(when (soap-element-namespace-tag type)
|
|
|
|
|
(add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag type))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-encode-body (operation parameters &optional service-url)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"Create the body of a SOAP request for OPERATION in the current buffer.
|
|
|
|
|
PARAMETERS is a list of parameters supplied to the OPERATION.
|
|
|
|
|
|
|
|
|
|
The OPERATION and PARAMETERS are encoded according to the WSDL
|
2015-10-24 12:33:18 +00:00
|
|
|
|
document. SERVICE-URL should be provided when WS-Addressing is
|
|
|
|
|
being used."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(let* ((op (soap-bound-operation-operation operation))
|
|
|
|
|
(use (soap-bound-operation-use operation))
|
|
|
|
|
(message (cdr (soap-operation-input op)))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(parameter-order (soap-operation-parameter-order op))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(param-table (cl-loop for formal in parameter-order
|
|
|
|
|
for value in parameters
|
|
|
|
|
collect (cons formal value))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(unless (= (length parameter-order) (length parameters))
|
|
|
|
|
(error "Wrong number of parameters for %s: expected %d, got %s"
|
|
|
|
|
(soap-element-name op)
|
|
|
|
|
(length parameter-order)
|
|
|
|
|
(length parameters)))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(let ((headers (soap-bound-operation-soap-headers operation))
|
|
|
|
|
(input-action (soap-operation-input-action op)))
|
|
|
|
|
(when headers
|
|
|
|
|
(insert "<soap:Header>\n")
|
|
|
|
|
(when input-action
|
|
|
|
|
(add-to-list 'soap-encoded-namespaces "wsa")
|
|
|
|
|
(insert "<wsa:Action>" input-action "</wsa:Action>\n")
|
|
|
|
|
(insert "<wsa:To>" service-url "</wsa:To>\n"))
|
|
|
|
|
(dolist (h headers)
|
|
|
|
|
(let* ((message (nth 0 h))
|
|
|
|
|
(part (assq (nth 1 h) (soap-message-parts message)))
|
|
|
|
|
(value (cdr (assoc (car part) (car parameters))))
|
|
|
|
|
(use (nth 2 h))
|
|
|
|
|
(element (cdr part)))
|
|
|
|
|
(when (eq use 'encoded)
|
|
|
|
|
(when (soap-element-namespace-tag element)
|
|
|
|
|
(add-to-list 'soap-encoded-namespaces
|
|
|
|
|
(soap-element-namespace-tag element)))
|
|
|
|
|
(insert "<" (soap-element-fq-name element) ">\n"))
|
|
|
|
|
(soap-encode-value value element)
|
|
|
|
|
(when (eq use 'encoded)
|
|
|
|
|
(insert "</" (soap-element-fq-name element) ">\n"))))
|
|
|
|
|
(insert "</soap:Header>\n")))
|
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(insert "<soap:Body>\n")
|
|
|
|
|
(when (eq use 'encoded)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(when (soap-element-namespace-tag op)
|
|
|
|
|
(add-to-list 'soap-encoded-namespaces (soap-element-namespace-tag op)))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(insert "<" (soap-element-fq-name op) ">\n"))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(dolist (part (soap-message-parts message))
|
|
|
|
|
(let* ((param-name (car part))
|
|
|
|
|
(element (cdr part))
|
|
|
|
|
(value (cdr (assoc param-name param-table))))
|
|
|
|
|
(when (or (null (soap-bound-operation-soap-body operation))
|
|
|
|
|
(member param-name
|
|
|
|
|
(soap-bound-operation-soap-body operation)))
|
|
|
|
|
(soap-encode-value value element))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(when (eq use 'encoded)
|
|
|
|
|
(insert "</" (soap-element-fq-name op) ">\n"))
|
|
|
|
|
(insert "</soap:Body>\n")))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-create-envelope (operation parameters wsdl &optional service-url)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
"Create a SOAP request envelope for OPERATION using PARAMETERS.
|
2015-10-24 12:33:18 +00:00
|
|
|
|
WSDL is the wsdl document used to encode the PARAMETERS.
|
|
|
|
|
SERVICE-URL should be provided when WS-Addressing is being used."
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(with-temp-buffer
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let ((soap-encoded-namespaces '("xsi" "soap" "soapenc"))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(use (soap-bound-operation-use operation)))
|
|
|
|
|
|
|
|
|
|
;; Create the request body
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(soap-encode-body operation parameters service-url)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;; Put the envelope around the body
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(insert "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soap:Envelope\n")
|
|
|
|
|
(when (eq use 'encoded)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(insert " soapenc:encodingStyle=\"\
|
2019-09-23 06:53:39 +00:00
|
|
|
|
https://schemas.xmlsoap.org/soap/encoding/\"\n"))
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(dolist (nstag soap-encoded-namespaces)
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(insert " xmlns:" nstag "=\"")
|
2011-02-16 19:56:31 +00:00
|
|
|
|
(let ((nsname (cdr (assoc nstag soap-well-known-xmlns))))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(unless nsname
|
|
|
|
|
(setq nsname (cdr (assoc nstag (soap-wsdl-alias-table wsdl)))))
|
|
|
|
|
(insert nsname)
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(insert "\"\n")))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(insert ">\n")
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert "</soap:Envelope>\n"))
|
|
|
|
|
|
|
|
|
|
(buffer-string)))
|
|
|
|
|
|
|
|
|
|
;;;; invoking soap methods
|
|
|
|
|
|
|
|
|
|
(defcustom soap-debug nil
|
|
|
|
|
"When t, enable some debugging facilities."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'soap-client)
|
|
|
|
|
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(defun soap-find-port (wsdl service)
|
|
|
|
|
"Return the WSDL port having SERVICE name.
|
|
|
|
|
Signal an error if not found."
|
|
|
|
|
(or (catch 'found
|
|
|
|
|
(dolist (p (soap-wsdl-ports wsdl))
|
|
|
|
|
(when (equal service (soap-element-name p))
|
|
|
|
|
(throw 'found p))))
|
|
|
|
|
(error "Unknown SOAP service: %s" service)))
|
|
|
|
|
|
|
|
|
|
(defun soap-find-operation (port operation-name)
|
|
|
|
|
"Inside PORT, find OPERATION-NAME, a `soap-port-type'.
|
|
|
|
|
Signal an error if not found."
|
|
|
|
|
(let* ((binding (soap-port-binding port))
|
|
|
|
|
(op (gethash operation-name (soap-binding-operations binding))))
|
|
|
|
|
(or op
|
|
|
|
|
(error "No operation %s for SOAP service %s"
|
|
|
|
|
operation-name (soap-element-name port)))))
|
|
|
|
|
|
|
|
|
|
(defun soap-operation-arity (wsdl service operation-name)
|
|
|
|
|
"Return the number of arguments required by a soap operation.
|
|
|
|
|
WSDL, SERVICE, OPERATION-NAME and PARAMETERS are as described in
|
|
|
|
|
`soap-invoke'."
|
|
|
|
|
(let* ((port (soap-find-port wsdl service))
|
|
|
|
|
(op (soap-find-operation port operation-name))
|
|
|
|
|
(bop (soap-bound-operation-operation op)))
|
|
|
|
|
(length (soap-operation-parameter-order bop))))
|
|
|
|
|
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(defun soap-invoke-internal (callback cbargs wsdl service operation-name
|
|
|
|
|
&rest parameters)
|
|
|
|
|
"Implement `soap-invoke' and `soap-invoke-async'.
|
|
|
|
|
If CALLBACK is non-nil, operate asynchronously, then call CALLBACK as (apply
|
|
|
|
|
CALLBACK RESPONSE CBARGS), where RESPONSE is the SOAP invocation result.
|
|
|
|
|
If CALLBACK is nil, operate synchronously. WSDL, SERVICE,
|
|
|
|
|
OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(let* ((port (soap-find-port wsdl service))
|
|
|
|
|
(operation (soap-find-operation port operation-name)))
|
|
|
|
|
(let ((url-request-method "POST")
|
|
|
|
|
(url-package-name "soap-client.el")
|
|
|
|
|
(url-package-version "1.0")
|
|
|
|
|
(url-request-data
|
|
|
|
|
;; url-request-data expects a unibyte string already encoded...
|
|
|
|
|
(encode-coding-string
|
|
|
|
|
(soap-create-envelope operation parameters wsdl
|
|
|
|
|
(soap-port-service-url port))
|
|
|
|
|
'utf-8))
|
|
|
|
|
(url-mime-charset-string "utf-8;q=1, iso-8859-1;q=0.5")
|
|
|
|
|
(url-http-attempt-keepalives t)
|
|
|
|
|
(url-request-extra-headers
|
|
|
|
|
(list
|
|
|
|
|
(cons "SOAPAction"
|
2017-06-14 00:49:59 +00:00
|
|
|
|
(concat "\"" (encode-coding-string
|
|
|
|
|
(soap-bound-operation-soap-action
|
|
|
|
|
operation)
|
|
|
|
|
'utf-8)
|
|
|
|
|
"\""))
|
2016-03-16 15:03:31 +00:00
|
|
|
|
(cons "Content-Type"
|
|
|
|
|
"text/xml; charset=utf-8"))))
|
|
|
|
|
(if callback
|
|
|
|
|
(url-retrieve
|
|
|
|
|
(soap-port-service-url port)
|
|
|
|
|
(lambda (status)
|
|
|
|
|
(let ((data-buffer (current-buffer)))
|
|
|
|
|
(unwind-protect
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(let ((error-status (plist-get status :error)))
|
|
|
|
|
(if error-status
|
|
|
|
|
(signal (car error-status) (cdr error-status))
|
|
|
|
|
(apply callback
|
|
|
|
|
(soap-parse-envelope
|
|
|
|
|
(soap-parse-server-response)
|
|
|
|
|
operation wsdl)
|
|
|
|
|
cbargs)))
|
2016-03-16 15:03:31 +00:00
|
|
|
|
;; Ensure the url-retrieve buffer is not leaked.
|
|
|
|
|
(and (buffer-live-p data-buffer)
|
|
|
|
|
(kill-buffer data-buffer))))))
|
2017-05-24 18:18:39 +00:00
|
|
|
|
(let ((buffer (url-retrieve-synchronously
|
|
|
|
|
(soap-port-service-url port))))
|
|
|
|
|
(condition-case err
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(if (null url-http-response-status)
|
|
|
|
|
(error "No HTTP response from server"))
|
|
|
|
|
(if (and soap-debug (> url-http-response-status 299))
|
|
|
|
|
;; This is a warning because some SOAP errors come
|
|
|
|
|
;; back with a HTTP response 500 (internal server
|
|
|
|
|
;; error)
|
|
|
|
|
(warn "Error in SOAP response: HTTP code %s"
|
|
|
|
|
url-http-response-status))
|
|
|
|
|
(soap-parse-envelope (soap-parse-server-response)
|
|
|
|
|
operation wsdl))
|
|
|
|
|
(soap-error
|
|
|
|
|
;; Propagate soap-errors -- they are error replies of the
|
|
|
|
|
;; SOAP protocol and don't indicate a communication
|
|
|
|
|
;; problem or a bug in this code.
|
|
|
|
|
(signal (car err) (cdr err)))
|
|
|
|
|
(error
|
|
|
|
|
(when soap-debug
|
|
|
|
|
(pop-to-buffer buffer))
|
|
|
|
|
(error (error-message-string err)))))))))
|
2015-10-24 12:33:18 +00:00
|
|
|
|
|
2011-02-16 09:25:37 +00:00
|
|
|
|
(defun soap-invoke (wsdl service operation-name &rest parameters)
|
|
|
|
|
"Invoke a SOAP operation and return the result.
|
|
|
|
|
|
|
|
|
|
WSDL is used for encoding the request and decoding the response.
|
|
|
|
|
It also contains information about the WEB server address that
|
|
|
|
|
will service the request.
|
|
|
|
|
|
|
|
|
|
SERVICE is the SOAP service to invoke.
|
|
|
|
|
|
|
|
|
|
OPERATION-NAME is the operation to invoke.
|
|
|
|
|
|
|
|
|
|
PARAMETERS -- the remaining parameters are used as parameters for
|
|
|
|
|
the SOAP request.
|
|
|
|
|
|
|
|
|
|
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
|
2016-03-16 15:03:31 +00:00
|
|
|
|
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."
|
2015-10-24 12:33:18 +00:00
|
|
|
|
(apply #'soap-invoke-internal nil nil wsdl service operation-name parameters))
|
|
|
|
|
|
|
|
|
|
(defun soap-invoke-async (callback cbargs wsdl service operation-name
|
|
|
|
|
&rest parameters)
|
|
|
|
|
"Like `soap-invoke', but call CALLBACK asynchronously with response.
|
|
|
|
|
CALLBACK is called as (apply CALLBACK RESPONSE CBARGS), where
|
|
|
|
|
RESPONSE is the SOAP invocation result. WSDL, SERVICE,
|
|
|
|
|
OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
|
|
|
|
|
(unless callback
|
|
|
|
|
(error "Callback argument is nil"))
|
|
|
|
|
(apply #'soap-invoke-internal callback cbargs wsdl service operation-name
|
|
|
|
|
parameters))
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
(provide 'soap-client)
|
|
|
|
|
|
|
|
|
|
|
2015-08-22 03:46:21 +00:00
|
|
|
|
;; Local Variables:
|
|
|
|
|
;; eval: (outline-minor-mode 1)
|
|
|
|
|
;; outline-regexp: ";;;;+"
|
|
|
|
|
;; End:
|
2011-02-16 09:25:37 +00:00
|
|
|
|
|
|
|
|
|
;;; soap-client.el ends here
|