php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45404 SoapClient.__getTypes don't care about inheritance
Submitted: 2008-07-01 14:42 UTC Modified: 2012-08-20 02:02 UTC
Votes:32
Avg. Score:4.6 ± 0.5
Reproduced:29 of 29 (100.0%)
Same Version:3 (10.3%)
Same OS:3 (10.3%)
From: oamblet at vmware dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.2.6 OS: MacOSX 10.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oamblet at vmware dot com
New email:
PHP Version: OS:

 

 [2008-07-01 14:42 UTC] oamblet at vmware dot com
Description:
------------
the __getTypes() function return a list of structs which represents the 
various types from the parsed WSDL.

However, the inherited attributes are not listed in the struct. It 
becomes hard to introspect a WSDL file with this __getTypes() give this 
limitation.

Reproduce code:
---------------
Given this WSDL fragment:

...
<xs:element name="Entry" type="tns:Entry"/>
<xs:element name="ManagedEntry" type="tns:ManagedEntry"/>
<xs:complexType name="ManagedEntry">
  <xs:complexContent>
    <xs:extension base="tns:Entry">
      <xs:sequence>
        <xs:element minOccurs="0" name="id" type="xs:string"/>
        <xs:element minOccurs="0" name="stringRepresentation" type="xs:string"/>
      </xs:sequence>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>
<xs:complexType name="Entry">
  <xs:sequence>
    <xs:element minOccurs="0" name="name" type="xs:string"/>
    <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="tns:EntryProperty"/>
    <xs:element minOccurs="0" name="type" type="xs:string"/>
  </xs:sequence>
</xs:complexType>
...

<?php
$client = new SoapClient("http://x.x.x.x/echo?WSDL");
$client->__getTypes();
?>



Expected result:
----------------
[
  struct ManagedEntry {
   string id;
   string stringRepresentation;
   string name;
   EntryProperty properties;
   string type;
  },

  struct Entry {
   string name;
   EntryProperty properties;
   string type;
  }
]





Actual result:
--------------
[
  struct ManagedEntry {
   string id;
   string stringRepresentation;
  },

  struct Entry {
   string name;
   EntryProperty properties;
   string type;
  }
]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-01 14:59 UTC] oamblet at vmware dot com
Perhaps a good alternative could be to add the extension information in 
the output of __getTypes().
 [2009-04-28 18:44 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-06 01:00 UTC] 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".
 [2011-02-11 08:23 UTC] ujl at topdanmark dot dk
Hello,

I've same problem. I'm using a WSDL generator which read the WSDL file and the extension doesn't work. I've tried with windows PHP 5.2.17 and PHP 5.3.5. Is the problem solved on the *nix platform and not Windows?

The problem is extactly the same as described by oamblet 2008-07-01 and I didn't understand the issue is not solved in the windows version of PHP??
 [2011-07-19 18:33 UTC] abel dot silva at gmail dot com
Hello,

I'm having exactly the same problem.
php 5.3.0 on windows
 [2012-05-11 11:40 UTC] patkoscsaba at syneto dot net
I can confirm this bug is still present with PHP 5.3.10 on OpenIndiana.
 [2012-08-20 02:00 UTC] bkfake-php at yahoo dot com
I've just encountered this bug/shortcoming.

Thought it deserved a "bump"

the original report from 4 years ago states this bug makes it "hard".
I think the mor accurate word is "impossible"
 [2012-08-20 02:02 UTC] aharvey@php.net
-Status: No Feedback +Status: Open
 [2013-03-09 12:32 UTC] lucky_tomov at hotmail dot com
Seeing the same bug in php 5.3.3 on Ubuntu.
 [2017-11-16 04:24 UTC] chris at golfclub dot com dot au
Seeing this on php 7.1.8 on macOS 10.13.1
 [2018-02-02 20:41 UTC] info at tirus dot eu
Still not working. On WIN and Linux PHP 7.1 and 7.2 i have the same problem at now
 [2018-07-13 15:43 UTC] code at joshua-behrens dot de
After debugging through the source code of the php soap extension I found the behaviour locked down onto the namespaces. The given example from oamblet works perfectly if the posted schema has a different targetNamespace than the wsdl.

Although the output refers the parent as a property with an underscore as name.

After reading the RFC for WSDL 2.0 I was still clueless whether this behaviour is correct. I assume not as the WSDLs of the SOAP services I usally request share the same namespace with their schemes.

Would allowing the same namespace be correct?
 [2019-12-04 10:13 UTC] karol dot wegner at netcall dot com
PHP 7.2.17-0ubuntu0.18.04.1

WSDL...

<xsd:complexType xmlns:xsd='http://www.w3.org/2001/XMLSchema' name='WSResponse'>
  <xsd:sequence minOccurs='1' maxOccurs='1'>
    <xsd:element name='ErrorCode' type='xsd:int' />
    <xsd:element name='ErrorDescription' type='xsd:string' minOccurs='0' />
    <xsd:element name='SuccessFlag' type='xsd:boolean' />
  </xsd:sequence>
</xsd:complexType>
 
<xsd:complexType xmlns:xsd='http://www.w3.org/2001/XMLSchema' name='AddressResponse'>
  <xsd:complexContent>
    <xsd:extension base='tns:WSResponse'>
      <xsd:sequence minOccurs='1' maxOccurs='1'>
        <xsd:element name='Addresses' xmlns:tns='http://webservices.netcall.com/' type='tns:ArrayOfAddress' minOccurs='0' />
      </xsd:sequence>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>


SoapClient::__getTypes()...

struct WSResponse {
  int ErrorCode;
  string ErrorDescription;
  boolean SuccessFlag;
}
 
struct AddressResponse {
  ArrayOfAddress Addresses;
}

__getTypes() AddressResponse definition does not show inherited elements from the WSResponse type it extends (not to mention lack of minOccurs / maxOccurs)

Lack of XML schema extensions support makes the SoapClient not fit for purpose.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC