Annotation of embedaddon/php/ext/soap/tests/server009.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SOAP Server 9: setclass and setpersistence(SOAP_PERSISTENCE_SESSION)
                      3: --SKIPIF--
                      4: <?php
                      5:        require_once('skipif.inc');
                      6:        if (!extension_loaded('session')) {
                      7:                die('skip this test needs session extension');
                      8:        }
                      9: ?>
                     10: --INI--
                     11: session.auto_start=1
                     12: session.save_handler=files
                     13: --FILE--
                     14: <?php
                     15: class foo {
                     16:   private $sum = 0;
                     17: 
                     18:   function Sum($num) {
                     19:     return $this->sum += $num;
                     20:   }
                     21: }
                     22: 
                     23: $server = new soapserver(null,array('uri'=>"http://testuri.org"));
                     24: $server->setclass("foo");
                     25: $server->setpersistence(SOAP_PERSISTENCE_SESSION);
                     26: 
                     27: ob_start();
                     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:Sum xmlns:ns1="http://testuri.org">
                     38:       <num xsi:type="xsd:int">5</num>
                     39:     </ns1:Sum>
                     40:   </SOAP-ENV:Body>
                     41: </SOAP-ENV:Envelope>
                     42: EOF;
                     43: $server->handle($HTTP_RAW_POST_DATA);
                     44: ob_clean();
                     45: 
                     46: $HTTP_RAW_POST_DATA = <<<EOF
                     47: <?xml version="1.0" encoding="ISO-8859-1"?>
                     48: <SOAP-ENV:Envelope
                     49:   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                     50:   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                     51:   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     52:   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     53:   xmlns:si="http://soapinterop.org/xsd">
                     54:   <SOAP-ENV:Body>
                     55:     <ns1:Sum xmlns:ns1="http://testuri.org">
                     56:       <num xsi:type="xsd:int">3</num>
                     57:     </ns1:Sum>
                     58:   </SOAP-ENV:Body>
                     59: </SOAP-ENV:Envelope>
                     60: EOF;
                     61: $server->handle($HTTP_RAW_POST_DATA);
                     62: ob_end_flush();
                     63: 
                     64: echo "ok\n";
                     65: ?>
                     66: --EXPECT--
                     67: <?xml version="1.0" encoding="UTF-8"?>
                     68: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" 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:SumResponse><return xsi:type="xsd:int">8</return></ns1:SumResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     69: ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>