SOAP - 无法加载外部实体

时间:2015-04-28 16:01:15

标签: php web-services soap wsdl nusoap

我有一个由nusoap自动生成的wsdl文件。服务器端代码是

    require_once('lib/nusoap.php'); //include required class for build nusoap web service server
    require_once('conf.php');
  // Create server object
   $server = new soap_server();
   // configure  WSDL
   $server->configureWSDL('Upload Files');//, $namespace);

   // Register the method to expose
    $server->register('upload_files',                                 // method
        array('files' => 'xsd:string'),                                    // input parameters
        array('return' => 'xsd:string'),                             // output parameters
        '',                                           // namespace
        '',                               // soapaction
        '',                                                      // style
        '',                                                  // use
        'Uploads files to the server'                                // documentation
    );

    // Define the method as a PHP function

    function upload_files($files) {
       //code here
    }

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

WSDL似乎生成正确,位于此处:http://dannyphantom.zg5.ru/server.php?wsdl

当我尝试创建SoapClient时,客户端代码几乎立即失败:

require_once('lib/nusoap.php');


$wsdl="http://dannyphantom.zg5.ru/server.php?wsdl";  // SOAP Server
   try {
        $client=new SoapClient($wsdl, array('trace'=>true, "cache_wsdl" => WSDL_CACHE_NONE));   // Connect the SOAP server
        //code
    } catch(SoapFault $e) {
        //...
    } catch (Exception $e) {
        //...
    }

现在,无论我尝试做什么 - 每当我收到错误时:

  

“SOAP-ERROR:解析WSDL:无法加载   'http://dannyphantom.zg5.ru/server.php?wsdl':无法加载外部   实体“http://dannyphantom.zg5.ru/server.php?wsdl

我觉得我已经搜索过整个Google并尝试过无数次修复 - 没有任何效果。 url_allow_fopen设置为1.我可以手动将链接打开为文件。我试过设置

libxml_disable_entity_loader(false);

在创建新实例之前。加载cURL和openSSL扩展(即使HTTP连接不需要它们)。这些都没有帮助。我完全没有任何想法。非常感谢任何帮助。

PHP版本是5.2。 客户端代码从Drupal 5运行(不要认为有任何区别)

0 个答案:

没有答案