Annotation of embedaddon/php/ext/soap/tests/typemap009.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SOAP typemap 9: SoapServer support for typemap's from_xml() (SoapFault)
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:dotest>
18: <book xsi:type=\"ns1:book\">
19: <a xsi:type=\"xsd:string\">foo</a>
20: <b xsi:type=\"xsd:string\">bar</b>
21: </book>
22: </ns1:dotest>
23: </env:Body>
24: <env:Header/>
25: </env:Envelope>";
26:
27: function book_from_xml($xml) {
28: throw new SoapFault("Server", "Conversion Failed");
29: }
30:
31: class test{
32: function dotest($book){
33: $classname=get_class($book);
34: return "Object: ".$classname. "(".$book->a.",".$book->b.")";
35: }
36: }
37:
38: class book{
39: public $a="a";
40: public $b="c";
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: "from_xml" => "book_from_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/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Conversion Failed</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
58: ok
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>