php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43004 Regarding bug #41004
Submitted: 2007-10-17 13:13 UTC Modified: 2007-10-17 16:33 UTC
From: jreese at multiplexhq dot com Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.2.4 OS: All
Private report: No CVE-ID: None
 [2007-10-17 13:13 UTC] jreese at multiplexhq dot com
Description:
------------
The fix provided in bug report #41004 has caused issues with a 3rd party web service I am working with.  As detailed in the referenced report, the complextype has elements where minOccurs=0 and maxOccurs=1.

To quote from the bug report:

"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?"

In our case, we need our soap client to still send the empty xml elements if the class member is null.

The remote service is running on .NET and we do not have access to modify the source.  I could make a modified wsdl file but do not think it is the best solution to override the wsdl provided by the service.

Below I'm going to use the same example in the previous bug report.

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:product1BankCardTypeCd/>
</ns1:simulationRequest>

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-17 16:33 UTC] dmitry@php.net
The request asks to generate XML that doesn't conform to schema.
Hints were sent by email.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 16:03:35 2021 UTC