xref: /PHP-5.5/ext/soap/tests/bugs/bug31695.phpt (revision 1d5c8006)
1--TEST--
2Bug #31695 (Cannot redefine endpoint when using WSDL)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7ini_set("soap.wsdl_cache_enabled", 0);
8
9function Test($x) {
10	return $x;
11}
12
13class LocalSoapClient extends SoapClient {
14  function __construct($wsdl, $options=array()) {
15    parent::__construct($wsdl, $options);
16    $this->server = new SoapServer($wsdl, $options);
17		$this->server->addFunction("Test");
18  }
19
20  function __doRequest($request, $location, $action, $version, $one_way = 0) {
21  	echo "$location\n";
22    ob_start();
23    $this->server->handle($request);
24    $response = ob_get_contents();
25    ob_end_clean();
26    return $response;
27  }
28}
29
30$client = new LocalSoapClient(dirname(__FILE__)."/bug31695.wsdl");
31$client->Test("str");
32$client = new LocalSoapClient(dirname(__FILE__)."/bug31695.wsdl", array("location"=>"test://1"));
33$client->Test("str");
34$client->__soapCall("Test",
35                    array("arg1"),
36                     array("location"=>"test://2"));
37$old = $client->__setLocation("test://3");
38echo "$old\n";
39$client->Test("str");
40$client->Test("str");
41$client->__setLocation($old);
42$client->Test("str");
43$old = $client->__setLocation();
44$client->Test("str");
45$client->__setLocation($old);
46$client->Test("str");
47$client->__setLocation(null);
48$client->Test("str");
49var_dump($client->__setLocation());
50?>
51--EXPECT--
52test://0
53test://1
54test://2
55test://1
56test://3
57test://3
58test://1
59test://0
60test://1
61test://0
62NULL
63