xref: /PHP-7.0/ext/soap/tests/typemap012.phpt (revision 610c7fbe)
1--TEST--
2SOAP Typemap 12: SoapClient support for typemap's to_xml() (SoapFault)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--INI--
6soap.wsdl_cache_enabled=0
7--FILE--
8<?php
9class TestSoapClient extends SoapClient{
10  function __doRequest($request, $location, $action, $version, $one_way = 0) {
11  		echo $request;
12  		exit;
13	}
14}
15
16class book{
17	public $a="a";
18	public $b="c";
19
20}
21
22function book_to_xml($book) {
23	throw new SoapFault("Client", "Conversion Error");
24}
25
26$options=Array(
27		'actor' =>'http://schemas.nothing.com',
28		'typemap' => array(array("type_ns"   => "http://schemas.nothing.com",
29		                         "type_name" => "book",
30		                         "to_xml"  => "book_to_xml"))
31		);
32
33$client = new TestSoapClient(dirname(__FILE__)."/classmap.wsdl",$options);
34$book = new book();
35$book->a = "foo";
36$book->b = "bar";
37try {
38	$ret = $client->dotest($book);
39} catch (SoapFault $e) {
40	$ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring;
41}
42var_dump($ret);
43echo "ok\n";
44?>
45--EXPECT--
46string(37) "SoapFault = Client - Conversion Error"
47ok
48