PHP5を使用したXAMPP上のNuSOAP:ストリームを開くことができませんでした

StackOverflow https://stackoverflow.com/questions/1017450

  •  06-07-2019
  •  | 
  •  

質問

ねえ、私は問題を抱えています(もう一度)。今回は、PHP5とMySQLを含むNuSoap w / XAMPP 1.7.1を使用しようとしています... 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 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が動作し、Apacheが動作し、MySQLが動作することを知っています...それも一緒に動作しますが、NuSOAPで動作させようとすると動作しません。私は次のようになります:

  

警告:   SoapClient :: SoapClient( http://localhost/mysql/helloworld2.php )   [soapclient.soapclient]:失敗しました   オープンストリーム:Ein Verbindungsversuch   ist fehlgeschlagen、da die Gegenstelle   ナチス・アイナー、Zeitspanne nicht   richtig reagiert帽子、オーデルダイ   hergestellte Verbindung戦争   fehlerhaft、da der verbundeneホスト   nicht reagiert帽子。に   C:\ xampp \ htdocs \ mysql \ helloworld2client.php   6行目

     

警告:SoapClient :: SoapClient()   [soapclient.soapclient]:I / O警告:   外部エンティティの読み込みに失敗しました   &quot; http://localhost/mysql/helloworld2.php &quot;   に   C:\ xampp \ htdocs \ mysql \ helloworld2client.php   6行目

     

致命的なエラー:最大実行時間   で60秒を超えました   C:\ xampp \ htdocs \ mysql \ helloworld2client.php   41行目

それが何を意味するのか分かりません。あなたが助けてくれることを願っています!!!事前にThnx:)

役に立ちましたか?

解決 2

私自身の質問への回答:nusoapにはphp5の問題があります...ネット上にはいくつかの回答と解決策があります(多くはありません)が、私とはうまくいきませんでした。 php4にダウングレードしたところ、正常に動作します...

他のヒント

NuSOAPバージョン1.7.3をPHP5で使用しました。このNuSOAP 1.7.3では、nu_soapclientによって名前が変更されたsoapclientクラス。

これを試すことができます:

$client = new nusoap_client('http://localhost/mysql/helloworld2.php');
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top