NuSOAP على XAMPP مع PHP5: فشل في فتح الدفق
سؤال
ويا شباب، لدي مشكلة (مرة أخرى). هذه المرة أنا تحاول استخدام NuSoap ث / XAMPP 1.7.1 والذي يتضمن PHP5 وماي ... كتبت الصابون العميل:
<?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);
}
}
?>
ووبلدي الصابون الخادم:
// 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);
?>
وأنا أعلم أن يعمل PHP، وأباتشي يعمل، الخلية يعمل ... كما أنها تعمل معا، ولكن عندما أحاول جعلها تعمل مع NuSOAP أنها لا تعمل. أحصل على التالي:
<اقتباس فقرة>تحذير: SoapClient :: SoapClient ( HTTP: //localhost/mysql/helloworld2.php ) [soapclient.soapclient]: فشل ل تيار مفتوح: عين Verbindungsversuch المحكمة الخاصة العراقية fehlgeschlagen، دا يموت Gegenstelle ناتش einer bestimmten Zeitspanne NICHT richtig قبعة reagiert، يموت أودر الحرب hergestellte Verbindung fehlerhaft، دا دير verbundene المضيف NICHT قبعة reagiert. في C: \ XAMPP \ htdocs \ ك \ helloworld2client.php على خط 6
تحذير: SoapClient :: SoapClient () [soapclient.soapclient]: I / O تحذير: فشل تحميل كيان خارجي " HTTP: //localhost/mysql/helloworld2.php " في C: \ XAMPP \ htdocs \ ك \ helloworld2client.php على خط 6
خطأ فادح: وقت التنفيذ الحد الأقصى ل 60 ثانية تجاوزت في C: \ XAMPP \ htdocs \ ك \ helloworld2client.php على خط 41
اقتباس فقرة>وليس لدي أي فكرة عما يفترض أن يعني. آمل ya'll يمكن أن تساعد !!! thnx ج مقدما:)
المحلول 2
لإعطاء إجابة على سؤالي الخاص: nusoap لديه مشكلة مع PHP5 ... هناك بعض الإجابات وبعض الحلول على شبكة الانترنت (ليست كثيرة)، ولكنها لم تنجح معي. I خفضت إلى PHP4 وأنه يعمل بشكل جيد ...
نصائح أخرى
واعتدت NuSOAP النسخة 1.7.3 مع PHP5. في هذا NuSOAP 1.7.3، والطبقة soapclient تسمية كتبها nu_soapclient.
ويمكنك أن تجرب هذا:
$client = new nusoap_client('http://localhost/mysql/helloworld2.php');