clue/reactphp-soap

Get request in response

Closed this issue · 7 comments

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

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?

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

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?

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 :)

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

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.

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

Thank you very much!

clue commented

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 👍