server005.phpt 1.3 KB

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