server026.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. SOAP Server 26: setObject
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. class Foo {
  8. function test() {
  9. return "Hello World";
  10. }
  11. }
  12. $foo = new Foo();
  13. $server = new soapserver(null,array('uri'=>"http://testuri.org"));
  14. $server->setObject($foo);
  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:Body><ns1:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  34. ok