classmap001.phpt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. SOAP Classmap 1: SoapServer support for classmap
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. $GLOBALS['HTTP_RAW_POST_DATA']="
  10. <env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
  11. xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
  12. xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
  13. xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
  14. xmlns:ns1=\"http://schemas.nothing.com\"
  15. >
  16. <env:Body>
  17. <dotest>
  18. <book xsi:type=\"ns1:book\">
  19. <a xsi:type=\"xsd:string\">Blaat</a>
  20. <b xsi:type=\"xsd:string\">aap</b>
  21. </book>
  22. </dotest>
  23. </env:Body>
  24. <env:Header/>
  25. </env:Envelope>";
  26. class test{
  27. function dotest(book $book){
  28. $classname=get_class($book);
  29. return "Classname: ".$classname;
  30. }
  31. }
  32. class book{
  33. public $a="a";
  34. public $b="c";
  35. }
  36. $options=Array(
  37. 'actor' =>'http://schema.nothing.com',
  38. 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
  39. );
  40. $server = new SoapServer(__DIR__."/classmap.wsdl",$options);
  41. $server->setClass("test");
  42. $server->handle($GLOBALS['HTTP_RAW_POST_DATA']);
  43. echo "ok\n";
  44. ?>
  45. --EXPECT--
  46. <?xml version="1.0" encoding="UTF-8"?>
  47. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" 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:dotestResponse><res xsi:type="xsd:string">Classname: book</res></ns1:dotestResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  48. ok