Bug #50997 [Com]: SOAP Error when trying to submit 2nd Element of a choice

From: Date: Tue, 13 Jul 2010 10:56:50 +0000
Subject: Bug #50997 [Com]: SOAP Error when trying to submit 2nd Element of a choice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152364@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=50997&edit=1

 ID:               50997
 Comment by:       sebastian at rootdir dot ws
 Reported by:      mrsharp at gmx dot de
 Summary:          SOAP Error when trying to submit 2nd Element of a
                   choice
 Status:           Open
 Type:             Bug
 Package:          SOAP related
 Operating System: debian
 PHP Version:      5.2.12

 New Comment:

As this still seems to be an issue, here is a complete reproducer:


$soapClient = new SoapClient('service2.wsdl', array ('trace' => 1));

$params = array('code' => 'foo');
$soapClient->newOperation($params);


WSDL excerpt:

<xsd:element name="NewOperation">
  <xsd:complexType>
   <xsd:choice>
     <xsd:sequence>
       <xsd:element name="firstName" type="xsd:string">
</xsd:element>
       <xsd:element name="surName" type="xsd:string"/>
     </xsd:sequence>
     <xsd:element name="code" type="xsd:string"/></xsd:choice>
  </xsd:complexType>
</xsd:element>

(You can find the whole WSDL example file over at
http://pastebin.com/UZrPCuJt)


Actual result:

Fatal error: SOAP-ERROR: Encoding: object hasn't 'firstName' property


If you move element name "code" being the first child of <xsd:choice>
the code snippet above is working as expected.


Previous Comments:
------------------------------------------------------------------------
[2010-02-11 10:22:36] mrsharp at gmx dot de

Tested also using PHP Version 5.2.5-3 same result....

------------------------------------------------------------------------
[2010-02-10 18:08:41] mrsharp at gmx dot de

Description:
------------
My Actual PHP Version: PHP Version 5.2.11-0.dotdeb.0

not 100% sure if this relates to Bug #43723: "SOAP not sent properly
from client for <choice>" because SOAP is not sent at all in my scenario
(Fatal Error)

Part of my WSDL is this schema excerpt

<xsd:complexType name="sometype">
  <xsd:choice>
   <xsd:group ref="sd:someGroupDefA"/>
   <xsd:group ref="sd:someGroupDefB"/>
  </xsd:choice> ....

A SOAP operation now employs this type... if I attempt to submit a
property set which resembles "someGroupDefB" I receive a 

SOAP-ERROR: Encoding: object hasn't someGroupDefA property 

so it seems that choice is not properly evalutated...




Expected result:
----------------
I expect that SOAP accepts both sets of parameters without complaining
about the other missing...



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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50997&edit=1


Thread (9 messages)

« previous php.bugs (#152364) next »