Friday, January 23, 2015

WebService

                 Creating WebService Using Eclipse

For Creating webService using Apache Tomme Server is very Simple.You can create the webservice by following way-
Basic Requirement:
       1.JDK 1.7
       2.Apache Tomme Server or Apache Tomcat Server 7
       3.Eclipse IDE
       4.Soap GUI Tool

Package Structure In Eclipse                     


This the Simple structure ,which we can follow to create web service.

Steps For Creating Service  

 a.First we will create a  Class
          HelloService.java.  
    
package com.pankaj.ws;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class HelloService {
private String message = new String("Hello, ");

public void Hello() {
}

@WebMethod
public String sayHello(String name) {
return message + name + ".";
}
}

In this class ,@WebService annotation is responsible for creating webservice.We can say that this class is annotation based Service.With this way, you can skip the process of creating the wsdl by Eclipse. Due to this annotaion wsdl will genrate automaticlly.

2. After creating this class we will deploy this class to Tomme server.

    For getting wsdl we will use the following proces-
             http://localhost:8080//WebServiceDemo/HelloServiceService?wsdl



No comments:

Post a Comment