classmap002.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. SOAP Classmap 2: SoapClient support for classmap
  3. --EXTENSIONS--
  4. soap
  5. --INI--
  6. soap.wsdl_cache_enabled=0
  7. --FILE--
  8. <?php
  9. class TestSoapClient extends SoapClient{
  10. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  11. return <<<EOF
  12. <?xml version="1.0" encoding="UTF-8"?>
  13. <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>
  14. <ns1:dotest2Response><res xsi:type="ns1:book">
  15. <a xsi:type="xsd:string">Blaat</a>
  16. <b xsi:type="xsd:string">aap</b>
  17. </res>
  18. </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
  19. EOF;
  20. }
  21. }
  22. class book{
  23. public $a="a";
  24. public $b="c";
  25. }
  26. $options=Array(
  27. 'actor' =>'http://schema.nothing.com',
  28. 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
  29. );
  30. $client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
  31. $ret = $client->dotest2("???");
  32. var_dump($ret);
  33. echo "ok\n";
  34. ?>
  35. --EXPECT--
  36. object(book)#2 (2) {
  37. ["a"]=>
  38. string(5) "Blaat"
  39. ["b"]=>
  40. string(3) "aap"
  41. }
  42. ok