1 package com.jboss.ebank; 2 3 import javax.xml.rpc.Call ; 4 import javax.xml.rpc.Service ; 5 import javax.xml.rpc.JAXRPCException ; 6 import javax.xml.rpc.ServiceFactory ; 7 import javax.xml.rpc.ParameterMode ; 8 9 import javax.xml.namespace.QName ; 10 import java.util.ArrayList ; 11 12 import java.net.URL ; 13 14 public class WSClient { 15 public static void main(String [] args) 16 throws Exception 17 { 18 URL url = 19 new URL ("http://localhost:8080/ws4ee/services/TellerService?wsdl"); 20 21 QName qname = new QName ("http://ebank.jboss.com", 22 "TellerService"); 23 24 ServiceFactory factory = ServiceFactory.newInstance(); 25 Service service = factory.createService(url, qname); 26 27 TellerEndpoint endpoint = (TellerEndpoint) 28 service.getPort(TellerEndpoint.class); 29 30 String customer = "200"; 31 String [] 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 |