|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43723 SOAP not sent properly from client for <choice>.
Submitted: 2007-12-31 20:34 UTC Modified: 2008-10-16 15:50 UTC
Avg. Score:4.7 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:5 (83.3%)
Same OS:0 (0.0%)
From: mcordell at authorize dot net Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.5 OS: Windows XP Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mcordell at authorize dot net
New email:
PHP Version: OS:


 [2007-12-31 20:34 UTC] mcordell at authorize dot net
The wsdl contains a <choice> element. When the SOAP client sends the first element of the choice (ItemA) it works but if it sends the second one (ItemB) instead, the xml does not get sent.

Reproduce code:
The WSDL can be found HERE:


class ItemA {
    public $myname;
class ItemB {
    public $mynumber;
class Box {
    public $myitemA;
    public $myitemB;
class Foo {
	public $mybox;

$ws = new SoapClient("", array('trace' => 1));
$req = new Foo();
$req->mybox = new Box();
if (FALSE) {
	$req->mybox->myitemA = new ItemA();
	$req->mybox->myitemA->myname = "somename";
} else {
	$req->mybox->myitemB = new ItemB();
	$req->mybox->myitemB->mynumber = 123;
$resp = $ws->__soapCall("Foo", array("Foo" => $req));
echo "Raw request: " . htmlspecialchars($ws->__getLastRequest()) . "<br><br>";
echo "Raw response: " . htmlspecialchars($ws->__getLastResponse()) . "<br><br>";
echo htmlspecialchars($resp->FooResult) . "<br><br>";


Expected result:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1=""><SOAP-ENV:Body><ns1:Foo><ns1:mybox><ns1:myitemB><ns1:mynumber>123</ns1:mynumber></ns1:myitemB></ns1:mybox></ns1:Foo></SOAP-ENV:Body></SOAP-ENV:Envelope> 

Actual result:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1=""><SOAP-ENV:Body><ns1:Foo><ns1:mybox/></ns1:Foo></SOAP-ENV:Body></SOAP-ENV:Envelope> 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-07 12:57 UTC]
The wsdl file is not accessible. Could you please provide a valid link.
 [2008-10-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-10-16 15:50 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Sep 25 05:01:23 2020 UTC