Mam tak:
1. plik klasy:
<?php
class Test{
function test()
{
$test = $this->test2();
if($test)
{
return $test;
}
else
{
return array("1"=>"jeden", "2"=>"dwa", "3"=>"trzy"); }
}
function test2()
{
mysql_connect($dbhost, $dbuser, $dbpass) or
die('Nie moge połaczyc sie z Mysql'); $s = 'SET NAMES utf8';
$query = "SELECT * FROM users";
{
$array[] = $wynik;
}
return $array;
}
}
?>
2. plik serwera:
<?php
ini_set("soap.wsdl_cache_enabled", 0
);
require("class.php");
$server = new SoapServer
(null, array('uri' => "urn://localhost/soap/")); $server->setClass("Test");
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
$server->handle();
?>
3. plik klienta
<?php
$client = new SoapClient
(null, array( 'location' => "http://localhost/soap/server.php",
'uri' => "urn://localhost/soap",
'trace' => 1));
$return2 = $client->test();
echo "Response:\n" . $client->__getLastResponse
() . "\n"; ?>
jak wyrzuce $test = $this->test2(); i ustawie $test na sztywno - działa.
Jak zostawię, to mam pusty ekran.
Co więcej na serwerze xampp pod Windows działa.
A potrzebuje na linux.
Php w wersji 5.3.2.