Android - query all Customer Orders from odata service -
i have wcf data service (from sample ms northwidth database), android app requesting data service code:
northdataservice service = new northdataservice(); query<customers> query = service.createcustomersquery("/customers"); (customers cust : query){ log.d(log_tag, "customer name - " + cust.getcustomerid()); }
i try query customer orders:
log.d(log_tag, "orders - " + cust.getorders());
and see orders - null
also know data on orders can request:
http://server:82/northdata.svc/customers('alfki')/orders
i try query:
for (customers cust : query){ log.d(log_tag, "customer name - " + cust.getcustomerid()); string custname = "/customers" + "('" + cust.getcustomerid() + "')" + "/orders"; try{ query<customers> cquery1 = service.createcustomersquery(custname); (customers orders : cquery1){ log.d(log_tag, "orders2 - " + orders.tostring()); } } catch(exception e){} }
i see result:
orders2 - northwindmodel.customers@40b49f68 orders2 - northwindmodel.customers@40c1de10 orders2 - northwindmodel.customers@40bdaea8 orders2 - northwindmodel.customers@40a6d238
how orderid 1 customer?
the uri ~/customers('alfki')/$links/products identifies set of products related customer id='alfki'.
Comments
Post a Comment