Annotation of embedaddon/php/ext/soap/tests/typemap003.phpt, revision 1.1.1.1
1.1 misho 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: }
22: }
23:
24: class book{
25: public $a="a";
26: public $b="c";
27:
28: }
29:
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;
36: }
37:
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: );
44:
45: $client = new TestSoapClient(dirname(__FILE__)."/classmap.wsdl",$options);
46: $ret = $client->dotest2("???");
47: var_dump($ret);
48: echo "ok\n";
49: ?>
50: --EXPECTF--
51: object(book)#%d (2) {
52: ["a"]=>
53: string(3) "foo"
54: ["b"]=>
55: string(3) "bar"
56: }
57: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>