php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41004 minOccurs="0" and null class member variable
Submitted: 2007-04-05 12:12 UTC Modified: 2007-05-02 09:38 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: w dot antoine at free dot fr Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2007-04-05 12:12 UTC] w dot antoine at free dot fr
Description:
------------
I use the classmap option of the soap client constructed from the WSDL.
In my wsdl file i have a complex type with elements where minOccurs=0 et maxOccurs=1.

When the corresponding class member is null, an empty element is send.
How i can tell the soap client to not send elements when minOccurs=0 and 
the value is NULL?

The webservice server is apache axis

Reproduce code:
---------------
Complex type definition:
<complexType name="SimulateRequest">
  <all>
	<element name="product1Type" type="impl:Product1Type"/>
	<element name="product1BankCardTypeCd" type="impl:Product1BankCardTypeCd" minOccurs="0"/>
  </all>
</complexType>

Php Code to call:
	$simulationRequest[0]->setProduct1Type("CLA");
	$simulationRequest[0]->setProduct1BankCardTypeCd(NULL);

Php class SimulateRequest extract:
        class SimulateRequest{
           private  $product1Type ;
           public  function  getProduct1Type(){
            return $this->product1Type;
           }
           public function setProduct1Type($param){
             $this->product1Type=$param;
           }
           private  $product1BankCardTypeCd ;
           public  function  getProduct1BankCardTypeCd(){
             return $this->product1BankCardTypeCd;
           }
           public function setProduct1BankCardTypeCd($param){
            $this->product1BankCardTypeCd=$param;
           }


Expected result:
----------------
<ns1:simulationRequest>
         <ns1:product1Type>REV</ns1:product1Type>
</ns1:simulationRequest>


Actual result:
--------------
<ns1:simulationRequest>
         <ns1:product1Type>REV</ns1:product1Type>
         <ns1:product1BankCardTypeCd/>
</ns1:simulationRequest>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-05 19:57 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-04-11 18:22 UTC] w dot antoine at free dot fr
Hi

The test case (the wsdl file and the client classes are available on:
http://w.antoine.free.fr/php-bug-41004-testCase.zip
 [2007-05-02 09:38 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC