| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2007-04-20 16:47 UTC] m dot necib at akrobat dot fr
 Description:
------------
When using subclass as a value in WSDL mode,
the properties are written in the wrong order :
the child class properties are written _before_
the parent properties.
Reproduce code:
---------------
PHP:
class A
{
public $a ;
}
class B extends A
{
public $b ;
}
$client = new SoapClient(...) ;
$var = new SoapVar( new B(), SOAP_ENC_OBJECT, 'B', 'http://myns/' ) ;
$client->foo($var) ;
Expected result:
----------------
SOAP request :
<parametres xsi:type="B" >
  <a></a>
  <b></b>
</parametres>
Actual result:
--------------
SOAP request :
<parametres xsi:type="B" >
  <b></b>
  <a></a>
</parametres>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC | 
WSDL : <complexType name="A"> <sequence> <element name="a" type="xsd:int"/> </sequence> </complexType> <complexType name="B"> <complexContent> <extension base="impl:A"> <sequence> <element name="b" type="xsd:int"/> </sequence> </extension> </complexContent> </complexType>Not reprodusable. Reproduce code: --------------- <?php class Loan { public $startingDate = "01-Jan-2007"; public $amount; public $duration; } class LoanPersoItem { public $year; public $amount; } class LoanPerso extends Loan { public $loans; } $client = new SoapClient("http://213.41.94.84/wsPricing/services/PricingSNC?wsdl", array( "location" => "test://", "trace" => 1, "exceptions" => 0, ) ) ; $v = new LoanPerso(); $v->loans = new LoanPersoItem(); $var = new SoapVar($v , SOAP_ENC_OBJECT, 'WSLoanPerso', 'http://pricing.aigvienet/gb/snc/' ) ; $client->processPricingSNC( array( "insured" => array( "name" => "Aaa", "firstname" => "Bbb", "birthdate" => "01-Jan-2006" ), "premiumMode" => 0, "loan" => $var, "option" => array(), "productCode" => "XXX" ) ) ; echo $client->__getLastRequest(); ?> Output: ------- <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://pricing.aigvienet/gb/snc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><ns1:processPricingSNC><parametres><ns1:insured><ns1:name>Aaa</ns1:name><ns1:firstname>Bbb</ns1:firstname><ns1:birthdate>01-Jan-2006</ns1:birthdate><ns1:profession xsi:nil="true"/></ns1:insured><ns1:premiumMode>0</ns1:premiumMode><ns1:loan xsi:type="ns1:WSLoanPerso"><ns1:startingDate>01-Jan-2007</ns1:startingDate><ns1:amount xsi:nil="true"/><ns1:duration xsi:nil="true"/><ns1:loans><ns1:year xsi:nil="true"/><ns1:amount xsi:nil="true"/></ns1:loans></ns1:loan><ns1:option/><ns1:promotional xsi:nil="true"/><ns1:quotity xsi:nil="true"/><ns1:couple xsi:nil="true"/><ns1:smoker xsi:nil="true"/><ns1:ds xsi:nil="true"/><ns1:productCode>XXX</ns1:productCode></parametres></ns1:processPricingSNC></SOAP-ENV:Body></SOAP-ENV:Envelope>