1 22 package org.jboss.tutorial.webservice.client; 23 24 import org.jboss.tutorial.webservice.bean.Calculator; 25 26 import javax.xml.namespace.QName ; 27 import javax.xml.rpc.Service ; 28 import javax.xml.rpc.ServiceFactory ; 29 import java.net.URL ; 30 import java.io.File ; 31 32 public class Client 33 { 34 public static void main(String [] args) throws Exception 35 { 36 URL url = new URL ("http://localhost:8080/tutorial/CalculatorBean?wsdl"); 37 QName qname = new QName ("http://bean.webservice.tutorial.jboss.org/jaws", 38 "CalculatorService"); 39 40 ServiceFactory factory = ServiceFactory.newInstance(); 41 Service service = factory.createService(url, qname); 42 43 Calculator calculator = (Calculator) service.getPort(Calculator.class); 44 45 System.out.println("1 + 1 = " + calculator.add(1, 1)); 46 System.out.println("1 - 1 = " + calculator.subtract(1, 1)); 47 } 48 } 49 | Popular Tags |