import javax.xml.namespace.QName; import javax.xml.rpc.*; import java.net.*; public class StockClient { public static void main(String[] args) { try { //System.setProperty("proxyHost","secureproxy.prosodie"); //System.setProperty("proxyPort","8080"); System.setProperty("proxyHost","localhost"); System.setProperty("proxyPort","8080"); //=== create service factory ServiceFactory factory = ServiceFactory.newInstance(); //=== define qnames String targetNamespace = "http://www.themindelectric.com/" + "wsdl/net.xmethods.services.stockquote.StockQuote/"; QName serviceName = new QName(targetNamespace, "net.xmethods.services.stockquote.StockQuoteService"); QName portName = new QName(targetNamespace, "net.xmethods.services.stockquote.StockQuotePort"); //QName operationName = new QName("urn:xmethods-delayed-quotes", "getQuote"); URL wsdlLocation = new URL("http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"); //=== create service Service service = factory.createService(wsdlLocation, serviceName); /* //=== create call Call call = service.createCall(portName, operationName); //=== invoke the remote web service Float result = (Float) call.invoke(new Object[] {"BEAS"}); */ StockIF myStockIf = (StockIF)service.getPort(portName, StockIF.class); float result = myStockIf.getQuote("YHOO"); System.out.println("\n"); System.out.println("This example shows how to create a dynamic client application that invokes a Web service."); System.out.println("The webservice used was: " + "http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl"); System.out.println("The quote for is: "); System.out.println(result); } catch (Exception ex) { ex.printStackTrace(); } } }