server015.phpt 1.2 KB

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