KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jboss > ebank > WSClient


1 package com.jboss.ebank;
2
3 import javax.xml.rpc.Call JavaDoc;
4 import javax.xml.rpc.Service JavaDoc;
5 import javax.xml.rpc.JAXRPCException JavaDoc;
6 import javax.xml.rpc.ServiceFactory JavaDoc;
7 import javax.xml.rpc.ParameterMode JavaDoc;
8
9 import javax.xml.namespace.QName JavaDoc;
10 import java.util.ArrayList JavaDoc;
11
12 import java.net.URL JavaDoc;
13
14 public class WSClient {
15     public static void main(String JavaDoc[] args)
16     throws Exception JavaDoc
17     {
18     URL JavaDoc url =
19         new URL JavaDoc("http://localhost:8080/ws4ee/services/TellerService?wsdl");
20
21     QName JavaDoc qname = new QName JavaDoc("http://ebank.jboss.com",
22                 "TellerService");
23
24     ServiceFactory JavaDoc factory = ServiceFactory.newInstance();
25     Service JavaDoc service = factory.createService(url, qname);
26
27     TellerEndpoint endpoint = (TellerEndpoint)
28         service.getPort(TellerEndpoint.class);
29
30     String JavaDoc customer = "200";
31     String JavaDoc[] ids = endpoint.getAccountsOfCustomer(customer);
32
33     System.out.println("Customer: " + customer);
34     for (int i=0; i<ids.length; i++) {
35         System.out.println("account[" + ids[i] + "] " +
36                    endpoint.getAccountBalance(ids[i]));
37     }
38     }
39
40 }
41
Popular Tags