Local.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /** Zend_Soap_Server */
  22. require_once 'Zend/Soap/Server.php';
  23. /** Zend_Soap_Client */
  24. require_once 'Zend/Soap/Client.php';
  25. if (extension_loaded('soap')) {
  26. /**
  27. * Zend_Soap_Client_Local
  28. *
  29. * Class is intended to be used as local SOAP client which works
  30. * with a provided Server object.
  31. *
  32. * Could be used for development or testing purposes.
  33. *
  34. * @category Zend
  35. * @package Zend_Soap
  36. * @subpackage Client
  37. */
  38. class Zend_Soap_Client_Local extends Zend_Soap_Client
  39. {
  40. /**
  41. * Server object
  42. *
  43. * @var Zend_Soap_Server
  44. */
  45. protected $_server;
  46. /**
  47. * Local client constructor
  48. *
  49. * @param Zend_Soap_Server $server
  50. * @param string $wsdl
  51. * @param array $options
  52. */
  53. function __construct(Zend_Soap_Server $server, $wsdl, $options = null)
  54. {
  55. $this->_server = $server;
  56. // Use Server specified SOAP version as default
  57. $this->setSoapVersion($server->getSoapVersion());
  58. parent::__construct($wsdl, $options);
  59. }
  60. /**
  61. * Actual "do request" method.
  62. *
  63. * @internal
  64. * @param Zend_Soap_Client_Common $client
  65. * @param string $request
  66. * @param string $location
  67. * @param string $action
  68. * @param int $version
  69. * @param int $one_way
  70. * @return mixed
  71. */
  72. public function _doRequest(Zend_Soap_Client_Common $client, $request, $location, $action, $version, $one_way = null)
  73. {
  74. // Perform request as is
  75. ob_start();
  76. $this->_server->handle($request);
  77. $response = ob_get_contents();
  78. ob_end_clean();
  79. return $response;
  80. }
  81. }
  82. } // end if (extension_loaded('soap')