Giter Site home page Giter Site logo

php-parallel-soap's Introduction

Parallel, Multi-Curl PHP SoapClient

Build Status Software License Scrutinizer Code Quality codecov Packagist Donate Authoer Blog

Parallel Multi-Curl SoapClient that allow us to perform Parallel multiple requests to SoapServer using CURL.

Working with soap is always frustrating for few reasons:

  • SOAP Messages are complicated and obscure
  • Always slow Performance as lack for connection pooling, ssl sharing, tcp tweaking options that comes with curl
  • Sequential Execution in array of multiple requests there no other way except looping and synchronously send request after another
  • debugging with ability to understand how and what goes through the HTTP " Headers / Request Payload / Response Headers / Response Payload / Error structure etc..."

This Client will allow you send request in parallel, while give you ability to hook in the clinet "Logger / Result Function / Customer curl options like tcp connections reusing and ssl session sharing"

See the Examples to see how to use it.

Comment in the Example are written to help you understand how the client works and what you can do with it and how to customize it to fit your purpose!

Example WSDL

Features

  • Client can work in parallel (multi) and Synchronous (single) mode.
  • Multiple calls using curl_multi_exec, Does not wait for soap consecutive calls ! This client will save a lot of time and resources doing multiple requests at same time!
  • SSL / Session Sharing.
  • __curl_info meta data in response object.
  • Each Request has hash id which is unique to each request ( If you execute the same request 100 times more, it will have the same hash ) so no duplicate requests
  • Very Easy to debug every single point during the request! also ability to use CURL_VERBOSE to debug the connections to the Soap Host
  • Very easy exception handling in parallel mode

SOAP Facts

  • SOAP is HTTP Post with structured message in XML Envelope and SOAPAction Header.
  • SOAPAction header is used in web services for various reason, most common
    • Route request to specific action
    • Serve Multi-Version of service, if Action Method is part of the XML Envelope

Need Help?

If you ever hated SOAP for complexity or performance and you cannot take it anymore, I could help! drop me a line here meabed.com

Contributing

Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the guidelines:

License

The code is available under the MIT license.

php-parallel-soap's People

Contributors

meabed avatar renovate-bot avatar renovate[bot] avatar rstrong-pica9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

php-parallel-soap's Issues

Always timing out

Hey man,

I'm having immense trouble with this. My script keeps timing out after 30 seconds (max exec). The reason for this is because of line 203.

curl_multi_select() is always returning -1 (no I am not running 5.3.18!) and I can't for the life of me figure out why...

Are you able to shed any light?

Async Stuck

Hi,

I am running your code and it get stuck. It will literally run forever:

while ($active && $mrc == CURLM_OK) {
            if (curl_multi_select($mh) != -1) {
                do {
                    $mrc = curl_multi_exec($mh, $active);
                } while ($mrc == CURLM_CALL_MULTI_PERFORM);
            }
        }

I can see this through my xdebug_break();

Here is how I am trying to use:

public function otaAirAvailRq(){
        $otaAirAvailRq  = [];
        $SabreSoap      = new \SoapClientAsync(__DIR__.'/SabreXML/OTA_AirAvailLLS2.1.1RQ.wsdl', ['trace' => 1]);
        $SabreSoap->__setSoapheaders($this->_setSabreHeaders('OTA_AirAvailLLSRQ', 'OTA_AirAvailLLSRQ', false));
        foreach ($this->Itinerary->getLegs() as $leg){
            $requestIds[] = $SabreSoap->OTA_AirAvailRQ($this->_buildAvailRequest($leg, '2.1.1'));
        }
  //this is where it gets stuck in an endless loop.
      foreach ($SabreSoap->run($requestIds) as $response){
     $otaAirAvailRq[] = $response->Return;
     }
        return $otaAirAvailRq;
    }//end of otaAirPriceLlSrq

curl_multi_select($mh) != -1 is always -1.. and there is nothing to change it. Seems like this is a logic error on the client. Its in a endless loop

some libs need now "psr/log": "~2.0" && php v8

Is your feature request related to a problem? Please describe.
some applications & libs use php v8 & "psr/log": "~2.0". It make a conflict to use php-parallel-soap

Describe the solution you'd like
composer defination like - "psr/log": "~1.1|~2.0|~3.0",

No stable version listed for composer

Hi,

I was trying to install your package via composer.

I got this error:

[InvalidArgumentException] Could not find package meabed/asynchronous-soap at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

I had to change my minimum stability to dev in order to properly install it.

Do you have an minimum stable version? Can you just take the version you have to show that it is stable...

Thanks,

Need help creating requests using raw XML

Hello,

thanks for your work, appreciate this a lot and I think it is exactly what I need.
I have a SOAP interface in business context, where I need to pass raw XML, generated/modified per request, to several methods. I would like to use your ParallelSoapClient to do async parallel requests to one specific method, where each request has a (slightly) different XML "body". Is this possible? Thanks in advance,
Oliver

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Unsupported composer value

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php >=8
  • psr/log ~1.1|~2.0|~3.0
  • phpunit/phpunit ~9|~10
  • squizlabs/php_codesniffer 3.10.1
  • overtrue/phplint 9.3.1
  • phpstan/phpstan 1.11.4
github-actions
.github/workflows/ci-8.0.yml
  • actions/checkout v4
  • shivammathur/setup-php v2
.github/workflows/ci-8.1.yml
  • actions/checkout v4
  • shivammathur/setup-php v2
.github/workflows/ci-8.2.yml
  • actions/checkout v4
  • shivammathur/setup-php v2

  • Check this box to trigger a request for Renovate to run again on this repository

Multi requests cause high CPU load

Hello.

When running multiple soap requests with setMulti(true), CPU load is 100%. This behavior shows especially when endpoints work slowly. This happens in the lines:

do {
    $mrc = curl_multi_exec($mh, $active);
} while ($mrc === CURLM_CALL_MULTI_PERFORM || $active);

Possible solution is to call usleep or to call curl_multi_select in the loop.

OS: Debian 10
PHP version: 7.2.34
CURL version: 7.64.0

Proxy options are ignored

How to use proxy host / port option s? Usage of the SoapClient proxy_host and proxy_port options is ignored.
Is it possible to specify with something else ?
Can this option be handled by the ParallelSoapClient class ?

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.