SOAP 1.2 support - #35
Merged
Merged
Conversation
…sport, WSDL binding
Adds SOAP::SOAPVersion, a small bundle class for the constants that
differ between SOAP 1.1 and 1.2 (envelope namespace, header role/relay/
mustUnderstand attributes, media type, fault codes). Driver/Proxy/Router
gain a soap_version accessor (default SOAPVersion1_1, zero behavior
change unless explicitly set to SOAPVersion1_2).
Envelope/header: SOAPEnvelope/SOAPHeader/SOAPBody derive their element
namespace from the configured version instead of hardcoded 1.1 constants.
SOAP 1.1's "actor" header attribute is renamed "role" in 1.2, which also
adds a "relay" attribute 1.1 has no equivalent for.
Fault model: SOAP 1.2 replaces 1.1's flat faultcode/faultstring/
faultactor/detail with a nested Code{Value,Subcode?}+Reason{Text}+Node?+
Role?+Detail? shape (SOAP12Fault). FaultError reads either shape into
the same reader names; Router#fault branches on soap_version to build
the right one.
HTTP transport: SOAP 1.2 folds the SOAPAction value into the
Content-Type's "action" parameter and drops the separate SOAPAction
header entirely (1.1 keeps both). StreamHandler/Proxy/Router/Soaplet all
thread soap_version through to build/parse the right form.
WSDL binding: recognizes the SOAP 1.2 WSDL binding namespace
alongside the 1.1 one at all six dispatch points that previously only
recognized 1.1, and configures generated/runtime-built drivers'
soap_version accordingly based on which binding namespace actually
matched.
SOAP-with-Attachments (MIME multipart) also now honors soap_version:
MIMEMessage previously hardcoded "text/xml" for both the root part and
the outer multipart's own "type" parameter regardless of version. The
legacy SOAPAction header is still sent for attachment requests even
under 1.2 (where it's otherwise dropped) since action placement for
attachments+1.2 combined isn't settled by any spec this was checked
against, and real-world use of that combination is rare -- the same
pragmatic fallback Savon's own client uses unconditionally.
Verified with real live round trips throughout, not just unit tests:
a hand-built SOAP 1.2 envelope round-tripping through Processor.marshal/
unmarshal; a real WEBrick StandaloneServer and Driver both configured
for SOAP 1.2 completing an actual RPC call over real HTTP, proving the
Content-Type-only action dispatch genuinely works; a WSDL2Ruby-generated
driver from a SOAP 1.2-bound WSDL fixture completing a real RPC call
end to end.
Full test:deep clean across all 5 parsers on both ruby:3.4.10 and
soap4r-legacy:1.9.3-p551 throughout development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
role/relayattributes (replacing 1.1'sactor/mustUnderstand-only model), the 1.2 fault model (Code/Reason/Node/Role/Detailinstead offaultcode/faultstring/faultactor/detail), and correct HTTP transport (application/soap+xmlcontent type with the SOAPAction folded into theactionparameter, per spec, instead of the 1.1SOAPActionheader).soap_versionfor the parts' media type instead of hardcodingtext/xml, with a pragmatic fallback: multipart requests still send the legacySOAPActionheader even under 1.2, since action-placement for multipart+1.2 combined isn't settled by any spec and real-world use of that combination is rare.SOAP::SOAPVersion(SOAPVersion1_1/SOAPVersion1_2) bundles the per-version envelope namespace, attribute names, media type, and content-type builder used throughout.Test plan
test/soap/swa/test_soap12_swa.rb) verifying SOAP-1.2 multipart Content-Type, root part media type, and SOAPAction header presencegit merge-treethis merges cleanly againstmaster(both standalone and after PR Add pluggable curb/Faraday HTTP client backends #33 and PR Add WS-Security support: UsernameToken, XML Signature, XML Encryption #34 land)