meng-tian / async-soap-guzzle
An asynchronous SOAP client build on top of Guzzle.
Installs: 1 960 559
Dependents: 5
Suggesters: 1
Security: 0
Stars: 95
Watchers: 3
Forks: 18
Open Issues: 1
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ^6.1 || ^7.0
- meng-tian/php-async-soap: ~1.0
- meng-tian/soap-http-binding: ~0.4.0
- psr/http-factory: ~1.0
Requires (Dev)
- laminas/laminas-diactoros: ^2.0
- phpunit/phpunit: ~7.0|~9.3
This package is not auto-updated.
Last update: 2024-11-02 08:42:22 UTC
README
An asynchronous SOAP client build on top of Guzzle. The SoapClient
implements meng-tian/php-async-soap.
Requirement
PHP 7.1 --enablelibxml --enable-soap
Install
composer require meng-tian/async-soap-guzzle
Usage
From v0.4.0 or newer, an instance of Psr\Http\Message\RequestFactoryInterface
and an instance of Psr\Http\Message\StreamFactoryInterface
need to be injected into Meng\AsyncSoap\Guzzle\Factory
. These two interfaces are defined in PSR-17 to create PSR-7 compliant HTTP instances. This change will decouple this library from any specific implementation of PSR-7 and PSR-17. Clients can determine which implementation of PSR-17 they want to use. Plenty of different implementations of PSR17 can be found from Packagist, e.g., symfony/psr-http-message-bridge
, or laminas/laminas-diactoros
.
- Require this library and an implementation of PSR-17 in your
composer.json
:
... "require": { "php": ">=7.1.0", "meng-tian/async-soap-guzzle": "~0.4.0", "laminas/laminas-diactoros": "^2.0" # this can be replaced by any implementation of PSR-17 }, ...
-
Run
composer install
-
Create your async SOAP client and call your SOAP messages:
use GuzzleHttp\Client; use Meng\AsyncSoap\Guzzle\Factory; use Laminas\Diactoros\RequestFactory; use Laminas\Diactoros\StreamFactory; $factory = new Factory(); $client = $factory->create(new Client(), new StreamFactory(), new RequestFactory(), 'http://www.webservicex.net/Statistics.asmx?WSDL'); // async call $promise = $client->callAsync('GetStatistics', [['X' => [1,2,3]]]); $result = $promise->wait(); // sync call $result = $client->call('GetStatistics', [['X' => [1,2,3]]]); // magic method $promise = $client->GetStatistics(['X' => [1,2,3]]); $result = $promise->wait();
License
This library is released under MIT license.