PHP5的XAMPP上的NuSOAP:无法打开流
嘿,伙计们,我(又)有个问题。这次我尝试使用NUSOAPW/XAMPP1.7.1,其中包括PHP5和MySQL。。。我编写了一个soap客户端:PHP5的XAMPP上的NuSOAP:无法打开流,xampp,nusoap,php4,php,Xampp,Nusoap,Php4,Php,嘿,伙计们,我(又)有个问题。这次我尝试使用NUSOAPW/XAMPP1.7.1,其中包括PHP5和MySQL。。。我编写了一个soap客户端: <?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
<?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);
}
}
?>
和我的soap服务器:
// 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);
?>
//在*创建服务器实例之前启用调试*
$debug=1;
//创建服务器实例
$server=新的soap\u服务器;
//注册要公开的方法
$server->register('hello');
//将该方法定义为PHP函数
函数hello($name){
$dbhost='blah';
$dbuser='blub';
$dbpass='booboo';
试一试{
$conn=MYSQL\u CONNECT($dbhost、$dbuser、$dbpass)
或者死(“连接mysql时出错”);
如果(!$conn){
返回“Hello.”.$name.“……太糟糕了,我无法连接到数据库!”;
}
否则{
$dbname='soaperina';
MYSQL\u SELECT\u DB($dbname)或die('Error connecting to'.dbname');
$queryres=@mysql\u db\u query(
"回应",,
“从farben中选择*”;
返回“响应:
”;
而($arr=mysql\u fetch\u数组($queryres)){
返回$arr[“ID”]。“-”$arr[“Farben”]。“-”$arr[“Rating”]。“
”;
}
}
}
捕获(例外$e){
返回“对不起,.$name.”,但这根本不起作用;
}
}
//使用请求(尝试)调用服务
$HTTP\u RAW\u POST\u DATA=isset($HTTP\u RAW\u POST\u DATA)$HTTP_原始_POST_数据:“”;
$server->service($HTTP\u RAW\u POST\u数据);
?>
我知道PHP工作,Apache工作,MySQL工作。。。它也可以一起工作,但当我试图让它与NuSOAP一起工作时,它不起作用。我得到以下信息:
警告:
SoapClient::SoapClient()
[soapclient.soapclient]:未能
开放流:Ein Verbindungsversuch
我是费格施拉根,我是格根斯泰尔
这是最好的选择
richtig reagiert帽子,为了死
韦宾登战争
费勒哈夫特,维伯恩主机数据
尼希特·雷吉尔特帽子。在里面
C:\xampp\htdocs\mysql\helloworld2client.php
第6行
警告:SoapClient::SoapClient()
[soapclient.soapclient]:I/O警告:
无法加载外部实体
""
在里面
C:\xampp\htdocs\mysql\helloworld2client.php
第6行
致命错误:的最大执行时间
超过60秒
C:\xampp\htdocs\mysql\helloworld2client.php
第41行
我不知道那是什么意思。我希望你能帮忙!!!Thnx提前:)回答我自己的问题:nusoap的php5有问题。。。网上有一些答案和一些解决方案(不多),但它们对我不起作用。我降级到php4,效果很好 我使用了NuSOAP版本1.7.3和PHP5。在本NUSOAP1.7.3中,soapclient类被nu_soapclient重命名 您可以尝试以下方法:
$client = new nusoap_client('http://localhost/mysql/helloworld2.php');