Click here to Skip to main content
13,148,427 members (61,984 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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;
 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          }
 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));
 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:
Posted 11-Aug-10 13:42pm
Dalek Dave 11-Aug-10 19:47pm
Reason for my vote of 5
Nice to see a well thought out and structured question, although I hardly think it fulfills the requirement of Quick! :)
Member 10546444 30-Jan-14 1:58am
here is the code for server.php


$server = new nusoap_server;

//$server ->configureWSDL('server', 'urn:server');

//$server ->wsdl->schemaTargetNamespace = 'urn:server';

//$server ->register('pollServer', array('value' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server#pollServer');

//------------------------------------------------------------------- GetFeedDetails services ---------------------------------------------------------

//register a function that works on server

$server ->register('getfeedDetails', array('value' => 'xsd:string'), array('return' => 'xsd:string'), 'urn:server', 'urn:server# getfeedDetails');

// create the function to fetch Data’s from Database

function getfeedDetails ()


$conn = mysql_connect('localhost','root','');

mysql_select_db('m4agri', $conn);

$sql = "SELECT * FROM m4agri.datainfo";

$q = mysql_query($sql);

$items = array();

while($row = mysql_fetch_array($q)){

$items [] = array(








return $items;



$server ->service($HTTP_RAW_POST_DATA);

and this is for client.php



$url = "http://localhost/testserver/server.php?wsdl";

$client = new nusoap_client($url);

//Call server function

$response = $client ->call('getfeedDetails');



echo "FAULT: <p>Code: (".$client ->faultcode.")</p>";

echo "String: ".$client->faultstring;




$result = $response;

$count = count($result);


<table >


<th> kvk</th>

<th> Month</th>

<th> village</th>

<th> Solved</th>

<th> transcribed</th>



for($i = 0;$i < $count-1;$i++) {

$rowtype = ($i % 2) ? "style='background:#88DAEB'": "style=background:#FFF";


<tr <?php echo $rowtype; ?>>

<td><?php echo $result[$i]['kvk']?></td>

<td><?php echo $result[$i]['Month']?></td>

<td><?php echo $result[$i]['village']?></td>

<td><?php echo $result[$i]['Solved']?></td>

<td><?php echo $result[$i]['transcribed']?></td>









<style type="text/css">

th {





This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 11 Aug 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100