PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » SOAP » Bug #2694

dispatch_map not used for plain output values (does not work with gSOAP)

Details

Submitted2004-11-04 22:02 UTC
Fromrainer dot glaschick at c-lab dot de
Assignedyunosh
StatusClosed
PackageSOAP
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2004-11-04 22:02 UTC] rainer dot glaschick at c-lab dot de

Description:
------------
The reply generated by Server.php does not honor the dispatch_map for plain values, but always uses 'return' for plain values.

Version is SOAP 0.8RC3

The relevant part of the WSDL generated by DISCO is:

<message name="jetztResponse">
<part name="uhrzeit" type="xsd:string" />
</message>

Reproduce code:
---------------
Patch for Server.php $Id: Server.php,v 1.44.2.1 2003/12/20 21:21:59 sklar Exp $

@@ -539,11 +539,7 @@
function getReturnType($returndata)
{
if (is_array($returndata)) {
- if (count($returndata) > 1) {
- return $returndata;
- }
- $type = array_shift($returndata);
- return $type;
+ return $returndata;
}
return false;
}

PHP Code used:
<?php
class Service {
function jetzt($format) {
if ($format == null || trim($format) == "") return date("H:i");
else return date($format);
}
var $__dispatch_map = array();
function Service() {
$this->__dispatch_map["jetzt"] =
array ("out" => array("uhrzeit" => "string"),
"in" => array("format" => "string"));
}
function __dispatch($methode) {
if (isset($this->__dispatch_map[$methode])) {
return $this->__dispatch_map[$methode];
} else {
return NUL;
}
}
}
require_once "SOAP/Server.php";

$soap = new SOAP_Server();
$service = new Service();
$soap->addObjectMap($service, "urn:Date");
if (isset($_SERVER["REQUEST_METHOD"]) &&
$_SERVER["REQUEST_METHOD"] == "POST") {
$soap->service($HTTP_RAW_POST_DATA);
} else {
require_once "SOAP/Disco.php";
$disco = new SOAP_DISCO_Server($soap, "Date");
header("Content-type: text/xml");
print $disco->getWSDL();
}
?>

Expected result:
----------------
<ns4:jetztResponse>
<uhrzeit xsi:type="xsd:string">22:33:40</uhrzeit>
</ns4:jetztResponse>

Actual result:
--------------
<ns4:jetztResponse>
<return xsi:type="xsd:string">22:32:54</return> </ns4:jetztResponse>