server016.phpt 1.0 KB

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