PHP NuSOAP错误(没有网站描述?) [英] PHP NuSOAP error (no web description?)

查看:83
本文介绍了PHP NuSOAP错误(没有网站描述?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种简单的方法来开始使用PHP的Web服务,并发现此处的一篇文章代码项目赞扬NuSOAP的优点.从Sourceforge获取最新版本后,我开始获取代码项目文章和这篇更全面的文章中描述的基本helloWorld服务工作.

普通的PHP脚本在我的环境中可以正常工作,但是我的客户端和服务器脚本都给出了一个隐秘的错误:

HTTP Error 500.0 - Internal Server Error
C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exited unexpectedly



我开始做的第一件事是从下至上注释掉我的client.php页面的各行,最终将问题隔离到此行:

$client = new soapclient(''http://localhost:81/site/helloWorld.php'');



在浏览器中转到"http://localhost:81/site/helloWorld.php"会给我同样的500错误,而不是404错误,因此我知道路径/虚拟目录没有问题.

因此,我进行了更多在线搜索,发现一些人通过从命令行运行PHP脚本并注意到DLL引用无效来调试FastCGI错误.

所以,首先我尝试了我的服务:

C:\Program Files (x86)\PHP>php-cgi.exe D:\webdir\helloWorld.php
X-Powered-By: PHP/5.2.14
Content-Type: text/html; charset=ISO-8859-1

This service does not provide a Web Description



以同样的方式运行我的客户端脚本只会导致php-cgi.exe在典型的Windows中崩溃,"...已停止工作"警报方式.但是至少该服务给了我一些错误信息!

下一步自然是返回了NuSOAP文档的许多结果...

具体来说,是
class.soap_server.php . 304行是:

print "This service does not provide a Web description";



但是我为什么要得到这个?!

前面链接的两篇(可疑相似的文章)都非常明确,也没有浪费任何文字来解释服务器的任何特殊托管要求.从最好的角度来看,我可以解析class.soap_server.php的那部分,对我来说,它就像检查请求方法(GET/POST),确定它是GET,然后尝试确定调用者是什么.想要和失败.

当我直接从浏览器或命令行调用脚本时,哪种方式有意义,但是为什么客户端构造函数会出现问题?!

我读错代码了吗?还是在调用构造函数时,此错误只是一个红色的鲱鱼,掩盖了另一个问题?

对于懒惰者,这是class.soap_server.php中的整个函数,它正在生成我看到的唯一错误(在底部):

function service($data){
 237          global $HTTP_SERVER_VARS;
 238  
 239          if (isset($_SERVER[''REQUEST_METHOD''])) {
 240              $rm = $_SERVER[''REQUEST_METHOD''];
 241          } elseif (isset($HTTP_SERVER_VARS[''REQUEST_METHOD''])) {
 242              $rm = $HTTP_SERVER_VARS[''REQUEST_METHOD''];
 243          } else {
 244              $rm = '''';
 245          }
 246  
 247          if (isset($_SERVER[''QUERY_STRING''])) {
 248              $qs = $_SERVER[''QUERY_STRING''];
 249          } elseif (isset($HTTP_SERVER_VARS[''QUERY_STRING''])) {
 250              $qs = $HTTP_SERVER_VARS[''QUERY_STRING''];
 251          } else {
 252              $qs = '''';
 253          }
 254          $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
 255  
 256          if ($rm == ''POST'') {
 257              $this->debug("In service, invoke the request");
 258              $this->parse_request($data);
 259              if (! $this->fault) {
 260                  $this->invoke_method();
 261              }
 262              if (! $this->fault) {
 263                  $this->serialize_return();
 264              }
 265              $this->send_response();
 266          } elseif (preg_match(''/wsdl/'', $qs) ){
 267              $this->debug("In service, this is a request for WSDL");
 268              if ($this->externalWSDLURL){
 269                if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
 270                  $this->debug("In service, re-direct for WSDL");
 271                  header(''Location: ''.$this->externalWSDLURL);
 272                } else { // assume file
 273                  $this->debug("In service, use file passthru for WSDL");
 274                  header("Content-Type: text/xml\r\n");
 275                  $pos = strpos($this->externalWSDLURL, "file://");
 276                  if ($pos === false) {
 277                      $filename = $this->externalWSDLURL;
 278                  } else {
 279                      $filename = substr($this->externalWSDLURL, $pos + 7);
 280                  }
 281                  $fp = fopen($this->externalWSDLURL, ''r'');
 282                  fpassthru($fp);
 283                }
 284              } elseif ($this->wsdl) {
 285                  $this->debug("In service, serialize WSDL");
 286                  header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
 287                  print $this->wsdl->serialize($this->debug_flag);
 288                  if ($this->debug_flag) {
 289                      $this->debug(''wsdl:'');
 290                      $this->appendDebug($this->varDump($this->wsdl));
 291                      print $this->getDebugAsXMLComment();
 292                  }
 293              } else {
 294                  $this->debug("In service, there is no WSDL");
 295                  header("Content-Type: text/html; charset=ISO-8859-1\r\n");
 296                  print "This service does not provide WSDL";
 297              }
 298          } elseif ($this->wsdl) {
 299              $this->debug("In service, return Web description");
 300              print $this->wsdl->webDescription();
 301          } else {
 302              $this->debug("In service, no Web description");
 303              header("Content-Type: text/html; charset=ISO-8859-1\r\n");
 304              print "This service does not provide a Web description";
 305          }
 306      }



至于我的代码,它与我之前链接的第二篇教程文章中所描述的完全相同. >
帮助! :confused:

解决方案

client = new soapclient(''http://localhost:81/site/helloWorld.php'');



在浏览器中转到"http://localhost:81/site/helloWorld.php"会给我同样的500错误,而不是404错误,因此我知道路径/虚拟目录没有问题.

因此,我进行了更多在线搜索,发现一些人通过从命令行运行PHP脚本并注意到DLL引用无效来调试FastCGI错误.

所以,首先我尝试了我的服务:

C:\Program Files (x86)\PHP>php-cgi.exe D:\webdir\helloWorld.php
X-Powered-By: PHP/5.2.14
Content-Type: text/html; charset=ISO-8859-1

This service does not provide a Web Description



以同样的方式运行我的客户端脚本只会导致php-cgi.exe在典型的Windows中崩溃,"...已停止工作"警报方式.但是至少该服务给了我一些错误信息!

下一步自然是返回了NuSOAP文档的许多结果...

具体来说,是
class.soap_server.php . 304行是:

print "This service does not provide a Web description";



但是我为什么要得到这个?!

前面链接的两篇(可疑相似的文章)都非常明确,也没有浪费任何文字来解释服务器的任何特殊托管要求.从最好的角度来看,我可以解析class.soap_server.php的那部分,对我来说,它就像检查请求方法(GET/POST),确定它是GET,然后尝试确定调用者是什么.想要和失败.

当我直接从浏览器或命令行调用脚本时,哪种方式有意义,但是为什么客户端构造函数会出现问题?!

我读错代码了吗?还是在调用构造函数时,此错误只是一个红色的鲱鱼,掩盖了另一个问题?

对于懒惰者,这是class.soap_server.php中的整个函数,它正在生成我看到的唯一错误(在底部):

功能服务(


数据){ 237全局


HTTP_SERVER_VARS; 238 第239回

I was looking around for an easy way to get started with web services in PHP, and found an article here on Code Project extolling the virtues of NuSOAP. After grabbing the latest version from Sourceforge I set to getting the basic helloWorld service described in both that Code Project article and this, more comprehensive article working.

A normal PHP script works fine in my environment, but both my client and server scripts are giving a cryptic error:

HTTP Error 500.0 - Internal Server Error
C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exited unexpectedly



The first thing I started doing was commenting out lines of my client.php page from the bottom up, eventually isolating the problem to this line:

$client = new soapclient(''http://localhost:81/site/helloWorld.php'');



Going to "http://localhost:81/site/helloWorld.php" in my browser gives me the same 500 error, not a 404, so I know there''s no problem with path/virtual directory.

So I did some more searching online and found that some people have debugged FastCGI errors by running the PHP script from the command-line and noticing an invalid DLL reference.

So, first I tried my service:

C:\Program Files (x86)\PHP>php-cgi.exe D:\webdir\helloWorld.php
X-Powered-By: PHP/5.2.14
Content-Type: text/html; charset=ISO-8859-1

This service does not provide a Web Description



Running my client script the same way just causes php-cgi.exe to crash in typical Windows "... has stopped working" alert fashion. But at least the service gave me some sort of an error message!

Next natural step was to search for "This service does not provide a Web Description" which returned a number of results of the NuSOAP documentation...

Specifically, class.soap_server.php. And there on line 304 is:

print "This service does not provide a Web description";



But why am I getting this?!

Both of the (suspiciously similar, ahem) articles linked earlier are pretty clear-cut and don''t waste words explaining any special hosting requirements for the server. From the best I can parse that part of class.soap_server.php, it looks to me like it''s checking the Request Method (GET/POST), determining that it''s GET, and then trying to identify what the caller wanted and failing.

Which kind of makes sense when I call the script directly either from the browser or command-line, but why would there be a problem with the client constructor?!

Am I reading the code wrong, or is this error just a red herring masking a different problem when I call the constructor?

For the lazy, here''s the entire function from class.soap_server.php which is generating the only error I''m seeing (right at the bottom):

function service($data){
 237          global $HTTP_SERVER_VARS;
 238  
 239          if (isset($_SERVER[''REQUEST_METHOD''])) {
 240              $rm = $_SERVER[''REQUEST_METHOD''];
 241          } elseif (isset($HTTP_SERVER_VARS[''REQUEST_METHOD''])) {
 242              $rm = $HTTP_SERVER_VARS[''REQUEST_METHOD''];
 243          } else {
 244              $rm = '''';
 245          }
 246  
 247          if (isset($_SERVER[''QUERY_STRING''])) {
 248              $qs = $_SERVER[''QUERY_STRING''];
 249          } elseif (isset($HTTP_SERVER_VARS[''QUERY_STRING''])) {
 250              $qs = $HTTP_SERVER_VARS[''QUERY_STRING''];
 251          } else {
 252              $qs = '''';
 253          }
 254          $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
 255  
 256          if ($rm == ''POST'') {
 257              $this->debug("In service, invoke the request");
 258              $this->parse_request($data);
 259              if (! $this->fault) {
 260                  $this->invoke_method();
 261              }
 262              if (! $this->fault) {
 263                  $this->serialize_return();
 264              }
 265              $this->send_response();
 266          } elseif (preg_match(''/wsdl/'', $qs) ){
 267              $this->debug("In service, this is a request for WSDL");
 268              if ($this->externalWSDLURL){
 269                if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
 270                  $this->debug("In service, re-direct for WSDL");
 271                  header(''Location: ''.$this->externalWSDLURL);
 272                } else { // assume file
 273                  $this->debug("In service, use file passthru for WSDL");
 274                  header("Content-Type: text/xml\r\n");
 275                  $pos = strpos($this->externalWSDLURL, "file://");
 276                  if ($pos === false) {
 277                      $filename = $this->externalWSDLURL;
 278                  } else {
 279                      $filename = substr($this->externalWSDLURL, $pos + 7);
 280                  }
 281                  $fp = fopen($this->externalWSDLURL, ''r'');
 282                  fpassthru($fp);
 283                }
 284              } elseif ($this->wsdl) {
 285                  $this->debug("In service, serialize WSDL");
 286                  header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
 287                  print $this->wsdl->serialize($this->debug_flag);
 288                  if ($this->debug_flag) {
 289                      $this->debug(''wsdl:'');
 290                      $this->appendDebug($this->varDump($this->wsdl));
 291                      print $this->getDebugAsXMLComment();
 292                  }
 293              } else {
 294                  $this->debug("In service, there is no WSDL");
 295                  header("Content-Type: text/html; charset=ISO-8859-1\r\n");
 296                  print "This service does not provide WSDL";
 297              }
 298          } elseif ($this->wsdl) {
 299              $this->debug("In service, return Web description");
 300              print $this->wsdl->webDescription();
 301          } else {
 302              $this->debug("In service, no Web description");
 303              header("Content-Type: text/html; charset=ISO-8859-1\r\n");
 304              print "This service does not provide a Web description";
 305          }
 306      }



As for my code, it''s exactly the same as described in the second tutorial article I linked earlier.

HELP! :confused:

解决方案

client = new soapclient(''http://localhost:81/site/helloWorld.php'');



Going to "http://localhost:81/site/helloWorld.php" in my browser gives me the same 500 error, not a 404, so I know there''s no problem with path/virtual directory.

So I did some more searching online and found that some people have debugged FastCGI errors by running the PHP script from the command-line and noticing an invalid DLL reference.

So, first I tried my service:

C:\Program Files (x86)\PHP>php-cgi.exe D:\webdir\helloWorld.php
X-Powered-By: PHP/5.2.14
Content-Type: text/html; charset=ISO-8859-1

This service does not provide a Web Description



Running my client script the same way just causes php-cgi.exe to crash in typical Windows "... has stopped working" alert fashion. But at least the service gave me some sort of an error message!

Next natural step was to search for "This service does not provide a Web Description" which returned a number of results of the NuSOAP documentation...

Specifically, class.soap_server.php. And there on line 304 is:

print "This service does not provide a Web description";



But why am I getting this?!

Both of the (suspiciously similar, ahem) articles linked earlier are pretty clear-cut and don''t waste words explaining any special hosting requirements for the server. From the best I can parse that part of class.soap_server.php, it looks to me like it''s checking the Request Method (GET/POST), determining that it''s GET, and then trying to identify what the caller wanted and failing.

Which kind of makes sense when I call the script directly either from the browser or command-line, but why would there be a problem with the client constructor?!

Am I reading the code wrong, or is this error just a red herring masking a different problem when I call the constructor?

For the lazy, here''s the entire function from class.soap_server.php which is generating the only error I''m seeing (right at the bottom):

function service(


data){ 237 global


HTTP_SERVER_VARS; 238 239 if (isset(


这篇关于PHP NuSOAP错误(没有网站描述?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆