Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Latest
------

### Changes
* [#66](https://github.com/cleverage/soap-process-bundle/issues/66) RequestTask logs a failed call as `Soap call failed` instead of the misleading `Empty resultset for query` (same level and log context). Remove the `monolog.logger` tag of `RequestTransformer`, which has no logger. Type `MissingClientException::create(string $code)`. Document that a client, shared, keeps its state between two process executions in a long-running worker. Update documentation and tests.
* [#64](https://github.com/cleverage/soap-process-bundle/issues/64) Configuring a key under `clever_age_soap_process` is deprecated: the bundle has no configuration and the keys were ignored without notice (new internal `Configuration`, empty; notice when the container is compiled). They will be rejected in 4.0. Require `symfony/deprecation-contracts`, used directly. Update documentation, add tests.
* [#62](https://github.com/cleverage/soap-process-bundle/issues/62) The bundle throws exceptions implementing `ProcessExceptionInterface` of the process bundle instead of raw SPL exceptions (as [cleverage/process-bundle#317](https://github.com/cleverage/process-bundle/issues/317)): new `Exception\UnexpectedValueException`, `Exception\InvalidArgumentException` and `Exception\RuntimeException`, extending the SPL exceptions thrown before (same messages, the existing `catch` keep working). Add tests.
* [#60](https://github.com/cleverage/soap-process-bundle/issues/60) Composer: require PHP `^8.2` instead of `>=8.2` (PHP 9 is no longer accepted before being tested), remove the authorization of the `symfony/flex` plugin, which is not required (the CI installs it globally), as [cleverage/process-bundle#319](https://github.com/cleverage/process-bundle/issues/319).
Expand Down
1 change: 0 additions & 1 deletion config/services/transformer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
tags:
# The code is the one returned by RequestTransformer::getCode(): the transformer is loaded lazily
- { name: cleverage.transformer, code: soap_request }
- { name: monolog.logger, channel: cleverage_process_transformer }
cleverage_soap_process.transformer.request:
alias: CleverAge\SoapProcessBundle\Transformer\RequestTransformer
public: false
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbooks/soap_enrich_csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ How it works:
[CsvWriterTask](https://github.com/cleverage/process-bundle/blob/main/docs/reference/tasks/csv_writer_task.md).

Note that the error output of the RequestTask is its input (the SOAP arguments), not the CSV line: the details of the
failed call (options, last request and response) are in the log context of the `Empty resultset for query` error
failed call (options, last request and response) are in the log context of the `Soap call failed` error
logged by the task.

To add a single value to the line instead of replacing it, the SOAP call can also be done inside a `mapping` with the
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ Notes
`setSoapHeaders()` (e.g. in the `calls` of the service definition) are used by every call. The
[RequestTask](tasks/request_task.md) and the [RequestTransformer](transformers/request_transformer.md) set their
own `soap_call_options` / `soap_call_headers` for their call only, then restore these values.
* Being shared, a client keeps its state from one process execution to the next as long as the PHP process runs, e.g.
in a long-running worker (Messenger, [ui-process-bundle](https://github.com/cleverage/ui-process-bundle)): the
`SoapClient` (and so the WSDL, loaded once: `setWsdl()` has no effect after the first call), the options and headers
changed with `setSoapOptions()` / `setSoapHeaders()` and the last request and response traces (overwritten by each
call). The client is not reset between two executions: give the values specific to a call with the
`soap_call_options` / `soap_call_headers` options of the task or the transformer rather than by changing the client.
2 changes: 1 addition & 1 deletion docs/reference/tasks/request_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Notes
-----

* When the call fails (the client throws a `SoapFault`, see [client](../client.md)), the task logs an error
`Empty resultset for query`, with the options, the fault message and the last request and response in the log
`Soap call failed`, with the options, the fault message and the last request and response in the log
context, then throws a `RuntimeException` (`Soap call '<method>' on client '<client>' failed`, with the `SoapFault`
as previous exception), handled by the `error_strategy`:
- with `error_strategy: skip`, the `outputs` tasks are skipped and the `error_outputs` tasks receive the input of
Expand Down
5 changes: 1 addition & 4 deletions src/Exception/MissingClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/
class MissingClientException extends \UnexpectedValueException implements ProcessExceptionInterface
{
/**
* @param string $code
*/
public static function create($code): self
public static function create(string $code): self
{
$errorStr = "No Soap client with code : {$code}";

Expand Down
2 changes: 1 addition & 1 deletion src/Task/RequestTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function execute(ProcessState $state): void
'last_response_headers' => $client->getLastResponseHeaders(),
];

$this->logger->error('Empty resultset for query', $logContext);
$this->logger->error('Soap call failed', $logContext);

// The process manager applies the error strategy: the process fails with "stop", the error outputs
// receive the task input with "skip"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public function testTransformerIsRegistered(): void
// Public for the direct access from the service container, deprecated
self::assertTrue($transformer->isPublic());
self::assertSame([['package' => 'cleverage/soap-process-bundle', 'version' => '3.3']], $transformer->getTag('container.private'));
self::assertSame([['channel' => 'cleverage_process_transformer']], $transformer->getTag('monolog.logger'));
// No logger
self::assertFalse($transformer->hasTag('monolog.logger'));
$arguments = $transformer->getArguments();
self::assertCount(1, $arguments);
self::assertInstanceOf(Reference::class, $arguments[0]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/RequestTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testFailedCall(): void
self::assertNull($state->getOutput());
$errors = array_values(array_filter($this->logs, static fn (array $log): bool => 'error' === $log['level']));
self::assertCount(1, $errors);
self::assertSame('Empty resultset for query', $errors[0]['message']);
self::assertSame('Soap call failed', $errors[0]['message']);
self::assertSame('Unknown method', $errors[0]['context']['message']);
self::assertIsString($errors[0]['context']['last_response']);
self::assertStringContainsString('Unknown method', $errors[0]['context']['last_response']);
Expand Down
Loading