Common.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Soap
  17. * @subpackage Client
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. if (extension_loaded('soap')) {
  23. /**
  24. * @category Zend
  25. * @package Zend_Soap
  26. * @subpackage Client
  27. */
  28. class Zend_Soap_Client_Common extends SoapClient
  29. {
  30. /**
  31. * doRequest() pre-processing method
  32. *
  33. * @var callback
  34. */
  35. protected $_doRequestCallback;
  36. /**
  37. * Common Soap Client constructor
  38. *
  39. * @param callback $doRequestMethod
  40. * @param string $wsdl
  41. * @param array $options
  42. */
  43. function __construct($doRequestCallback, $wsdl, $options)
  44. {
  45. $this->_doRequestCallback = $doRequestCallback;
  46. parent::__construct($wsdl, $options);
  47. }
  48. /**
  49. * Performs SOAP request over HTTP.
  50. * Overridden to implement different transport layers, perform additional XML processing or other purpose.
  51. *
  52. * @param string $request
  53. * @param string $location
  54. * @param string $action
  55. * @param int $version
  56. * @param int $one_way
  57. * @return mixed
  58. */
  59. function __doRequest($request, $location, $action, $version, $one_way = null)
  60. {
  61. if ($one_way === null) {
  62. return call_user_func($this->_doRequestCallback, $this, $request, $location, $action, $version);
  63. } else {
  64. return call_user_func($this->_doRequestCallback, $this, $request, $location, $action, $version, $one_way);
  65. }
  66. }
  67. }
  68. } // end if (extension_loaded('soap')