KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hessian > demo > client > CustomerInfo


1 package hessian.demo.client;
2
3 import dinamica.*;
4 import hessian.demo.*;
5 import com.caucho.hessian.client.*;
6
7 /**
8  * CustomerInfo<br>
9  * Retrieve customer information using
10  * the Hessian based WebService ".../hessian/customer"
11  * <br><br>
12  * <br>Creation date: 01/06/2004
13  * <br>(c) 2004 Martin Cordova y Asociados
14  * <br>http://www.martincordova.com
15  * @author Martin Cordova dinamica@martincordova.com
16  */

17 public class CustomerInfo
18 {
19
20     public static void main(String JavaDoc[] args) throws Throwable JavaDoc
21     {
22
23         //service end-point
24
String JavaDoc url = "http://localhost/sdk/hessian/customer";
25         
26         //get proxy
27
HessianProxyFactory factory = new HessianProxyFactory();
28         ICustomer c = (ICustomer) factory.create(ICustomer.class, url);
29         
30         //call service
31
Recordset rs = c.getCustomer("ALFKI");
32         
33         //navigate recordset and children
34
rs.first();
35         System.out.println(rs);
36         
37         //get orders
38
Recordset rsOrders = rs.getChildrenRecordset();
39         System.out.println(rsOrders);
40         
41         //get detail for every order
42
rsOrders.top();
43         while (rsOrders.next())
44         {
45             Recordset rsDetail = rsOrders.getChildrenRecordset();
46             System.out.println(rsDetail);
47         }
48         
49     }
50 }
51
Popular Tags