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

1.1       misho       1: --TEST--
                      2: SOAP Server 21: SoapServer::setClass and __call()
                      3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: class Foo {
                      8:   function __call($name, $args) {
                      9:     if ($name == "test") {
                     10:       return "Hello World";
                     11:     } else {
                     12:       return new SoapFault("Server","Function $name doesn't exist");
                     13:     }
                     14:   }
                     15: }
                     16: 
                     17: $server = new soapserver(null,array('uri'=>"http://testuri.org"));
                     18: $server->setclass("Foo");
                     19: 
                     20: $HTTP_RAW_POST_DATA = <<<EOF
                     21: <?xml version="1.0" encoding="ISO-8859-1"?>
                     22: <SOAP-ENV:Envelope
                     23:   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                     24:   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                     25:   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                     26:   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     27:   xmlns:si="http://soapinterop.org/xsd">
                     28:   <SOAP-ENV:Body>
                     29:     <ns1:test xmlns:ns1="http://testuri.org" />
                     30:   </SOAP-ENV:Body>
                     31: </SOAP-ENV:Envelope>
                     32: EOF;
                     33: 
                     34: $server->handle($HTTP_RAW_POST_DATA);
                     35: echo "ok\n";
                     36: ?>
                     37: --EXPECT--
                     38: <?xml version="1.0" encoding="UTF-8"?>
                     39: <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:testResponse><return xsi:type="xsd:string">Hello World</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
                     40: ok

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