server002.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. SOAP Server 2: function with parameters and result
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. function Add($x,$y) {
  8. return $x+$y;
  9. }
  10. $server = new soapserver(null,array('uri'=>"http://testuri.org"));
  11. $server->addfunction("Add");
  12. $HTTP_RAW_POST_DATA = <<<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:Add xmlns:ns1="http://testuri.org">
  22. <x xsi:type="xsd:int">22</x>
  23. <y xsi:type="xsd:int">33</y>
  24. </ns1:Add>
  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:AddResponse><return xsi:type="xsd:int">55</return></ns1:AddResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  34. ok