Home » Web Services » SOAP » Bug #3456
serialized array of soap_vals does not include namespace
Details
| Submitted | 2005-02-14 02:48 UTC |
|---|---|
| From | commanderjason at gmail dot com |
| Assigned | chagenbu |
| Status | Closed |
| Package | SOAP |
| PHP Version | 4.3.10 |
| OS | win2000 |
| Roadmaps | (Not assigned) |
Comments
[2005-02-14 02:48 UTC] commanderjason at gmail dot com
Description:
------------
I have a complex soap_val, one of the members of this soap_val is an array of other complex soap_val types. The XML describing the complex types within the array does not properly define the namespace for the nested complex type.
Simple library change below fixes the problem
Base.php line: near 475
change: $xmlout_value .= $array_val->serialize($this);
to: $xmlout_value .= $this->_serializeValue($array_val, $array_val->name, $array_type, $array_type_ns);
Reproduce code:
---------------
for($i=0; $i<2; $i++) {
$Option = array("OptionId" => $i, "Name" => "Option Nizzame");
$NewOp = new SOAP_Value('ProductOption', '{http://jlite.com/webservices/}ProductOption', $Option);
$ProductOptions[] = $NewOp;
}
$CartItem = array('ProductCode' => $_REQUEST["ProductCode"],
'Quantity' => 1,
'SelectedProductOptions' => $ProductOptions);
$ProxyClass->MyFunction($CartItem);
Expected result:
----------------
xml =
<SOAP-ENV:Body>
<ns4:Order_CreateItem>
<ns4:OrderId>qOxuq6fmoMhvjLhkDtBOKg==</ns4:OrderId>
<ns4:Item>
<ns4:ProductCode>ts1</ns4:ProductCode>
<ns4:Quantity>1</ns4:Quantity>
<ns4:SelectedProductOptions>
<ns4:ProductOption>
<OptionId>0</OptionId>
<Name>Option Nizzame</ns4:Name>
</ns4:ProductOption>
<ns4:ProductOption>
<OptionId>1</OptionId>
<Name>Option Nizzame</ns4:Name>
</ns4:ProductOption>
</ns4:SelectedProductOptions></ns4:Item>
<ns4:AccessId>1U98PggfAevXQUiqVY0kFA==</ns4:AccessId></ns4:Order_CreateItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual result:
--------------
xml =
<SOAP-ENV:Body>
<ns4:Order_CreateItem>
<ns4:OrderId>qOxuq6fmoMhvjLhkDtBOKg==</ns4:OrderId>
<ns4:Item>
<ns4:ProductCode>ts1</ns4:ProductCode>
<ns4:Quantity>1</ns4:Quantity>
<ns4:SelectedProductOptions>
<ProductOption>
<OptionId>0</OptionId>
<Name>Option Nizzame</ns4:Name>
</ProductOption>
<ProductOption>
<OptionId>1</OptionId>
<Name>Option Nizzame</ns4:Name>
</ProductOption>
</ns4:SelectedProductOptions></ns4:Item>
<ns4:AccessId>1U98PggfAevXQUiqVY0kFA==</ns4:AccessId></ns4:Order_CreateItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>