From: Wojciech dot Szela at gmail dot com
Operating system: SuSe Linux 9.3
PHP version: 5.0.4
PHP Bug Type: SOAP related
Bug description: Problem with inheritance (by extension) in request (methods
argument)
Description:
------------
There's a problem with objects' class name received by soap server, when
passed in request object is inheriting from other one. For example:
data type definition in wsdl:
<xsd:complexType name="Vehicle">
<xsd:all>
<xsd:element name="loadWeight" type="xsd:int"></xsd:element>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="Car">
<xsd:complexContent>
<xsd:extension base="tns:Vehicle">
<xsd:all>
<xsd:element name="engineNumber" type="xsd:string"></xsd:element>
</xsd:all>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Second object is inheriting from the first one. And we have operation
defined like that:
<wsdl:message name="addCarResponse">
<wsdl:part name="return" type="tns:Car"></wsdl:part>
</wsdl:message>
<wsdl:message name="addCarRequest">
<wsdl:part name="car" type="tns:Car"></wsdl:part>
</wsdl:message>
<wsdl:operation name="addCar">
<soap:operation soapAction="http://www.foo.com/VehicleService/addCar"/>
<wsdl:input>
<soap:body use="encoded" namespace="http://www.foo.com/VehicleService/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output><soap:body use="encoded"
namespace="http://www.foo.com/VehicleService/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
Soap client is written in Java (axis). Method addCar is invoked with
variable of type Car. Soap server (PHP5) receives proper structure of
object - it has all fields, inherited from father and it's own, but
get_class(passedObject) returns father's class name (Vehicle). Class
mapping is correct. WSDL file is correct. Even returned object, also of
type Car, is correct.
Reproduce code:
---------------
$classmap = array( 'Car' => 'Car', 'Vehicle' => 'Vehicle' );
class fooService {
public addCar($car) {
$fh = fopen("foo.txt","a+"); fwrite($fh,get_class($car)+"\n");
fwrite($fh,var_export($car,true)); fclose($fh);
$storedObject = $this->storeInDB($car);
return $storedObject;
}
ini_set('soap.wsdl_cache_enabled',"0");
$server = new SoapServer('fooService.wsdl',array('classmap' =>
$classmap');
$server->setClass(fooService);
$server->handle();
Expected result:
----------------
File content:
Car
Car: loadWeight->someValue
Car: engineNumber->someOtherValue
Actual result:
--------------
File content:
Vehicle
Vehicle: loadWeight->someValue
Vehicle: engineNumber->someOtherValue
--
Edit bug report at http://bugs.php.net/?id=34218&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34218&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34218&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34218&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34218&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34218&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34218&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34218&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34218&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34218&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34218&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34218&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34218&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34218&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34218&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34218&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34218&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34218&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34218&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34218&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34218&r=mysqlcfg