package jaxws;A Class which exposes this web service
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Hello {
private String message = "Hello, ";
public void Hello() {}
@WebMethod
public String sayHello(String name) {
return message + name + ".";
}
}
package jaxws;
import javax.xml.ws.Endpoint;
public class Server {
protected Server () throws Exception {
System.out.println ("Starting Server");
Object implementor = new Hello ();
String address = "http://localhost:9000/SoapContext/SoapPort";
Endpoint.publish (address, implementor);
}
public static void main (String args[]) throws Exception {
new Server ();
System.out.println ("Server ready...");
System.out.println (" -- Press any key to exit...");
System.in.read ();
System.out.println ("Server exiting");
System.exit (0);
}
}
Get the WSDL from Server : Open the url with your internet browser : http://localhost:9000/SoapContext/SoapPort?wsdl
Create a project for this wsdl via SOAPUI and send requests.So simple!
No comments:
Post a Comment