bug50675.phpt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Bug #50675 SoapClient can't handle object references correctly.
  3. --EXTENSIONS--
  4. soap
  5. --FILE--
  6. <?php
  7. class TestSoapClient extends SoapClient {
  8. function __doRequest($request, $location, $action, $version, $one_way = 0): ?string {
  9. return <<<EOF
  10. <?xml version="1.0" encoding="UTF-8"?>
  11. <soapenv:Envelope
  12. xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  13. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  14. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  15. <soapenv:Body>
  16. <soapenv:Fault>
  17. <faultcode>soapenv:Server.userException</faultcode>
  18. <faultstring>service.EchoServiceException</faultstring>
  19. <detail>
  20. <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
  21. <intParameter xsi:type="xsd:int">105</intParameter>
  22. <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
  23. </service.EchoServiceException>
  24. <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
  25. </detail>
  26. </soapenv:Fault>
  27. </soapenv:Body>
  28. </soapenv:Envelope>
  29. EOF;
  30. }
  31. }
  32. ini_set('soap.wsdl_cache_enabled', 0);
  33. $parameters = [
  34. 'trace' => 1,
  35. 'exceptions' => 0,
  36. ];
  37. $client = new TestSoapClient(__DIR__ . '/bug50675.wsdl', $parameters);
  38. $person = new stdClass();
  39. $person->name = 'name';
  40. $result = $client->echoPerson($person, $person);
  41. print($client->__getLastRequest());
  42. ?>
  43. --EXPECT--
  44. <?xml version="1.0" encoding="UTF-8"?>
  45. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://service" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:service.EchoService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoPerson><p xsi:type="ns2:Person" id="ref1"><name xsi:type="SOAP-ENC:string">name</name></p><p2 href="#ref1"/></ns1:echoPerson></SOAP-ENV:Body></SOAP-ENV:Envelope>