Repository navigation
fix(task) #29 #30 #31 #32 #33 SOAP options and headers per call, SoapFault handling, input check; #23 add missing tests - #34
Merged
Conversation
1 of 3 tasks
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.
Description
Fixes #23.
Fixes #29.
Fixes #30.
Fixes #31.
Fixes #32.
Fixes #33.
Grouped in one PR because the fixes change the same task, transformer, client, tests, reference pages and the CHANGELOG
Latestsection.SOAP options and headers per call (#29, #30)
SoapCallOptionsTrait(new), used byRequestTaskandRequestTransformer: thesoap_call_options/soap_call_headersoptions (and the header normalizer, moved from the task), andcallWithSoapOptions(), which sets the given options / headers on the client for the call only, then restores the previous ones (also after a failure).RequestTask: the options / headers of the client definition (calls: [setSoapHeaders, ...]) are no longer overwritten bynull(RequestTask overwrites the SOAP options and headers of the client definition #29), and the task ones no longer leak to the next calls of the client (SOAP options and headers of a RequestTask leak to the next calls of the client #30).RequestTransformer(soap_request): newsoap_call_options/soap_call_headersoptions (SOAP options and headers of a RequestTask leak to the next calls of the client #30).SOAP faults (#31, #32)
Client::doSoapCall()rethrows theSoapFaultafter logging it (it returnedfalse), and handles aSoapFaultreturned withexceptions: falsethe same way (SOAP faults are output as results with the exceptions: false option #32).RequestTaskcatches theSoapFault: same error log (Empty resultset for query, now with the faultmessage) and sameRuntimeException, with the fault as previous exception. A method returningfalsenow outputsfalse(A SOAP method returning false is handled as a failed call #31).RequestTransformerthrows aRuntimeExceptionon aSoapFault(it returnedfalse).Input (#33):
RequestTaskthrowsRequestTask expects an array or empty input, <type> given(TypeErrorfromClient::call());Client::call()logs the notice before asoapCall<Method>()override.Tests (#23)
FakeSoapClient(test helper): a non-WSDLSoapClientanswering prepared responses through__doRequest(), without network access (signature compatible from PHP 8.2 to 8.5).ClientTest,RequestTransformerTest,MissingClientExceptionTest,CleverAgeSoapProcessExtensionTest,CleverAgeSoapProcessBundleTest(new);RequestTaskTestrewritten with a realClient: results (includingfalse), headers / options of the client kept, task ones sent for the call only and restored, faults,exceptions: false, overrides, input, header options.Coverage: 172/172 lines (32 tests). Without the fix, 10 of the tests fail. The bundle test declares every class it runs (
RegisterClientsPassincluded, unlike the rest bundle where it mademainfail).Documentation:
request_task.md,request_transformer.md(new options, failures),client.md(failures,exceptions: false, shared state, override example).Checked with process-bundle-demo and a SOAP service mocked by WireMock (see the demo PR):
demo.soap.client_headers(header from the client definition)"count" : 0"count" : 1demo.soap.headers_leak(task header, thensoap_request)"count" : 2"count" : 1demo.soap.false_resultSoap call 'IsAvailable' on client 'wiremock' failedfalsedemo.soap.fault_without_exceptionsSoapFaultobject outputdemo.soap.invalid_inputTypeErrorRequestTask expects an array or empty input, string givendemo.soap,demo.soap.call_failure,demo.soap.call_failure_skipNot changed: the
Empty resultset for queryerror message (misleading, but used by the documentation and the cookbook).Requirements
Breaking changes
falseresult is output (the task failed); thesoap_requesttransformer throws on aSoapFault(it returnedfalse);Client::doSoapCall()(protected) throws theSoapFaultinstead of returningfalse, so a customsoapCall<Method>()returningfalseno longer makes the task fail.exceptionsoption.🤖 Generated with Claude Code