0

我在托管在英国心脏互联网上的服务器上编写了以下代码。

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

我没有得到结果。

当我们联系 Heart 互联网时,他们说,

问题很可能是soap测试正在尝试使用环回连接——即通过端口80连接到同一台服务器和从同一台服务器连接。

出于安全和性能原因,此类连接在我们的服务器上被阻止

谁能告诉我如何解决这个问题。

谢谢

4

1 回答 1

0

Sergey 建议您尝试更改:

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

至:

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

它可能有效,但我认为 Heart Internet 是一个共享主机,每个 IP 地址有多个客户端——在这种情况下它可能不起作用。值得一试。如果不是,我建议尝试不同的主机(或寻找其他解决方案——您真的需要使用自己的 Web 服务吗?)

于 2012-05-25T06:37:16.940 回答