Code Monkey home page Code Monkey logo

async-soap-guzzle's Introduction

Asynchronous SOAP client

codecov.io workflow

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.

  1. 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
    },
...
  1. Run composer install

  2. 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.