php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29844 SOAP doesn't return the result of a valid SOAP request
Submitted: 2004-08-26 06:29 UTC Modified: 2004-08-26 14:26 UTC
From: davey@php.net Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.0.1 OS: WinXP SP2
Private report: No CVE-ID: None
 [2004-08-26 06:29 UTC] davey@php.net
Description:
------------
I have written a simple Hello World client/server application.

When I issue my request, no exception is thrown, but the result is NULL, even though the SOAP response suggests it should be otherwise.

- Davey

Reproduce code:
---------------
Server:

<?php

class hello_world {
   
    /**
     * Say Hello to Somebody
     *
     * @param string $to The person to say Hello to
     * @return string The greeting
     */ 
     
    public function hello($to)
    {
        return $this->constructMsg($to);
    }
    
    public function goodBye($to)
    {
        return "Goodbye $to";
    }
    
    /**
     * Construct Greeting
     *
     * @param string $to
     * @return string
     */
    
    private function constructMsg($to)
    {
        return 'Hello ' . $to;
    }    
}

$server = new SoapServer('HelloWorld.wsdl', array('trace' => 1));
$server->setClass('hello_world');

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $server->handle();
} else {
  echo "This SOAP server can handle following functions: <br />";
  $functions = $server->getFunctions();
  foreach($functions as $func) {
   echo $func . "<br />";
  }
}

?>

Client:

<?php

$client = new SoapClient('http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/HelloWorld.wsdl', array('trace' => 1));

try {
    echo $client->hello('davey');
    echo $client->__getLastRequestHeaders();
    echo "\n";
    echo "\n";
    echo $client->__getLastRequest();
    echo "\n";
    echo "\n";
    echo $client->__getLastResponse();
}
catch (Exception $e) {
    echo $e;
    echo "\n";
    echo "\n";
    echo $client->__getLastRequestHeaders();
    echo "\n";
    echo "\n";
    echo $client->__getLastRequest();
    echo "\n";echo "\n";
    echo $client->__getLastResponse();
}

?>

Expected result:
----------------
"Hello davey"

Actual result:
--------------
returns NULL

Headers:

POST /php-mag/shafikdavey_automaticwebservices/src/Listing%201.php HTTP/1.1
Host: davey.synapticmedia.net
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: text/xml; charset="utf-8"
SOAPAction: "http://davey.synapticmedia.net/php-mag/shafikdavey_automaticwebservices/src/Listing%201.php#hello"
Content-Length: 430

Request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<to xsi:type="xsd:string">davey</to>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<helloReturn xsi:type="xsd:string">Hello davey</helloReturn>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-26 14:26 UTC] dmitry@php.net
Fixed in CVS (PHP_5_0 & HEAD)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC