0

Heart Internet UK でホストされているサーバーに次のコードを書きました。

// Pull in the NuSOAP code
require_once('./lib/nusoap.php');
// Create the server instance
$debug = 1;
$server = new soap_server;
// Register the method to exposes
$server->register('hello');
// Define the method as a PHP function
function hello($name) {
    return 'sucess ' . $name;
}
// 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);
exit();

その後、これを使用してこれを呼び出そうとすると

 $siteurl   =   get_option('siteurl');
 $siteurl    =   $siteurl.'/wp-content/plugins/soapserverfortest.php';
 @$client     = new nusoap_client($siteurl);
  // Call the SOAP method
 @$result     = $client->call('hello', array('name' => 'cubet'));
 // Display the result
return $result;

結果が得られません。

ハートインターネットに問い合わせたところ、

問題は、soap テストがループバック接続を使用しようとしている可能性があります。これは、ポート 80 を介して同じサーバーとの間で接続しています。

この種の接続は、セキュリティとパフォーマンスの両方の理由から、サーバーでブロックされています

この問題を解決する方法を教えてください。

ありがとう

4

1 に答える 1

0

セルゲイはあなたが変更を試みることを提案しています:

$siteurl   =   get_option('siteurl');
$siteurl    =   $siteurl.'/wp-content/plugins/soapserverfortest.php';

に:

 $siteurl   =   get_option('http://localhost/wp-content/plugins/soapserverfortest.php');

動作する可能性はありますが、ハートインターネットはIPアドレスごとに複数のクライアントを持つ共有ホストであると想定しています。この場合、動作しない可能性があります。試すだけの価値があります。そうでない場合は、別のホストを試すことをお勧めします(または別の解決策を見つける-本当に独自のWebサービスを利用する必要がありますか?)

于 2012-05-25T06:37:16.940 に答える