Edit report at http://bugs.php.net/bug.php?id=47647&edit=1
ID: 47647 Updated by: fel...@php.net Reported by: e dot mortoray at ecircle dot com Summary: Array types don't retain xsi:types for polymorphic types -Status: Open +Status: Feedback Type: Bug Package: SOAP related Operating System: Linux PHP Version: 5.2.9 New Comment: Please try using this snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2009-03-13 15:33:31] e dot mortoray at ecircle dot com Description: ------------ The SOAPClient doesn't appear to handle Arrays containing polymorphic types correctly. In this case (using the Seapine TestTrack API) we have an array of type "ArrayOfCField" according to the WSDL. And if we obtain a result the XML encoding of this array looks like this: <customFieldList xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="ttns:CField[1]"><item xsi:type="ttns:CDropdownField"><recordid>363</recordid><name>Customer</name><value>Argos (C1407)</value></item></customFieldList> But when using var_dump on the resulting structure we can see that the "CDropdownField" (which derives from CField) is lost in the stored data. Subsequently that means when submitting the data back the Array does not contain the proper types. The resulting XML is this: <customFieldList SOAP-ENC:arrayType="ns1:CField[1]" xsi:type="ns1:ArrayOfCField"><item xsi:type="ns1:CField"><recordid xsi:type="xsd:long">363</recordid><name xsi:type="xsd:string">Customer</name></item></customFieldList> Note that the first item is simply of type "CField" rather than "CDropdownField". Needless to say this causes the server to reject the request. Related Bugs: 36575 Reproduce code: --------------- In the TestTrack API this is simply: $defect = $soap->editDefect( $cookie, $number, '', false ); $soap->saveDefect( $cookie, $defect ); Docs for the WSDL/API: http://labs.seapine.com/SDKRequests.php Expected result: ---------------- The stored data and the returned data should retain the knowledge of the derived types. In this case the item in the array should be marked as a CDropdownField. It should be noted that if the data obtained is manually patched, then the return works. That is, setting the "customFieldList" such as: 'customFieldList' => array ( new SoapVar( array( 'recordid' => 363, 'name' => 'Customer', 'value' => 'Argos (C1407)', ), XSD_ANYTYPE, 'CDropdownField', 'urn:testtrack-interface' )) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=47647&edit=1