Frage

Hey Leute, habe ich ein Problem (wieder). Diesmal versuche ich nusoap zu verwenden w / XAMPP 1.7.1, die PHP5 und MySQL gehören ... Ich habe eine seifen Client schrieb:

<?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);
    }
}

?>

und mein Seife-Server:     

   // 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);
?>

Ich weiß, dass PHP funktioniert, die Apache funktioniert, MySQL arbeitet ... es funktioniert auch zusammen, aber wenn ich versuche, es mit NuSOAP funktioniert es nicht funktioniert. Ich erhalte folgende:

  

Warning:   Soapclient :: Soapclient ( http: //localhost/mysql/helloworld2.php )   [Soapclient.soapclient]: failed zu   offener Stream: Ein Verbindungsversuch   ist fehlgeschlagen, da sterben GEGENSTELLE   nach Einer bestimmten Zeitspanne nicht   richtig reagiert hat, oder sterben   Krieg hergestellte verbindung   fehlerhaft, da die Host-Verbundene   nicht reagiert hat. im   C: \ xampp \ htdocs \ mysql \ helloworld2client.php   on line 6

     

Achtung: Soapclient :: Soapclient ()   [Soapclient.soapclient]: I / O-Warnung:   fehlgeschlagen externe Einheit laden   " http: //localhost/mysql/helloworld2.php "   im   C: \ xampp \ htdocs \ mysql \ helloworld2client.php   on line 6

     

Fatal error: Maximale Ausführungszeit   60 Sekunden überschritten wird in   C: \ xampp \ htdocs \ mysql \ helloworld2client.php   auf der Leitung 41

Ich habe keine Ahnung, was das bedeuten soll. Ich hoffe, YA'LL helfen kann !!! Thnx im Voraus:)

War es hilfreich?

Lösung 2

eine Antwort auf meine eigene Frage zu geben: nusoap ein Problem mit php5 hat ... es gibt einige Antworten und einige Lösungen auf dem Netz (nicht viele), aber sie haben nicht mit mir arbeiten. Ich herabgestuft zu PHP4 und es funktioniert gut ...

Andere Tipps

Ich benutzte NuSOAP Version 1.7.3 mit PHP5. In diesem NuSOAP 1.7.3 umbenannt Soapclient Klasse von nu_soapclient.

Sie können versuchen, diese:

$client = new nusoap_client('http://localhost/mysql/helloworld2.php');
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top