NuSOAP em XAMPP com PHP5: failed to fluxo aberto
Pergunta
Ei, eu tenho um problema (de novo). Desta vez eu estou tentando usar NuSoap w / XAMPP 1.7.1 que inclui PHP5 e MySQL ... Eu escrevi um sabão-cliente:
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the client instance
$client = new soapclient('http://localhost/mysql/helloworld2.php');
// Check for an error
$err = $client->getError();
if ($err) {
// Display the error
echo '<p><b>Constructor error: ' . $err . '</b></p>';
// At this point, you know the call that follows will fail
}
// Call the SOAP method
$result = $client->call('hello', array('name' => 'Doro'));
// Check for a fault
if ($client->fault) {
echo '<p><b>Fault: ';
print_r($result);
echo '</b></p>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<p><b>Error: ' . $err . '</b></p>';
} else {
// Display the result
print_r($result);
}
}
?>
e meu sabão-servidor:
// Enable debugging *before* creating server instance
$debug = 1;
// Create the server instance
$server = new soap_server;
// Register the method to expose
$server->register('hello');
// Define the method as a PHP function
function hello($name) {
$dbhost = 'blah';
$dbuser = 'blub';
$dbpass = 'booboo';
try{
$conn = MYSQL_CONNECT($dbhost, $dbuser, $dbpass)
or die ('Error connecting to mysql');
if( !$conn ){
return 'Hello, '.$name.' ... too bad, I cannot connect to the db!';
}
else{
$dbname = 'soaperina';
MYSQL_SELECT_DB($dbname) or die('Error connecting to '.dbname);
$queryres = @mysql_db_query(
'response',
'SELECT * FROM farben');
return 'RESPONSE: <br>';
while( $arr = mysql_fetch_array( $queryres ) ){
return $arr["ID"]." - ".$arr["Farben"]." - ".$arr["Rating"]."<br>";
}
}
}
catch(Exception $e){
return 'Sorry, '.$name.', but that did not work at all!';
}
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
Eu sei que o PHP funcionar, o Apache funciona, MySQL funciona ... ele também trabalha em conjunto, mas quando eu tento fazê-lo funcionar com NuSOAP ele não funciona. Eu fico seguinte:
Atenção: SoapClient :: SoapClient ( http: //localhost/mysql/helloworld2.php ) [Soapclient.soapclient]: failed to fluxo aberto: Ein Verbindungsversuch fehlgeschlagen ist, da Gegenstelle die nach einer bestimmten Zeitspanne nicht chapéu reagiert richtig, die oder guerra hergestellte Verbindung fehlerhaft, da der verbundene Anfitrião chapéu reagiert nicht. no C: \ xampp \ htdocs \ mysql \ helloworld2client.php na linha 6
Atenção: SoapClient :: SoapClient () [Soapclient.soapclient]: I / O aviso: não conseguiu carregar a entidade externa " http: //localhost/mysql/helloworld2.php " no C: \ xampp \ htdocs \ mysql \ helloworld2client.php na linha 6
Erro fatal: Tempo máximo de execução de 60 segundos excedidos em C: \ xampp \ htdocs \ mysql \ helloworld2client.php na linha 41
Eu não tenho nenhuma idéia do que é suposto dizer. Espero que vocês todos podem ajudar !!! Thnx antecipadamente:)
Solução 2
para dar uma resposta à minha pergunta: nusoap tem um problema com php5 ... existem algumas respostas e algumas soluções na net (não muitos), mas eles não funcionou comigo. Eu rebaixado para php4 e funciona bem ...
Outras dicas
Eu costumava NuSOAP versão 1.7.3 com PHP5. Neste NuSOAP 1.7.3, classe soapclient renomeado por nu_soapclient.
Você pode tentar o seguinte:
$client = new nusoap_client('http://localhost/mysql/helloworld2.php');