Annotation of embedaddon/php/ext/soap/tests/typemap013.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SOAP typemap 13: SoapServer support for typemap's to_xml() with default ns
! 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="http://schemas.nothing.com" 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 $book;
! 34: }
! 35: }
! 36:
! 37: class book{
! 38: public $a="a";
! 39: public $b="c";
! 40:
! 41: }
! 42:
! 43: $options=Array(
! 44: 'actor' =>'http://schemas.nothing.com',
! 45: 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
! 46: "type_name" => "book",
! 47: "to_xml" => "book_to_xml"))
! 48: );
! 49:
! 50: $server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
! 51: $server->setClass("test");
! 52: $server->handle($HTTP_RAW_POST_DATA);
! 53: echo "ok\n";
! 54: ?>
! 55: --EXPECT--
! 56: <?xml version="1.0" encoding="UTF-8"?>
! 57: <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="http://schemas.nothing.com" 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>
! 58: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>