Annotation of embedaddon/php/ext/soap/tests/bugs/bug41566.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #41566 (SOAP Server not properly generating href attributes)
! 3: --SKIPIF--
! 4: <?php require_once('skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7: function test() {
! 8: $aUser = new User();
! 9: $aUser->sName = 'newUser';
! 10:
! 11: $aUsers = Array();
! 12: $aUsers[] = $aUser;
! 13: $aUsers[] = $aUser;
! 14: $aUsers[] = $aUser;
! 15: $aUsers[] = $aUser;
! 16: return $aUsers;
! 17: }
! 18:
! 19: /* Simple User definition */
! 20: Class User {
! 21: /** @var string */
! 22: public $sName;
! 23: }
! 24:
! 25: $server = new soapserver(null,array('uri'=>"http://testuri.org", 'soap_version'=>SOAP_1_2));
! 26: $server->addfunction("test");
! 27:
! 28: $HTTP_RAW_POST_DATA = <<<EOF
! 29: <?xml version="1.0" encoding="ISO-8859-1"?>
! 30: <SOAP-ENV:Envelope
! 31: SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
! 32: xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
! 33: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
! 34: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
! 35: xmlns:si="http://soapinterop.org/xsd">
! 36: <SOAP-ENV:Body>
! 37: <ns1:test xmlns:ns1="http://testuri.org" />
! 38: </SOAP-ENV:Body>
! 39: </SOAP-ENV:Envelope>
! 40: EOF;
! 41: ob_start();
! 42: $server->handle($HTTP_RAW_POST_DATA);
! 43: echo "ok\n";
! 44:
! 45: $HTTP_RAW_POST_DATA = <<<EOF
! 46: <?xml version="1.0" encoding="UTF-8"?>
! 47: <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
! 48: xmlns:ns1="http://testuri.org"
! 49: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
! 50: xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
! 51: <env:Body>
! 52: <ns1:test env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"/>
! 53: </env:Body>
! 54: </env:Envelope>
! 55: EOF;
! 56: $server->handle($HTTP_RAW_POST_DATA);
! 57: echo "ok\n";
! 58: ob_flush();
! 59: --EXPECT--
! 60: <?xml version="1.0" encoding="UTF-8"?>
! 61: <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>
! 62: ok
! 63: <?xml version="1.0" encoding="UTF-8"?>
! 64: <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>
! 65: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>