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

 ID:                 39179
 Comment by:         marius dot orcsik at avangate dot com
 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 problem is still present in PHP 5.3.12.


Previous Comments:
------------------------------------------------------------------------
[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

------------------------------------------------------------------------
[2008-09-30 07:47:51] stuart at stuartherbert dot com

Looks like jchernia is trying to access Netsuite's web service (Netsuite is a 
popular hosted ERP solution).  You can't access their SOAP service w/out a 
valid account, but if you had such an account, the following code triggers the 
error:

<?php

class GetRequest
{
        public $baseRef = null;
}

class LoginRequest
{
        public $passport = null;
}

class Passport
{
        public $email = null;
        public $password = null;
        public $account = null;
        public $role = null;
}

class BaseRef
{
        public $name = null;
}

class RecordRef extends BaseRef
{
        public $internalId = null;
        public $externalId = null;
        public $type       = null;
}

$user = new Passport();
$user->email='<your netsuite login>';
$user->password='<your netsuite password>';
$user->account='<your netsuite account ID>';
$user->role=new RecordRef;
$user->role->internalId=<your role ID>;

$loginRequest = new LoginRequest;
$loginRequest->passport = $user;

$soapClient = new 
SoapClient('https://webservices.netsuite.com/wsdl/v2008_1_0/netsuite.wsdl', 
array('trace' => 1));
$result = $soapClient->login($loginRequest);

$requestRef = new RecordRef;
$requestRef->externalId = 200;
$requestRef->type = 'issue';

try
{
        $issue = $soapClient->get(array('recordRef' => $requestRef));
        var_dump($issue);
}
catch (Exception $e)
{
        var_dump($e);
        var_dump($soapClient->__getLastRequest());
        var_dump($soapClient->__getLastResponse());
}

?>

__getLastRequest() reports:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="urn:messages_2008_2.platform.webservices.netsuite.com"><SOAP-ENV:Body><ns1:get><ns1:baseRef/></ns1:get></SOAP-ENV:Body></SOAP-ENV:Envelope>

and __getLastResponse() reports:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXException: 
{urn:core_2008_2.platform.webservices.netsuite.com}BaseRef is an abstract type 
and cannot be instantiated</faultstring>
      <detail>
        <ns1:hostname 
xmlns:ns1="http://xml.apache.org/axis/";>partners-java001.svale.netledger.com</ns1:hostname>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

Note the empty <ns1:baseRef/> in the request.  baseRef is an abstract type, in 
this case extended the recordRef.  The correct SOAP request is listed by the 
original poster.

Hope that helps.  If you need a Netsuite account for testing purposes, contact 
me privately and I'll sort one out for you.

Best regards,
Stu
--

------------------------------------------------------------------------
[2006-10-31 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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


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

Reply via email to