server024.phpt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. SOAP Server 24: Send SOAP headers those were not received
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. class TestHeader1 extends SoapHeader {
  8. function __construct($data) {
  9. parent::__construct("http://testuri.org", "Test1", $data);
  10. }
  11. }
  12. class TestHeader2 extends SoapHeader {
  13. function __construct($data) {
  14. parent::__construct("http://testuri.org", "Test2", $data);
  15. }
  16. }
  17. function test() {
  18. global $server;
  19. $server->addSoapHeader(new TestHeader1("Hello Header!"));
  20. $server->addSoapHeader(new TestHeader2("Hello Header!"));
  21. return "Hello Body!";
  22. }
  23. $server = new soapserver(null,array('uri'=>"http://testuri.org"));
  24. $server->addfunction("test");
  25. $HTTP_RAW_POST_DATA = <<<EOF
  26. <?xml version="1.0" encoding="ISO-8859-1"?>
  27. <SOAP-ENV:Envelope
  28. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  29. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  30. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. xmlns:si="http://soapinterop.org/xsd">
  33. <SOAP-ENV:Body>
  34. <ns1:test xmlns:ns1="http://testuri.org"/>
  35. </SOAP-ENV:Body>
  36. </SOAP-ENV:Envelope>
  37. EOF;
  38. $server->handle($HTTP_RAW_POST_DATA);
  39. echo "ok\n";
  40. ?>
  41. --EXPECT--
  42. <?xml version="1.0" encoding="UTF-8"?>
  43. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" 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:Header><ns1:Test1>Hello Header!</ns1:Test1><ns1:Test2>Hello Header!</ns1:Test2></SOAP-ENV:Header><SOAP-ENV:Body><ns1:testResponse><return xsi:type="xsd:string">Hello Body!</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  44. ok