1 package customfactory.client.stub; 2 3 import org.apache.wsif.WSIFService; 4 import org.apache.wsif.WSIFServiceFactory; 5 import org.apache.wsif.WSIFException; 6 import java.rmi.RemoteException ; 7 import customfactory.client.stub.com.themindelectric.www.NetXmethodsServicesStockquoteStockQuotePortType; 8 9 16 17 public class Run { 18 19 public static void main(String [] args) { 20 try { 21 22 if (args.length != 2) { 23 System.out.println( 24 "Usage: java customfactory.client.stub.Run <wsdl location> <company symbol>"); 25 System.exit(1); 26 } 27 28 WSIFServiceFactory factory = WSIFServiceFactory.newInstance(); 30 31 WSIFService service = 33 factory.getService( 34 args[0], 35 null, 36 null, 37 "http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/", 38 "net.xmethods.services.stockquote.StockQuotePortType"); 39 NetXmethodsServicesStockquoteStockQuotePortType stub = null; 42 stub = (NetXmethodsServicesStockquoteStockQuotePortType) 43 service.getStub(NetXmethodsServicesStockquoteStockQuotePortType.class); 44 45 float quote = stub.getQuote(args[1]); 48 System.out.println(quote); 49 50 } catch (WSIFException we) { 51 System.out.println( 52 "Error while executing sample, received an exception from WSIF; details:"); 53 we.printStackTrace(); 54 } catch (RemoteException re) { 55 System.out.println( 56 "Error while executing sample, received an exception due to remote invocation; details:"); 57 re.printStackTrace(); 58 } 59 } 60 } 61 | Popular Tags |