savon 2.18.1 → 3.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -158
- data/README.md +53 -74
- data/Rakefile +2 -6
- data/lib/savon/block_interface.rb +4 -3
- data/lib/savon/builder.rb +48 -119
- data/lib/savon/client.rb +13 -44
- data/lib/savon/header.rb +40 -87
- data/lib/savon/http_error.rb +9 -9
- data/lib/savon/log_message.rb +4 -52
- data/lib/savon/message.rb +6 -18
- data/lib/savon/mock/expectation.rb +24 -38
- data/lib/savon/mock/spec_helper.rb +11 -7
- data/lib/savon/mock.rb +0 -1
- data/lib/savon/model.rb +30 -44
- data/lib/savon/operation.rb +90 -118
- data/lib/savon/options.rb +176 -292
- data/lib/savon/qualified_message.rb +10 -91
- data/lib/savon/request.rb +147 -0
- data/lib/savon/request_logger.rb +57 -0
- data/lib/savon/response.rb +31 -45
- data/lib/savon/soap_fault.rb +6 -6
- data/lib/savon/string_utils.rb +4 -3
- data/lib/savon/version.rb +1 -2
- data/lib/savon.rb +10 -5
- metadata +119 -75
- data/lib/savon/addressing.rb +0 -60
- data/lib/savon/effective_options.rb +0 -139
- data/lib/savon/faraday_migration_hint.rb +0 -186
- data/lib/savon/transport/faraday.rb +0 -105
- data/lib/savon/transport/header_validation.rb +0 -62
- data/lib/savon/transport/httpi.rb +0 -142
- data/lib/savon/transport/logging.rb +0 -67
- data/lib/savon/transport/response.rb +0 -73
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f58a5268715a082369bc199231506447defea5f760fae67cb51507a9011836c
|
|
4
|
+
data.tar.gz: d349d7d546fb236e45f433047bd575dd6f6ec206254707094f02420ec58dfc07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91d6cd948edbb82b643fa5aaeef265dcfeef5037459478f0815f01bdacbe04cb159165301a9f0ebc75fd897470ff2a0b51de1fa256123843698a14925f5ebf43
|
|
7
|
+
data.tar.gz: 3a9fe95352e4f85e9e88f7eaffba5fb04df58085380ed7c62e8c0f31c0b110b5127c494125f373e97489c789991b6c1271e68df000606c3e1a3311a17edc951a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,153 +1,22 @@
|
|
|
1
1
|
# Savon changelog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
* **`mtom: true` emits outbound MTOM/XOP request framing** ([#1047](https://github.com/savonrb/savon/pull/1047)). With `attachments`, the request becomes `multipart/related` with an `application/xop+xml` SOAP root part. This is low-level framing only: callers provide the `xop:Include` XML and matching attachment Content-IDs. Savon does not rewrite normal base64 XML into XOP, generate `xop:Include` nodes, validate those references, infer MIME types from the XML, or deserialize inbound MTOM responses. An attachment hash may set `content_id:` to choose its Content-ID independently of its filename, e.g. when the filename holds characters invalid in a header or two attachments share a filename. A Content-ID that is not ASCII or holds spaces or header punctuation raises `ArgumentError` when it was chosen explicitly or the request is MTOM; for plain attachments with a default filename it warns instead. Log output keeps non-Latin text in multipart bodies even next to binary attachments, and filters and pretty-printing now apply to the XML part of a multipart request instead of stopping at its MIME headers.
|
|
21
|
-
|
|
22
|
-
### Security
|
|
23
|
-
|
|
24
|
-
* `Savon::Model.operations` and `.all_operations` no longer rely on a hand-maintained list of reserved names ([GHSA-hjvq-xxqv-7jxh](https://github.com/savonrb/savon/security/advisories/GHSA-hjvq-xxqv-7jxh)). The guard now derives its denylist from the model's own ancestor chains — every method instances respond to plus every method the class object responds to — so a WSDL operation can never shadow an existing method. This closes the `class`/`public_send` bypass (unbounded recursion via the generated `self.class.public_send(...)` bodies, hijacked reflective dispatch) and the whole class of follow-on reports (`new`, `freeze`, `send`, …) by construction instead of one advisory at a time. Re-registering an already-defined operation is still allowed; anything else that collides raises `ArgumentError`. Call such operations explicitly through `model.client.call(:operation, ...)`. Thanks to @manus-pi for securely disclosing this.
|
|
25
|
-
|
|
26
|
-
### Fixed
|
|
27
|
-
|
|
28
|
-
* `Builder` no longer reuses a reserved `xml`-prefixed identifier from the WSDL namespace map. When a schema's `targetNamespace` matched the WSDL root's default namespace, requests declared `xmlns:xmlns` and used elements like `<xmlns:Op>`, so the envelope was not namespace-well-formed. Such namespaces now get another prefix the WSDL declares for the same URI, or `ins0`, `ins1`, … if there is none.
|
|
29
|
-
|
|
30
|
-
* Elements whose types live in another namespace now keep their own prefix instead of `tns:` ([#895](https://github.com/savonrb/savon/issues/895)). Strict services rejected those messages. The type lookup missed because message keys pass through the key converter first (`:entity_ids` becomes `entityIds` while the schema defines `EntityIds`), so every element fell back to `tns:`. The lookup now tries a case-insensitive match when an exact match misses.
|
|
31
|
-
|
|
32
|
-
* A document with a WSSE signature is built three times instead of twice, which signed timestamps need ([#1079](https://github.com/savonrb/savon/pull/1079)). See [akami#25](https://github.com/savonrb/akami/pull/25).
|
|
33
|
-
|
|
34
|
-
### Changed
|
|
35
|
-
|
|
36
|
-
* A URL assigned directly to `client.wsdl.endpoint` is overridden by per-operation port routing once wasabi 5.2 ships ([#879](https://github.com/savonrb/savon/issues/879)). `EffectiveOptions#endpoint` now asks the WSDL document for the current operation's port endpoint first and only falls back to the document-wide address. Pass `:endpoint` explicitly instead — that is still checked first and wins.
|
|
37
|
-
|
|
38
|
-
### Performance
|
|
39
|
-
|
|
40
|
-
* `Builder` looks up the namespace identifier of each WSDL type path with `Hash#key` instead of a `gsub` per candidate prefix: requests built from a 110 KB WSDL allocate 21% fewer objects and 42% less memory.
|
|
41
|
-
|
|
42
|
-
## [2.17.5] - 2026-09-09
|
|
43
|
-
|
|
44
|
-
### Security
|
|
45
|
-
|
|
46
|
-
* `Savon::Model.operations` and `.all_operations` now reject names that normalize to reserved model methods with `ArgumentError`, before defining any methods ([GHSA-x99v-rwvj-g9p5](https://github.com/savonrb/savon/security/advisories/GHSA-x99v-rwvj-g9p5)). This prevents a WSDL operation named `client` from overwriting the client accessor and causing unbounded recursion. Call operations with reserved names explicitly through `model.client.call(:client, ...)`. Thanks to @arpitjain099 for securely disclosing this.
|
|
47
|
-
|
|
48
|
-
## [2.17.4] - 2026-07-03
|
|
49
|
-
|
|
50
|
-
**Restore WS-Addressing headers and fix `:wsse_signature` resolution**
|
|
51
|
-
|
|
52
|
-
### Fixed
|
|
53
|
-
|
|
54
|
-
* **WS-Addressing headers are populated from the WSDL again** ([#1057](https://github.com/savonrb/savon/issues/1057)). With `use_wsa_headers: true` and no explicit `:soap_action` or `:endpoint`, Savon emitted empty `<wsa:Action xsi:nil="true"/>` and `<wsa:To xsi:nil="true"/>` elements instead of the operation's SOAPAction and service endpoint. Up to 2.16.0 those values were populated as a side effect of building the HTTP request. The 2.17.0 transport refactor removed that step.
|
|
55
|
-
* **A global `:host` override no longer rewrites the WSDL's endpoint.** Resolving the request endpoint with `:host` set replaced host and port of the parsed WSDL address in place, visible as a permanently changed `client.wsdl.endpoint` after the first call. Endpoint and SOAPAction resolution moved into `Savon::EffectiveOptions`, which applies the override to a copy and never touches the WSDL document.
|
|
56
|
-
* **A local `:wsse_signature` no longer crashes when set to `false`.** Passing `wsse_signature: false` to a call raised `NoMethodError: undefined method 'have_document?' for false` while building the WSSE header. The envelope builder and the SOAP header also resolved the option with different rules, so they could disagree on which signature applies. Both now read it through `Savon::EffectiveOptions`, the one place that resolves options settable in both the global and the local scope. A falsy local `:wsse_signature` falls back to the global one. Setting a signature object in either scope is unaffected.
|
|
57
|
-
|
|
58
|
-
### Deprecated
|
|
59
|
-
|
|
60
|
-
* **`Savon::Builder::WSA_NAMESPACE`.** WS-Addressing emission moved into `Savon::Addressing`, which owns the namespace as `Savon::Addressing::NAMESPACE`. The constant on `Savon::Builder` stays available as an alias and will be removed in Savon 3.
|
|
61
|
-
|
|
62
|
-
## [2.17.3] - 2026-06-23
|
|
63
|
-
|
|
64
|
-
**Fix Savon::HTTPError compatibility with Faraday transport**
|
|
65
|
-
|
|
66
|
-
### Fixed
|
|
67
|
-
|
|
68
|
-
* **`Savon::HTTPError` works with the Faraday transport** ([#1050](https://github.com/savonrb/savon/issues/1050)). When a the WSDL could not be fetched under `transport: :faraday`, `Savon::HTTPError#to_s` and `#to_hash` raised `NoMethodError: undefined method 'code'` because they were handed a raw `Faraday::Response`, which exposes `#status` rather than `#code`. Transports now normalize adapter-specific response objects into `Savon::Transport::Response` before they reach `Savon::HTTPError`.
|
|
69
|
-
|
|
70
|
-
## [2.17.2] - 2026-06-10
|
|
71
|
-
|
|
72
|
-
**Fix CVE-2026-53510 and restore 2.17.0 cookie regressions**
|
|
73
|
-
|
|
74
|
-
### Fixed
|
|
75
|
-
|
|
76
|
-
* **Fix CVE-2026-53510** `Savon::Model` generated SOAP operation methods by interpolating operation names into Ruby source passed to `module_eval`. An attacker who can control the operation names of a WSDL, can inject Ruby code that executes in the application process. This affects only the `.all_operations` class method provided by `Savon::Model` to automatically register all operations provided by the WSDL. Configuring `Savon::Model` with trusted operation names via `.operations` is safe. Thanks to @connorshea for securely disclosing this, providing a proof and a great report.
|
|
77
|
-
* **`:cookies` request option works again.** The 2.17.0 transport refactor reimplemented cookie handling on top of `Array#map`, which broke callers passing an object that responds to `#cookies` and lost cookie-name de-duplication via `HTTPI::CookieStore`. The HTTPI transport delegates to `HTTPI::Request#set_cookies` again, restoring both shapes.
|
|
78
|
-
* **`response.http.cookies` works again.** 2.17.0's `Savon::Transport::Response` only exposed `code`, `headers`, and `body`. The HTTPI transport now returns `Array<HTTPI::Cookie>` (matching 2.12.1). The Faraday transport returns `Hash<String, String>` so Faraday callers do not need HTTPI types.
|
|
79
|
-
* **`:attachments` now works with a user-supplied `:xml` envelope** ([#761](https://github.com/savonrb/savon/pull/761)). Multipart support shipped in 2.13.0 but only wrapped envelopes Savon built itself. When a caller passed their own `:xml`, attachments were silently dropped.
|
|
80
|
-
|
|
81
|
-
### Added
|
|
82
|
-
|
|
83
|
-
* **Faraday `:cookies` option accepts a `String` or `Hash`.** Strings are used verbatim, Hashes are formatted as `"name=value; name=value"`. Round-trippable with the Faraday response shape.
|
|
84
|
-
* **Three Nori response-parsing options exposed as Savon globals:** `:empty_tag_value` (default `nil`), `:convert_dashes_to_underscores` (default `true`), and `:scrub_xml` (default `true`). Defaults match Nori's own for backwards compatibility.
|
|
85
|
-
|
|
86
|
-
### Changed
|
|
87
|
-
|
|
88
|
-
* **Minimum Nori version is now `~> 2.7`** (was `~> 2.4`). Needed for the new parsing options (`:empty_tag_value` arrived in Nori 2.6.0, `:scrub_xml` in 2.7.0). The 2.5–2.7 series also brings fixes callers benefit from automatically: invalid byte sequences parse instead of raising, REXML no longer turns `<` inside CDATA into `<`, `xs:date`/`xs:time`/`xs:dateTime` typecasting was corrected, and Nori stopped monkey-patching `String` and `Object`.
|
|
89
|
-
* **Faraday migration hints are now value-aware and verified.** Each hint prints the caller's actual option value and spells out the full gem/require/setup where needed. Fixed several incorrect examples and added tests to verify every hint.
|
|
90
|
-
|
|
91
|
-
### Deprecated
|
|
92
|
-
|
|
93
|
-
* Deprecated the global and local `:multipart` options. They have been no-ops since v2.13.0. Specifically since commit 4e7ae5e. Savon detects multipart responses by checking the `Content-Type` header.
|
|
94
|
-
|
|
95
|
-
## [2.17.1] - 2026-05-21
|
|
96
|
-
|
|
97
|
-
### Fixed
|
|
98
|
-
|
|
99
|
-
* [#1008](https://github.com/savonrb/savon/pull/1008) - The HTTPI and Faraday transports no longer set an explicit `Content-Length` request header. The underlying HTTP library already computes it from the body. Sending it as well produced a duplicate header on adapters that do not deduplicate (e.g. httpclient), which some servers reject.
|
|
100
|
-
* Requests using `attachments` were sent with a plain `text/xml` Content-Type instead of `multipart/related`. The 2.17.0 transport refactor assembled the request headers before the multipart body was built, leaving `Builder#multipart` empty at header time, so servers received a multipart body labelled as plain XML. 2.16.x and earlier are unaffected.
|
|
101
|
-
|
|
102
|
-
## [2.17.0] - 2026-05-19
|
|
103
|
-
|
|
104
|
-
**Add opt-in Faraday transport**
|
|
105
|
-
|
|
106
|
-
Callers who set `transport: :faraday` get a memoized `Faraday::Connection` via `client.faraday` and full control over middleware, SSL, auth, and timeouts. Callers who do not set this option see no behavior change. HTTPI remains the default for 2.x.
|
|
107
|
-
|
|
108
|
-
### Added
|
|
109
|
-
|
|
110
|
-
* `transport: :faraday` global option. Defaults to `:httpi` (#992).
|
|
111
|
-
* `client.faraday` returns a memoized `Faraday::Connection` for configuring middleware, SSL, auth, and timeouts when using the Faraday transport.
|
|
112
|
-
* `Savon.client` raises if `transport: :faraday` is set but the faraday gem is not installed, or if any httpi-specific global option (`proxy`, timeouts, `ssl`, auth, `adapter`) is set alongside it. All conflicts are reported with their Faraday equivalents.
|
|
113
|
-
|
|
114
|
-
### Changed
|
|
115
|
-
|
|
116
|
-
* Observers must return `Savon::Transport::Response` (or `nil`) instead of `HTTPI::Response`.
|
|
117
|
-
|
|
118
|
-
### Deprecated
|
|
119
|
-
|
|
120
|
-
* The HTTPI transport (currently the default) and all HTTPI-specific global options enumerated in `Savon::FaradayMigrationHint::OPTIONS` (`proxy`, `open_timeout`, `read_timeout`, `write_timeout`, the `ssl_*` family, `basic_auth`, `digest_auth`, `ntlm`, `follow_redirects`, `adapter`) will be removed in 3.0. Migrate to `transport: :faraday`. `FaradayMigrationHint` shows the Faraday equivalent for each option.
|
|
121
|
-
* Returning `HTTPI::Response` from observers emits a deprecation warning and will be removed in 3.0. Return `Savon::Transport::Response` instead.
|
|
122
|
-
|
|
123
|
-
The Faraday transport unblocks:
|
|
124
|
-
|
|
125
|
-
* redirect following for WSDL fetches via `faraday-follow-redirects` middleware (#1033, savonrb/wasabi#18)
|
|
126
|
-
* digest authentication via `faraday-digestauth` middleware (#1021, savonrb/httpi#250)
|
|
127
|
-
* proxy authentication with special characters in passwords (#941)
|
|
128
|
-
* and setting an `Accept` header for WSDL requests from Rails apps (savonrb/wasabi#115)
|
|
129
|
-
|
|
130
|
-
## [2.16.0] - 2026-05-18
|
|
131
|
-
|
|
132
|
-
**Restore compatibility**
|
|
133
|
-
|
|
134
|
-
If you stayed on 2.12.1 because a later version broke something, this release is for you. The fixes below target the most commonly reported upgrade blockers. Existing code should work without modification.
|
|
135
|
-
|
|
136
|
-
### Fixed
|
|
137
|
-
|
|
138
|
-
* Restore `Savon::Response#hash` removed in 2.14.0 (#985). Callers on 2.12.1 that use `response.hash` get the soap body back instead of Ruby's integer object id.
|
|
139
|
-
* Require wasabi >= 5.1.0 (#1015, #1016). Wasabi 4.x used message names as soap body element names and SOAPAction header values instead of operation names (savonrb/wasabi#122), causing servers to return a fault or reject the action for operations whose message name carried an `In` suffix.
|
|
140
|
-
* Stop dumping all WSDL namespaces into every soap envelope (#1014, #942). 2.13.0 injected every namespace from the entire WSDL document into each request, including structural ones that have no place in a request body. Strict servers reject envelopes with unexpected or duplicate declarations.
|
|
141
|
-
* Raise a proper `SOAPFault` instead of a raw exception when `soap:Fault` contains invalid encoding (#923).
|
|
142
|
-
* `SOAPFault.present?` was ignoring its `xml` argument and always operating on the instance's own body.
|
|
143
|
-
|
|
144
|
-
### Changed
|
|
145
|
-
|
|
146
|
-
* Added Ruby 3.4 (#1024) and Ruby 4.0 (#1039) to the CI test matrix.
|
|
147
|
-
|
|
148
|
-
### Deprecated
|
|
149
|
-
|
|
150
|
-
* `Savon::Response#hash` emits a deprecation warning on each call. Use `#full_hash` going forward. Will be removed in 3.0.
|
|
3
|
+
## Unreleased
|
|
4
|
+
* Add your PR changelog line here
|
|
5
|
+
|
|
6
|
+
## 3.0.0.rc1 (2024-07-15)
|
|
7
|
+
|
|
8
|
+
* Use Faraday instead of HTTPI
|
|
9
|
+
* BC BREAKING Cookies are handled differently now
|
|
10
|
+
* BC BREAKING Multiple pieces of functionality will rely on faraday libraries to be provided by the consuming codebase
|
|
11
|
+
* BC BREAKING Adapter overrides now utilize the faraday model
|
|
12
|
+
* BC BREAKING Multiple hard deprecations due to a lack of feature parity between Faraday and HTTPI
|
|
13
|
+
* Deprecates digest auth
|
|
14
|
+
* Deprecates ssl_cert_key_file auth, upgrade path is to read the key
|
|
15
|
+
in and provide it
|
|
16
|
+
* Deprecates encrypted ssl keys, upgrade path is to
|
|
17
|
+
decrypt the key and pass it to faraday in code
|
|
18
|
+
* Deprecates providing a ca cert, upgrade path is to provide a ca cert file
|
|
19
|
+
* deprecates overriding ssl ciphers, as faraday does not support this
|
|
151
20
|
|
|
152
21
|
## 2.15.1 (2024-07-08)
|
|
153
22
|
|
|
@@ -1301,13 +1170,3 @@ Pay attention to the following list and read the updated Wiki: http://wiki.githu
|
|
|
1301
1170
|
## 0.5.0 (2009-11-29)
|
|
1302
1171
|
|
|
1303
1172
|
* Complete rewrite and public release.
|
|
1304
|
-
|
|
1305
|
-
[2.18.1]: https://github.com/savonrb/savon/compare/v2.18.0...v2.18.1
|
|
1306
|
-
[2.18.0]: https://github.com/savonrb/savon/compare/v2.17.5...v2.18.0
|
|
1307
|
-
[2.17.5]: https://github.com/savonrb/savon/compare/v2.17.4...v2.17.5
|
|
1308
|
-
[2.17.4]: https://github.com/savonrb/savon/compare/v2.17.3...v2.17.4
|
|
1309
|
-
[2.17.3]: https://github.com/savonrb/savon/compare/v2.17.2...v2.17.3
|
|
1310
|
-
[2.17.2]: https://github.com/savonrb/savon/compare/v2.17.1...v2.17.2
|
|
1311
|
-
[2.17.1]: https://github.com/savonrb/savon/compare/v2.17.0...v2.17.1
|
|
1312
|
-
[2.17.0]: https://github.com/savonrb/savon/compare/v2.16.0...v2.17.0
|
|
1313
|
-
[2.16.0]: https://github.com/savonrb/savon/compare/v2.15.1...v2.16.0
|
data/README.md
CHANGED
|
@@ -2,109 +2,88 @@
|
|
|
2
2
|
|
|
3
3
|
Heavy metal SOAP client
|
|
4
4
|
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[](https://coveralls.io/github/savonrb/savon?branch=main)
|
|
5
|
+
[Documentation](https://www.rubydoc.info/gems/savon/) | [Support](https://stackoverflow.com/questions/tagged/savon) |
|
|
6
|
+
[Mailing list](https://groups.google.com/forum/#!forum/savonrb) | [Twitter](http://twitter.com/savonrb)
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
[](https://github.com/savonrb/savon/actions/workflows/ci.yml)
|
|
9
|
+
[](http://badge.fury.io/rb/savon)
|
|
10
|
+
[](https://codeclimate.com/github/savonrb/savon)
|
|
11
|
+
[](https://coveralls.io/r/savonrb/savon)
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
If you're reading this on GitHub, note that this README is for the main branch and that features/changes described here might not correspond to your version. You can find the documentation for your release [at rubydoc.info](https://www.rubydoc.info/find/gems?q=savon).
|
|
12
14
|
|
|
13
15
|
## Installation
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
gem 'savon', '~> 2.17'
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```ruby
|
|
22
|
-
require 'savon'
|
|
23
|
-
|
|
24
|
-
# Point Savon to a local or remote WSDL document
|
|
25
|
-
client = Savon.client(wsdl: 'https://service.example.com?wsdl')
|
|
26
|
-
|
|
27
|
-
# See what the service exposes
|
|
28
|
-
client.operations
|
|
29
|
-
# => [:find_user, :create_user]
|
|
30
|
-
|
|
31
|
-
# Make a request and work with the response
|
|
32
|
-
response = client.call(:find_user, message: { id: 42 })
|
|
33
|
-
response.body[:find_user_response]
|
|
34
|
-
# => { id: 42, name: "Hoff" }
|
|
17
|
+
Savon is available through [Rubygems](http://rubygems.org/gems/savon) and can be installed via:
|
|
35
18
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
puts e.to_hash.dig(:fault, :faultstring)
|
|
19
|
+
```
|
|
20
|
+
$ gem install savon
|
|
39
21
|
```
|
|
40
22
|
|
|
41
|
-
|
|
23
|
+
or add it to your Gemfile like this:
|
|
42
24
|
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
wsdl: 'https://service.example.com?wsdl',
|
|
46
|
-
pretty_print_xml: true,
|
|
47
|
-
log: true
|
|
48
|
-
)
|
|
25
|
+
```
|
|
26
|
+
gem 'savon', '~> 3.0.0'
|
|
49
27
|
```
|
|
50
28
|
|
|
51
|
-
|
|
29
|
+
## Usage example
|
|
52
30
|
|
|
53
|
-
|
|
31
|
+
``` ruby
|
|
32
|
+
require 'savon'
|
|
54
33
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Savon.client(wsdl: '...', basic_auth: ['user', 'secret'])
|
|
34
|
+
# create a client for the service
|
|
35
|
+
client = Savon.client(wsdl: 'http://service.example.com?wsdl')
|
|
58
36
|
|
|
59
|
-
#
|
|
60
|
-
Savon.client
|
|
61
|
-
|
|
37
|
+
# or: create a client with a wsdl provided as a string
|
|
38
|
+
client = Savon.client do |config|
|
|
39
|
+
wsdl_content = File.read("/path/to/wsdl")
|
|
40
|
+
config.wsdl wsdl_content
|
|
41
|
+
end
|
|
62
42
|
|
|
63
|
-
|
|
43
|
+
client.operations
|
|
44
|
+
# => [:find_user, :list_users]
|
|
64
45
|
|
|
65
|
-
|
|
46
|
+
# call the 'findUser' operation
|
|
47
|
+
response = client.call(:find_user, message: { id: 42 })
|
|
66
48
|
|
|
67
|
-
|
|
49
|
+
response.body
|
|
50
|
+
# => { find_user_response: { id: 42, name: 'Hoff' } }
|
|
51
|
+
```
|
|
68
52
|
|
|
69
|
-
|
|
53
|
+
For more examples, you should check out the
|
|
54
|
+
[integration tests](https://github.com/savonrb/savon/tree/version2/spec/integration).
|
|
70
55
|
|
|
71
|
-
|
|
56
|
+
## Upgrading from v2.x to v3.x
|
|
72
57
|
|
|
73
|
-
|
|
74
|
-
client.call(:upload,
|
|
75
|
-
xml: <<~XML,
|
|
76
|
-
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
|
77
|
-
xmlns:xop="http://www.w3.org/2004/08/xop/include">
|
|
78
|
-
<soap:Body>
|
|
79
|
-
<tns:upload><tns:file><xop:Include href="cid:doc1@example"/></tns:file></tns:upload>
|
|
80
|
-
</soap:Body>
|
|
81
|
-
</soap:Envelope>
|
|
82
|
-
XML
|
|
83
|
-
mtom: true,
|
|
84
|
-
attachments: [{ filename: "report.pdf", content_id: "doc1@example", content: File.binread("report.pdf") }]
|
|
85
|
-
)
|
|
86
|
-
```
|
|
58
|
+
See [UPGRADING.md](UPGRADING.md) for more information.
|
|
87
59
|
|
|
88
|
-
## Ruby support
|
|
60
|
+
## Ruby version support
|
|
89
61
|
|
|
90
|
-
|
|
62
|
+
Every savon release is tested with contemporary supported versions of ruby. Historical compatibility information:
|
|
91
63
|
|
|
92
|
-
|
|
64
|
+
* `main` - same support as Ruby
|
|
65
|
+
* 2.15.x - MRI 3.0, 3.1, 3.2, 3.3
|
|
66
|
+
* 2.13.x, 2.14.x - MRI 2.7, 3.0, 3.1
|
|
67
|
+
* 2.12.x - MRI 2.2, 2.3, 2.4, 2.5
|
|
68
|
+
* 2.11.x - MRI 2.0, 2.1, 2.2, and 2.3
|
|
93
69
|
|
|
94
|
-
|
|
70
|
+
If you are running MRI 1.8.7, try a 2.6.x release.
|
|
95
71
|
|
|
96
|
-
|
|
72
|
+
Most changes are not backported to older versions of savon, or unsupported ruby versions.
|
|
97
73
|
|
|
98
|
-
|
|
74
|
+
## Running tests
|
|
99
75
|
|
|
100
|
-
|
|
76
|
+
```bash
|
|
77
|
+
$ bundle install
|
|
78
|
+
$ bundle exec rspec
|
|
79
|
+
```
|
|
101
80
|
|
|
102
|
-
##
|
|
81
|
+
## FAQ
|
|
103
82
|
|
|
104
|
-
|
|
83
|
+
* URI::InvalidURIError -- if you see this error, then it is likely that the http client you are using cannot parse the URI for your WSDL. Try `gem install httpclient` or add it to your `Gemfile`.
|
|
84
|
+
- See https://github.com/savonrb/savon/issues/488 for more info
|
|
105
85
|
|
|
106
|
-
**MTOM/XOP support is request framing only.** Savon can emit outbound MTOM/XOP request framing, but it does not rewrite normal base64 XML into XOP, generate `xop:Include` nodes, validate references, infer MIME types from XML, or deserialize inbound MTOM responses. Callers provide the `xop:Include` XML and matching attachment Content-IDs. `mtom: true` without `attachments` has no effect. For SOAP 1.2, the action is still sent as a `SOAPAction` header, as elsewhere in Savon, rather than as the `action=` parameter of the start-info media type.
|
|
107
86
|
|
|
108
|
-
##
|
|
87
|
+
## Documentation
|
|
109
88
|
|
|
110
|
-
|
|
89
|
+
Please be sure to [read the documentation](https://www.rubydoc.info/github/savonrb/savon/).
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
1
|
require "bundler/gem_tasks"
|
|
4
2
|
require "rspec/core/rake_task"
|
|
5
3
|
|
|
@@ -12,7 +10,5 @@ RSpec::Core::RakeTask.new "spec:integration" do |t|
|
|
|
12
10
|
t.pattern = "spec/integration/**/*_spec.rb"
|
|
13
11
|
end
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
task test
|
|
17
|
-
|
|
18
|
-
task default: :spec
|
|
13
|
+
task :default => :spec
|
|
14
|
+
task :test => :spec
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
2
|
module Savon
|
|
4
3
|
class BlockInterface
|
|
4
|
+
|
|
5
5
|
def initialize(target)
|
|
6
6
|
@target = target
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def evaluate(block)
|
|
10
|
-
if block.arity
|
|
10
|
+
if block.arity > 0
|
|
11
11
|
block.call(@target)
|
|
12
12
|
else
|
|
13
|
-
@original = eval("self", block.binding
|
|
13
|
+
@original = eval("self", block.binding)
|
|
14
14
|
instance_eval(&block)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -22,5 +22,6 @@ module Savon
|
|
|
22
22
|
rescue NoMethodError
|
|
23
23
|
@original.send(method, *args, &block)
|
|
24
24
|
end
|
|
25
|
+
|
|
25
26
|
end
|
|
26
27
|
end
|