#43723 [Opn->Asn]: SOAP not sent properly from client for <choice>.

From: Date: Tue, 07 Oct 2008 12:56:16 +0000
Subject: #43723 [Opn->Asn]: SOAP not sent properly from client for <choice>.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129539@lists.php.net to get a copy of this message
 ID:               43723
 Updated by:       dmitry@php.net
 Reported By:      mcordell at authorize dot net
-Status:           Open
+Status:           Assigned
 Bug Type:         SOAP related
 Operating System: Windows XP Pro
 PHP Version:      5.2.5
-Assigned To:      
+Assigned To:      dmitry


Previous Comments:
------------------------------------------------------------------------

[2007-12-31 20:34:25] mcordell at authorize dot net

Description:
------------
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:
http://www.youshare.com/view.php?file=BoxWebService.wsdl.txt


<?php

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

$ws = new SoapClient("http://someurl.com/BoxWebService.asmx?wsdl",
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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://someurl.com/BoxWebService/"><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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://someurl.com/BoxWebService/"><SOAP-ENV:Body><ns1:Foo><ns1:mybox/></ns1:Foo></SOAP-ENV:Body></SOAP-ENV:Envelope>




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


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



Thread (4 messages)

« previous php.bugs (#129539) next »