server023.phpt 1.6 KB

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