xref: /php-src/ext/soap/tests/classmap005.phpt (revision e1b59e9e)
1--TEST--
2SOAP Classmap 5: SoapClient support for classmap with namespace
3--EXTENSIONS--
4soap
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): string {
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 bookNs {
24    public $a="a";
25    public $b="c";
26}
27
28class book {
29    public $a="a";
30    public $b="c";
31}
32
33$options=Array(
34        'actor' =>'http://schema.nothing.com',
35        'classmap' => array('book'=>'book', '{http://schemas.nothing.com}book'=>'bookNs')
36        );
37
38$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
39$ret = $client->dotest2("???");
40var_dump($ret);
41echo "ok\n";
42?>
43--EXPECTF--
44object(bookNs)#%d (%d) {
45  ["a"]=>
46  string(5) "Blaat"
47  ["b"]=>
48  string(3) "aap"
49}
50ok
51