I am trying to build up a customer object in PHP and then send to a asmx web service. Everything works fine except that I build an array inside the PHP. When I send it to the web-service only the last order history appears.
Here is the contract specified by the web service. Note this is pizza-code and not the actual code as the contract contain sensitive data.
public class Customer
{
public int CustomerId { get; set;}
public int Name { get; set;}
public int Surname { get; set;}
public OrderHistory History { get; set;}
}
public class OrderHistory
{
public int NumberOfOrders { get;set;}
public Orders[] Orders { get;set;}
}
public class Orders
{
public int OrderId { get;set;}
public decimal Total {get;set;}
}
Here is how I build up the PHP object.
$params_create_save = array("Customer" =>
array("CustomerId" => "111",
"Name" => "Joe",
"Surname" => "Soap",
"History" => array("NumberOfOrders" => "10",
"Orders" => array("OrdersId" => "1"
"Total" => "500.00"),
"Orders" => array("OrderId" => "1",
"Total" => "200.00"),
),
),
),
),
),
Questions:
Does the above PHP look correct? Am I missing something?
Can I create a seperate Order History object and just assign it to the parent. If yes please can you provide me with a small sample code?
Is there other ways I can build this object?
Thanks for taking the time to look at this! -E-