clue / reactphp-soap

Simple, async SOAP webservice client, built on top of ReactPHP.
https://clue.engineering/2020/announcing-reactphp-soap-2
MIT License
64 stars 25 forks source link

Get request in response #20

Closed francarmona closed 6 years ago

francarmona commented 8 years ago

Could it be possible to get the last request in the response of the method call? Same way that SoapClient::__getLastRequest does.

$api->myMethod($data)->then(
   function ($response){
      // get last request       
   },
   function (Exception $e){

   }
);
clue commented 8 years ago

Thanks for the suggestion! I'm not sure I understand the motivation for this feature though :) Can you give some use-cases on how you're planning to use this?

Thanks!

Also, have you seen #14 yet?

francarmona commented 8 years ago

After getting the response I need to save the request as raw XML in MongoDB in order to keep the trace when the request was done and if it was a "wrong" request. This way I would have the xml soap body of the request and I could relaunch the request whenever I want from different SOAP clients that do not require the request in PHP format. Thanks!

clue commented 8 years ago

Thanks for giving some insight :+:

I'm not opposed to getting this in, but given this is an async library, I'm not really sure what a sane interface may look like. The concept of "last" does not really apply here, given there may be multiple concurrent requests at any time.

Can you post a gist (pseudo code) of what your code may look like?

francarmona commented 8 years ago

Yes, I understand the asynchrony of the requests.

The next gist shows what I would like to achieve.

https://gist.github.com/franCarmona/d9ecface5a7b40e9117d6f4ab7f43b0f

Thanks :)

Furgas commented 7 years ago

You can do something like that: Furgas/php-soap-react@8afb092452caaf5b7c43d9b2adb6957c37bbc4f4

You don't even need to change the original code, just extend the Client and override the soapCall method. Of course you will also need your own factory for your new client.

francarmona commented 7 years ago

Ok, @Furgas . I already did something similar what you did.

Thank you very much!

clue commented 6 years ago

I'd like to get the next release out and believe this has been answered already, so I'm closing this for now. :shipit:

Please come back with more details if you feel this is still needed and we can reconsider this :+1: