php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61343 PHP/SOAP does not interpret xsd:redefine syntax
Submitted: 2012-03-10 15:55 UTC Modified: -
Votes:8
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: christian dot achatz at payback dot net Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.10 OS: LINUX (CentOS)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-03-10 15:55 UTC] christian dot achatz at payback dot net
Description:
------------
For our customers, we provide a common api including customer-specific endpoints. These endpoints are created with JAX-WS from manually defined XSDs and WSDLs. The structure of each end point is as follows:

* <CustomerName>_<CountryCode>.wsdl
* <CustomerName>_<CountryCode>.xsd
* <CustomerName>_<CountryCode>_Types.xsd
* Base_Types.xsd

The WSDL only defines the SOAP methods whereas the <CustomerName>_<CountryCode>.xsd references the data structure for the specific customer interface. BaseTypes.xsd is a common data definition file, that is partly redefined within the <CustomerName>_<CountryCode>_Types.xsd file using the xs:redefine mechanism. 

Unfortunately, we are facing an issue with this structure since data types that are redefined within the <CustomerName>_<CountryCode>_Types.xsd file are ignored during request generation. Given the structure

<typ:AuthenticateRequest>
    <typ1:ConsumerIdentification>
        <typ1:ConsumerAuthentication>
            <typ1:Principal>...</typ1:Principal>
            <typ1:Credential>...</typ1:Credential>
        </typ1:ConsumerAuthentication>
    </typ1:ConsumerIdentification>
    <typ:Authentication>
        <typ1:Identification>
            <typ1:Alias>...</typ1:Alias>
        </typ1:Identification>
        <typ1:Security>
            <typ1:SecretType>...</typ1:SecretType>
            <typ1:Secret>...</typ1:Secret>
        </typ1:Security>
    </typ:Authentication>
</typ:AuthenticateRequest>

the ConsumerIdentification and Authentication elements are defined within the BaseTypes.xsd and are redefined (in this case defined more precisely) within the <CustomerName>_<CountryCode>_Types.xsd. Setting up a request with

$requestParams = array(
   'ConsumerIdentification' => array(
      'ConsumerAuthentication' => array(
         'Principal' => $this->authentication->getPrincipal(),
         'Credential' => $this->authentication->getCredential()
      )
   ),
   'Authentication' => array(
      'Identification' => array(
         'Alias' => $alias
      ),
      'Security' => array(
         'SecretType' => 2,
         'Secret' => $secret
      )
   )
);

results in an XML structure that lacks the details of the redefined data structure. The request XML is as follows:

<typ:AuthenticateRequest>
    <typ1:ConsumerIdentification />
    <typ:Authentication />
</typ:AuthenticateRequest>

Obviously, this is not a sufficent input for the web service and it complains about missing consumer credentials.

From my point of view, this is a none-feature of the PHP/SOAP implementation since merging the content within the xs:redefine block of the <CustomerName>_<CountryCode>_Types.xsd into the BaseTypes.xsd solves this issue.

Test script:
---------------
In case more information in the XSDs or WSDLs are needed, please contact me. At present, I am not allowed to publish them for security reasons.

Regarding the SoapClient: it is created as described within the PHP docs. Nothing special there.

Expected result:
----------------
<typ:AuthenticateRequest>
    <typ1:ConsumerIdentification>
        <typ1:ConsumerAuthentication>
            <typ1:Principal>...</typ1:Principal>
            <typ1:Credential>...</typ1:Credential>
        </typ1:ConsumerAuthentication>
    </typ1:ConsumerIdentification>
    <typ:Authentication>
        <typ1:Identification>
            <typ1:Alias>...</typ1:Alias>
        </typ1:Identification>
        <typ1:Security>
            <typ1:SecretType>...</typ1:SecretType>
            <typ1:Secret>...</typ1:Secret>
        </typ1:Security>
    </typ:Authentication>
</typ:AuthenticateRequest>

Actual result:
--------------
<typ:AuthenticateRequest>
    <typ1:ConsumerIdentification />
    <typ:Authentication />
</typ:AuthenticateRequest>

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC