bug32776.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Bug #32776 (SOAP doesn't support one-way operations)
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. $d = null;
  10. function test($x) {
  11. global $d;
  12. $d = $x;
  13. }
  14. class LocalSoapClient extends SoapClient {
  15. function __construct($wsdl, $options) {
  16. parent::__construct($wsdl, $options);
  17. $this->server = new SoapServer($wsdl, $options);
  18. $this->server->addFunction('test');
  19. }
  20. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  21. ob_start();
  22. $this->server->handle($request);
  23. $response = ob_get_contents();
  24. ob_end_clean();
  25. return $response;
  26. }
  27. }
  28. $x = new LocalSoapClient(__DIR__."/bug32776.wsdl",array("trace"=>true,"exceptions"=>false));
  29. var_dump($x->test("Hello"));
  30. var_dump($d);
  31. var_dump($x->__getLastRequest());
  32. var_dump($x->__getLastResponse());
  33. echo "ok\n";
  34. ?>
  35. --EXPECT--
  36. NULL
  37. string(5) "Hello"
  38. string(459) "<?xml version="1.0" encoding="UTF-8"?>
  39. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:test><x xsi:type="xsd:string">Hello</x></SOAP-ENV:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
  40. "
  41. string(0) ""
  42. ok