Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / soap / tests / typemap003.phpt
blob63bb76cbcf33c5eff712cad74bc73b1524d3a5bd
1 --TEST--
2 SOAP Typemap 3: SoapClient support for typemap's from_xml()
3 --SKIPIF--
4 <?php require_once('skipif.inc'); ?>
5 <?php if (!extension_loaded('simplexml')) die("skip simplexml extension not available"); ?>
6 --INI--
7 soap.wsdl_cache_enabled=0
8 --FILE--
9 <?php
10 class TestSoapClient extends SoapClient{
11   function __doRequest($request, $location, $action, $version, $one_way = 0) {
12                 return <<<EOF
13 <?xml version="1.0" encoding="UTF-8"?>
14 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" 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>
15 <ns1:dotest2Response><res xsi:type="ns1:book">
16   <a xsi:type="xsd:string">foo</a>
17   <b xsi:type="xsd:string">bar</b>
18 </res>
19 </ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
20 EOF;
21         }       
24 class book{
25         public $a="a";
26         public $b="c";
27                 
30 function book_from_xml($xml) {
31         $sxe = simplexml_load_string($xml);
32         $obj = new book;
33         $obj->a = (string)$sxe->a;
34         $obj->b = (string)$sxe->b;
35         return $obj;
38 $options=Array(
39                 'actor' =>'http://schemas.nothing.com',
40                 'typemap' => array(array("type_ns"   => "http://schemas.nothing.com",
41                                          "type_name" => "book",
42                                          "from_xml"  => "book_from_xml"))
43                 );
45 $client = new TestSoapClient(dirname(__FILE__)."/classmap.wsdl",$options);
46 $ret = $client->dotest2("???");
47 var_dump($ret);
48 echo "ok\n";
50 --EXPECTF--
51 object(book)#%d (2) {
52   ["a"]=>
53   string(3) "foo"
54   ["b"]=>
55   string(3) "bar"