1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| package khaled;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import khallou.Test;
public class Client {
public static void main(String[] args) throws Exception {
URL url = new URL("http://pc-de-khallou:8080/WS/TestBean?wsdl");
QName qname = new QName("http://khallou/jaws","TestService");
System.out.println("Creating a service Using: \n\t"+ url + " \n\tand " + qname);
ServiceFactory factory = ServiceFactory.newInstance();
Service remote = factory.createService(url, qname);
System.out.println("Obtaining reference to a proxy object");
Test nom = (Test) remote.getPort(Test.class);
System.out.println("Accessed local proxy: " + nom);
String string = "world";
System.out.println("Sending: " + string);
try{
System.out.println("Receiving: " + nom.sayHello("world"));
}
catch(Exception e){
System.out.println(e.getStackTrace());
}
}
} |