Bug #39179 [Com]: Abstract types not handled by SoapClient in WSDL mode

From: Date: Tue, 04 Dec 2018 09:15:34 +0000
Subject: Bug #39179 [Com]: Abstract types not handled by SoapClient in WSDL mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218263@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=39179&edit=1

 ID:                 39179
 Comment by:         shamot at neonus dot sk
 Reported by:        jchernia at netsuite dot com
 Summary:            Abstract types not handled by SoapClient in WSDL
                     mode
 Status:             No Feedback
 Type:               Bug
 Package:            SOAP related
 Operating System:   Windows XP
 PHP Version:        5.1.6
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

This bug is still present in PHP 7.2.12. Does anyone actually working on this?


Previous Comments:
------------------------------------------------------------------------
[2015-03-26 09:34:24] bpolaszek at gmail dot com

Hi there,

PHP 5.6 is out, PHP 7 is on its way, and a decade later, the bug's still here. 
I encounter it today and it's very annoying. The only way for me to communicate with a partner
is its soap server, and I'm just stuck currently.

May you have a look at it ?

Thanks,
Beno!t POLASZEK
http://b.polaszek.fr

------------------------------------------------------------------------
[2012-05-08 12:05:16] marius dot orcsik at avangate dot com

This problem is still present in PHP 5.3.12.

------------------------------------------------------------------------
[2009-08-05 17:54:50] styx31 at gmail dot com

This bug is still present in the last version.

SoapClient does not honor polymorphism correctly, with or without abstract types

Sample WSDL :

<complexType name="PersonIdentity">
  <sequence>
    <element name="Id" type="xsd:string" />
  </sequence>
</complexType>
<complexType name="Person">
  <complexContent extends="PersonIdentity">
    <sequence>
      <element name="Name" type="xsd:string" />
      <element name="FirstName" type="xsd:string" />
    </sequence>
  </complexContent>
</complexType>

Operation contract :

<complexType name="CheckPerson">
 <sequence>
  <element name="Person" type="PersonIdentity"/>
 </sequence>
</complexType>

The operation CheckPerson accepts both Person and PersonIdentity.

Despite the fact that you can create a class which correponds in PHP :

class PersonIdentity {
  public $Id;
}

class Person extends PersonIdentity {
  public $Name;
  public $FirstName;
}

If you use a Person instance when you call CheckPerson() :
- the Person will be serialized as a PersonIdentity,
- no i:type="Person" attribute will be added to the <Person> element,
- the properties belonging to the Person class will be dropped

------------------------------------------------------------------------
[2009-06-16 06:07:08] dasteph+forum at gmail dot com

Hi,

I have pretty the same problem.
Reproducing code: http://castex.de/stuff/php-bug.txt

expected result (in error log)
------------------------------
[15-Jun-2009 16:47:29] client
[15-Jun-2009 16:47:29] server
[15-Jun-2009 16:47:29] TestAbstractRequest Object
(
    [element] => Child Object
        (
            [name] => test
        )

)

actual result
-------------
[15-Jun-2009 16:47:29] client
[15-Jun-2009 16:47:29] server
[15-Jun-2009 16:47:29] TestAbstractRequest Object
(
    [element] => Father Object
        (
            [name] => test
            [number] => 5
        )

)


Regards

Stephan

------------------------------------------------------------------------
[2009-02-20 04:40:46] jchernia at netsuite dot com

Full WSDL - 

https://webservices.netsuite.com/wsdl/v2008_2_0/netsuite.wsdl

The code that Stu submitted will cause the problem. When making the 
get() request you will get

<baseRef/> 
instead of 
<baseRef internalId="17" type="customer"
xsi:type="ns1:RecordRef"/>

where internalId and type are properties of the subclass (RecordRef) 
and not of BaseRef.

-John

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=39179


--
Edit this bug report at https://bugs.php.net/bug.php?id=39179&edit=1


Thread (13 messages)

« previous php.bugs (#218263) next »