Annotation of embedaddon/php/ext/soap/tests/typemap006.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SOAP typemap 6: SoapServer support for typemap's to_xml() (without WSDL, using SoapVar)
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --INI--
6: soap.wsdl_cache_enabled=0
7: --FILE--
8: <?php
9: $GLOBALS['HTTP_RAW_POST_DATA']="
10: <env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
11: xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
12: xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
13: xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
14: xmlns:ns1=\"http://schemas.nothing.com\"
15: >
16: <env:Body>
17: <ns1:dotest2>
18: <dotest2 xsi:type=\"xsd:string\">???</dotest2>
19: </ns1:dotest2>
20: </env:Body>
21: <env:Header/>
22: </env:Envelope>";
23:
24: function book_to_xml($book) {
25: return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
26: }
27:
28: class test{
29: function dotest2($str){
30: $book = new book;
31: $book->a = "foo";
32: $book->b = "bar";
33: return new SoapVar($book, null, "book", "http://schemas.nothing.com");
34: }
35: }
36:
37: class book{
38: public $a="a";
39: public $b="c";
40:
41: }
42:
43: $options=Array(
44: 'uri' => "http://schemas.nothing.com",
45: 'actor' => 'http://schemas.nothing.com',
46: 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
47: "type_name" => "book",
48: "to_xml" => "book_to_xml"))
49: );
50:
51: $server = new SoapServer(NULL,$options);
52: $server->setClass("test");
53: $server->handle($HTTP_RAW_POST_DATA);
54: echo "ok\n";
55: ?>
56: --EXPECT--
57: <?xml version="1.0" encoding="UTF-8"?>
58: <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:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:dotest2Response><book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:book"><a xsi:type="xsd:string">foo!</a><b xsi:type="xsd:string">bar!</b></book></ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
59: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>