feat: SOAP codec for KAS-API envelope - #24
Merged
Merged
Conversation
… encoder) Closes #3. internal/soap exposes: - Value: discriminated union over xsi:type (string/int/float/boolean, ns2:Map, SOAP-ENC:Array). Map preserves insertion order via []KV. - Decode: parses a KasApi SOAP envelope; returns *Response on success and *FaultError on SOAP-ENV:Fault. - Response.Body exposes typed shortcuts (KasFloodDelay, ReturnString, ReturnInfo, Msg) and the full ordered Raw map. - EncodeRequest: serializes a typed Request as JSON inside the <tns:KasApi><Params> envelope; json.Marshal HTML-escapes <, > and & so the body is always XML-safe. Tests are table-driven over every response fixture under testdata/ (471 files), dispatched by content: envelopes containing SOAP-ENV:Fault must surface as *FaultError, others must decode into a populated Response. testdata/session/ is excluded — those are KasAuth responses covered by issue #5. Notable real-world quirks pinned by tests: - testdata/ftpuser/get_ftpuser_response_failed_empty_list.xml is named "failed" but is a success envelope with empty ReturnInfo array; testdata/ddns/get_ddnsusers_response_failed_empty_list.xml for the same logical case is a Fault. KAS is inconsistent here.
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.
SOAP codec for KAS-API responses and requests.
internal/soap.Value: discriminated union overxsi:type(string/int/float/boolean, ns2:Map, SOAP-ENC:Array). Map preserves insertion order.internal/soap.Decode: parses aKasApiResponseenvelope; returns*Responseon success or*FaultErroronSOAP-ENV:Fault.internal/soap.EncodeRequest: builds the JSON-in-<Params>request envelope with required-field validation.Table-driven tests cover 471 response fixtures across
testdata/plus shape pins (get_accounts,get_server_information, fault detail, empty array) and encoder validation.testdata/session/is left for the KasAuth client (issue #5).stdlib-only (
encoding/xml+encoding/json); no third-party SOAP library — none of the maintained Go SOAP libs handle the Apachexml-soapns2:Mapdiscriminator shape, and the request side is a JSON blob inside an XML element.Closes #3.