Edit report at https://bugs.php.net/bug.php?id=50997&edit=1
ID: 50997
Comment by: potgieterg at gmail dot com
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
Block user comment: N
Private report: N
New Comment:
The above example of just putting empty strings for all the other choice fields
is
not working, sure it does not give you the error anymore but in my case the
server
is accepting the first choice as the choice even if I enter data for the second
choice as well.
Previous Comments:
------------------------------------------------------------------------
[2012-05-16 14:29:57] duccio at citta dot bo dot it
It's not really a solution to the bug, but it does make it work. In the passed
parameters, define all the fields he's claiming as "Missing property".
So if you're using an array, and it says it's missing property 'GetData', do:
$requestArray['GetData'] = '';
and so on with each field, until it's working.
------------------------------------------------------------------------
[2012-04-11 11:34:16] christian dot achatz at payback dot net
This issue is also reproducable for PHP 5.3.8. It would be kind to fix it very
soon.
------------------------------------------------------------------------
[2011-05-17 11:09:02] yozik04 at gmail dot com
I can reproduce this with PHP version 5.3.5 in Ubuntu.
Moving element around in xsd is not a solution for me.
Is there any other workaround available without touching WSDL and XSD?
------------------------------------------------------------------------
[2010-07-13 12:56:49] sebastian at rootdir dot ws
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.
------------------------------------------------------------------------
[2010-02-11 10:22:36] mrsharp at gmx dot de
Tested also using PHP Version 5.2.5-3 same result....
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=50997
--
Edit this bug report at https://bugs.php.net/bug.php?id=50997&edit=1