Advertisement
Guest User

Untitled

a guest
May 25th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2. class Foo {
  3.    
  4.     function __construct(SoapServer $soap) {
  5.         $soap->addSoapHeader(new SoapHeader('answers', 'everything', 42));
  6.     }
  7.    
  8.   function __call($name, $args) {
  9.     if ($name == "test") {
  10.       return "Hello World";
  11.     } else {
  12.       return new SoapFault("Server","Function $name doesn't exist");
  13.     }
  14.   }
  15. }
  16.  
  17. $server = new soapserver(null,array('uri'=>"http://testuri.org"));
  18. $server->setclass("Foo", $server);
  19.  
  20. $HTTP_RAW_POST_DATA = <<<EOF
  21. <?xml version="1.0" encoding="ISO-8859-1"?>
  22. <SOAP-ENV:Envelope
  23.   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  24.   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  25.   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  26.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  27.   xmlns:si="http://soapinterop.org/xsd">
  28.   <SOAP-ENV:Body>
  29.     <ns1:test xmlns:ns1="http://testuri.org" />
  30.   </SOAP-ENV:Body>
  31. </SOAP-ENV:Envelope>
  32. EOF;
  33.  
  34. $server->handle($HTTP_RAW_POST_DATA);
  35. echo "ok\n";
  36.  
  37. exit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement