web services - Consuming SOAP and REST WebServices at the same time in PHP -


my objective consume various web services , merge results.

i doing using php curl, number of web services has increased, service slowed since process waiting response , make request next web service.

i solved issue using curl_multi , working fine.

now, have new problem, because have new web services add in service use soap protocol , can't simultaneous requests anymore, because don't use curl soap web services, use soapclient.

i know can make xml soap directives , send curl, seems me bad practice.

in short, there way consume rest , soap web services simultaneously?

i first try unified, asynchronous guzzle setup others have said. if doesn't work out suggest not using process forking or multithreading. neither simple use or maintain. example, mixing guzzle , threads requires special attention.

i don't know structure of application, this might case queue. put message queue each api call , let multiple php daemons read out of queue , make actual requests. code can organized use curl or soapclient depending on protocol or endpoint instead of trying combine them. start many daemons want make requests in parallel. avoids of complexity of threading or process management , scales easily.

when use architecture keep track of "semaphore" in key-value store or database. start semaphore count of api calls made. each complete count reduced. each process checks when count hits 0 , know of work done. necessary when there's subsequent task, such calculating of api results or updating record let users know job done.

now setup sounds more complicated process forking or multithreading, each component testable , scales across servers.

i've put php library helps build architecture i'm describing. it's basic pipelining allows mix of synchronous , asynchronous processes. async work handled queue , semaphore. api calls need happen in sequence each process class. api calls made concurrently go multiprocess class. processlist sets pipeline.


Comments