bug41566.phpt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --TEST--
  2. Bug #41566 (SOAP Server not properly generating href attributes)
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. function test() {
  8. $aUser = new User();
  9. $aUser->sName = 'newUser';
  10. $aUsers = Array();
  11. $aUsers[] = $aUser;
  12. $aUsers[] = $aUser;
  13. $aUsers[] = $aUser;
  14. $aUsers[] = $aUser;
  15. return $aUsers;
  16. }
  17. /* Simple User definition */
  18. Class User {
  19. /** @var string */
  20. public $sName;
  21. }
  22. $server = new soapserver(null,array('uri'=>"http://testuri.org", 'soap_version'=>SOAP_1_2));
  23. $server->addfunction("test");
  24. $HTTP_RAW_POST_DATA = <<<EOF
  25. <?xml version="1.0" encoding="ISO-8859-1"?>
  26. <SOAP-ENV:Envelope
  27. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  28. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  29. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  30. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  31. xmlns:si="http://soapinterop.org/xsd">
  32. <SOAP-ENV:Body>
  33. <ns1:test xmlns:ns1="http://testuri.org" />
  34. </SOAP-ENV:Body>
  35. </SOAP-ENV:Envelope>
  36. EOF;
  37. ob_start();
  38. $server->handle($HTTP_RAW_POST_DATA);
  39. echo "ok\n";
  40. $HTTP_RAW_POST_DATA = <<<EOF
  41. <?xml version="1.0" encoding="UTF-8"?>
  42. <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
  43. xmlns:ns1="http://testuri.org"
  44. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  45. xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
  46. <env:Body>
  47. <ns1:test env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"/>
  48. </env:Body>
  49. </env:Envelope>
  50. EOF;
  51. $server->handle($HTTP_RAW_POST_DATA);
  52. echo "ok\n";
  53. ob_flush();
  54. ?>
  55. --EXPECT--
  56. <?xml version="1.0" encoding="UTF-8"?>
  57. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return SOAP-ENC:arrayType="SOAP-ENC:Struct[4]" xsi:type="SOAP-ENC:Array"><item xsi:type="SOAP-ENC:Struct" id="ref1"><sName xsi:type="xsd:string">newUser</sName></item><item href="#ref1"/><item href="#ref1"/><item href="#ref1"/></return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  58. ok
  59. <?xml version="1.0" encoding="UTF-8"?>
  60. <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://testuri.org" xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"><ns1:testResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"><rpc:result>return</rpc:result><return enc:itemType="enc:Struct" enc:arraySize="4" xsi:type="enc:Array"><item xsi:type="enc:Struct" enc:id="ref1"><sName xsi:type="xsd:string">newUser</sName></item><item enc:ref="#ref1"/><item enc:ref="#ref1"/><item enc:ref="#ref1"/></return></ns1:testResponse></env:Body></env:Envelope>
  61. ok