PHP soap问题

PHP soap问题,php,soap,wsdl,Php,Soap,Wsdl,Drupal 7-soap 这是我在错误日志中遇到的错误,当我试图打印 test.wsdl文件 SoapFault: looks like we got no XML document in SoapClient->__call() 我不知道是什么错误 我的项目环境 PHP:5.4.11 MySQL:5.5.27 Apache:2.2.3 操作系统:CentOS 5.8 代码信息 function ai_server() { ini_set('soap.wsdl_cache_ttl

Drupal 7-soap

这是我在错误日志中遇到的错误,当我试图打印 test.wsdl文件

SoapFault: looks like we got no XML document in SoapClient->__call()

我不知道是什么错误

我的项目环境

PHP:5.4.11

MySQL:5.5.27 Apache:2.2.3

操作系统:CentOS 5.8

代码信息

function ai_server() {
  ini_set('soap.wsdl_cache_ttl', 0);
  $server = new SoapServer(file_create_url(variable_get('app_integration_wsdl')), array("trace" => 1, "exceptions" => 0));
  $server->addFunction('getData');
  $server->addFunction('getId');
  $server->addFunction('getInfo');
  $server->addFunction('getrightsInfo');
  $server->addFunction('updateInfo');
  $server->addFunction('resetAppHistory');
  //$server->addFunction('resetAppId');

  $server->handle();
}
soap客户端

function ai_sync_test() {
  ini_set('soap.wsdl_cache_ttl', 0);
//
// ---------------------------------------------------------------- basic tests
//

  // is settings file accessible
  $settings_file = variable_get('app_integration_settings');
  require_once($settings_file);
  $settings_output = is_readable($settings_file) ? 'Ok! Settings file is readable.' : 'Error! Not readable or accessible.';

  // is wsdl file accessible
  $wsdl_file = variable_get('app_integration_wsdl');
  $wsdl_output = is_readable($wsdl_file) ? 'Ok! WSDL file is readable. ' . l('Open it. ', $wsdl_file, array('attributes' => array('target' => '_blank'))) : 'Error! Not readable or accessible. ';
  $wsdl_output .= 'You need to define domain name in it into this sections (at the bottom of app_integration.wsdl file): ';
  $wsdl_output .= htmlentities('<soap:address location="http://YOUR_DOMAIN_HERE/app_integration/server"/>');

  // methods, which integration service is provide
  $client = new SoapClient($wsdl_file, array("trace" => 1, "exceptions" => 0));

  $methods = $client->__getFunctions();
  $methods_output = '';
  foreach ($methods as $method) {
    $methods_output .= '<li>' . $method . '</li>';
  }
功能ai_同步_测试(){
ini\u集('soap.wsdl\u缓存\u ttl',0);
//
//--------------------------------------------------------------基本测试
//
//设置文件是否可访问
$settings\u file=variable\u get('app\u integration\u settings');
需要一次(设置文件);
$settings\u output=is\u readable($settings\u file)“‘确定!设置文件可读’:‘错误!不可读或不可访问’;
//wsdl文件是否可访问
$wsdl_file=variable_get('app_integration_wsdl');
$wsdl_output=is_readable($wsdl_file)“‘好的!wsdl文件是可读的’。.l('Open it'),$wsdl_file,array('attributes'=>array('target'=>“\u blank')):‘错误!不可读或不可访问’;
$wsdl_output.='您需要将其中的域名定义到此部分(在app_integration.wsdl文件的底部):';
$wsdl_output.=htmlentities(“”);
//方法,该集成服务是提供的
$client=newsoapclient($wsdl_文件,数组(“跟踪”=>1,“异常”=>0));
$methods=$client->_getFunctions();
$methods_output='';
foreach($methods作为$method){
$methods_output.='
  • '.$method.
  • '; }
    2个可能的原因-

  • 您正在回显代码中的某些内容,或者正在打印空白字符或尾随新行字符

  • php中的服务器SOAP文件使用BOM编码utf8,导致apache在xml响应之前发回BOM标记(3个字节)。使用utf8编码php文件SOAP服务器,而不使用OUT BOM标记

  • 功能条\u bom($str){
    返回preg_replace('/^(\x00\x00\xFE\xFF | \xFF\xFE\x00\x00 | \xFE\xFF | \xFF\xFE | \xEF\xBB\xBF)/',“”,$str);
    }
    
    请提供更多详细信息。您运行的代码least@DenisAlimov在这里,您可以尝试在trace选项设置为TRUE的情况下调用客户端,并通过uuu getLastRequest()和uu getLastResponse()方法检查实际发送/接收的XML。@bxN5是它的emptyit的SOAP服务器。您可以在某处调用SoapClient。提供该代码