-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
AbstractSoapClientBase should not define static SoapClient instance #15
Comments
Current situation Not a long time ago, in the WsdlToPhp/PackageGenerator#97 issue, it has been brought to my knowledge that a better SoapClient implementation had been created at https://github.com/phpro/soap-client and I can't deny that it provides strong features and a strong implementation around the SoapClient class. This is why I'm struggling between:
My opinion is that it's useless to create yet another SoapClient implementation especially if there is another one that is better and is liked by others. Future changes
This would effectively impacts the PackageGenerator project as it would need to change the static calls to non static calls to the SoapClient instance plus minor changes. All these changes would require to create a new major release for both projects as it would break current implementations. Gains of the future changes
What do you think? Am I missing more improvements about this issue? |
@mikaelcom Is there any update? Because it is not possible to create instances for two different services on the same flow. |
Hi, I'm beginning my new life as of tomorrow so updates are coming soon, I'll have more time to work on my open source projects, I can't tell right now exactly when but soon, Currently, you can override the SoapClientBase as the SoapClient is used with |
@mikaelcom Hi, I had some time to solve this problem at least only in PackageBase. It works very well. #17 |
I doubt it works in a generated ServiceType class like this one, This must be done at the same moment with the PackageGenerator release update and certainly in a major release for BC |
The ideal solution is to use "Late Static BInding" but it's necessary to modify both projects "PackageBase" and "PackageGenerator" On PackageBase, apply this patch to class AbstractSoapClientBase On PackageGenerator it's necessary to change the generation of Get.php, to add a new property For our project I have modified the Get.php files manually and now I can use two different web services at the same time without collisions. This works on PHP 5.3.0 or later |
Sorry for the delay/absence, I would prefer to change the property to a non-static property instead of adding the declaration of the I'm going to have to create the new major version that introduces the @amari-at4 feel free to give me more feedback if you want, thx for your participation |
getSoapClient declared as non-static. it aims to solve #15
When having multiple subclasses of AbstractSoapClientBase with different WSDL endpoints the static instance of SoapClient is shared between the subclasses. As a SoapClient instance is bound to one WSDL endpoint you are not able to call different endpoints without completely reinitializing AbstractSoapClientBase-subclass.
AbstractSoapClientBase::soapClient should not be defined on that level. Subclasses of AbstractSoapClientBase should be responsible to define a static SoapClient.
An alternative would be to use an instance member for SoapClient instead of a static member. But this implies that SoapClientInterface needs to be changed aswell.
The text was updated successfully, but these errors were encountered: