xref: /PHP-7.4/ext/soap/tests/classmap002.phpt (revision 26dfce7f)
1--TEST--
2SOAP Classmap 2: SoapClient support for classmap
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		return <<<EOF
12<?xml version="1.0" encoding="UTF-8"?>
13<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>
14<ns1:dotest2Response><res xsi:type="ns1:book">
15  <a xsi:type="xsd:string">Blaat</a>
16  <b xsi:type="xsd:string">aap</b>
17</res>
18</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
19EOF;
20	}
21}
22
23class book{
24	public $a="a";
25	public $b="c";
26
27}
28
29$options=Array(
30		'actor' =>'http://schema.nothing.com',
31		'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
32		);
33
34$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
35$ret = $client->dotest2("???");
36var_dump($ret);
37echo "ok\n";
38?>
39--EXPECT--
40object(book)#2 (2) {
41  ["a"]=>
42  string(5) "Blaat"
43  ["b"]=>
44  string(3) "aap"
45}
46ok
47