NuSOAP sur XAMPP avec PHP5: échec de l'ouverture du flux
Question
Hé les gars, j'ai un problème (encore). Cette fois, j'essaie d'utiliser NuSoap w / XAMPP 1.7.1, qui inclut PHP5 et MySQL ... J'ai écrit un soap-client:
<?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);
}
}
?>
et mon serveur de savon:
// 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);
?>
Je sais que PHP fonctionne, Apache fonctionne, MySQL fonctionne ... il fonctionne également ensemble, mais lorsque j'essaie de le faire fonctionner avec NuSOAP, il ne fonctionne pas. Je reçois:
Attention: SoapClient :: SoapClient ( http: //localhost/mysql/helloworld2.php ) [soapclient.soapclient]: échec de courant ouvert: Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle il n'y a pas encore de description disponible richtig reagiert hat, oder die guerre hergestellte verbindung fehlerhaft, da der verbundene Hôte aucun chapeau reagiert. dans C: \ xampp \ htdocs \ mysql \ helloworld2client.php à la ligne 6
Avertissement: SoapClient :: SoapClient () [soapclient.soapclient]: avertissement d'E / S: impossible de charger l'entité externe " http: //localhost/mysql/helloworld2.php dans C: \ xampp \ htdocs \ mysql \ helloworld2client.php à la ligne 6
Erreur fatale: temps d'exécution maximal de 60 secondes dépassées en C: \ xampp \ htdocs \ mysql \ helloworld2client.php à la ligne 41
Je n'ai aucune idée de ce que cela est censé vouloir dire. J'espère que tu peux aider !!! Merci d'avance:)
La solution 2
pour donner une réponse à ma propre question: nusoap a un problème avec php5 ... il y a des réponses et des solutions sur le net (pas beaucoup), mais elles ne fonctionnent pas avec moi. J'ai rétrogradé en php4 et cela fonctionne très bien ...
Autres conseils
J'ai utilisé NuSOAP version 1.7.3 avec PHP5. Dans cette NuSOAP 1.7.3, la classe soapclient est renommée par nu_soapclient.
Vous pouvez essayer ceci:
$client = new nusoap_client('http://localhost/mysql/helloworld2.php');