users@glassfish.java.net

Some questions about Web Service

From: <glassfish_at_javadesktop.org>
Date: Sat, 03 Apr 2010 08:40:36 PDT

I completed my first Web-Service program. And I used GlassFish v3 as the application server. Here are my steps.

step 1: create a dynamic web project, and the following class:

[b]@WebService
public class HelloWorld {
    private String message = new String(": Hello World!");
   
    @WebMethod
    @WebResult(name = "greeting")
    public String sayHelloWorld(@WebParam(name = "name") String name) {
        return name + message ;
    }
}[/b]



step 2: use the command "wsgen" to generate the related WSDL file(and a XSD file, note, only these two files)

step 3: create a Java project, and use the command "wsimport" to generate the client-side required code

step 4: use the following code to invoke the Web Service at the client side


[b]public class HelloWorldClient {

    public static void main(String[] args) {
        HelloWorldService service = new HelloWorldService();
        HelloWorld port = service.getHelloWorldPort();
        System.out.println(port.sayHelloWorld("Duan Xiao Chen"));

    }

}[/b]



step 5: finally, this Web Service can be invoked successfully




My Question: I did not create a servlet or configured any servlets in web.xml, how does the application server process the HTTP request?
[Message sent by forum member 'astroboy1113']

http://forums.java.net/jive/thread.jspa?messageID=395165