Create POJO based JAX-WS with Oracle J Developer.(WSDL URL)
Create POJO based JAX-WS with Oracle J Developer.
1.Create New Java Desktop Application and give name "POJO_Client (This is Project Name) ".
2. Create a Java class. For this right click on the POJO_Client project > Click New > Click Java Class > Click OK.
9. Starts the Integrated WebLogic Server and initiates the HTTP Analyzer after deploying the Webservice.
3.Give the Name of the Java class as EmployeeBean. Click OK
public class EmployeeBean {
private String name;
private String designation;
private Integer salary;
private String departments;
public EmployeeBean() {
super();
}
public EmployeeBean(String name, String designation, Integer salary, String departments) {
this.name = name;
this.designation = designation;
this.salary = salary;
this.departments = departments;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public String getDesignation() {
return designation;
}
public void setSalary(Integer salary) {
this.salary = salary;
}
public Integer getSalary() {
return salary;
}
public void setDepartments(String departments) {
this.departments = departments;
}
public String getDepartments() {
return departments;
}
}
4. create one more Java class to hold Employees data.
The complete code for Employees.java is shown below:
import java.util.ArrayList;
import java.util.List;
public class Employees {
public Employees() {
super();
}
private List<EmployeeBean> employeeList = new ArrayList<EmployeeBean>();
public void setEmployeeList(List<EmployeeBean> employeeList) {
this.employeeList = employeeList;
}
public List<EmployeeBean> getEmployeeList() {
if (employeeList.size() == 0) {
employeeList.add(new EmployeeBean("Susanto Paul", "ADF Developer", 12000, "IT"));
employeeList.add(new EmployeeBean("Moumita Deb", "UI Developer", 14000, "IT"));
employeeList.add(new EmployeeBean("Anjali Paul", "Manager", 32100, "IT"));
employeeList.add(new EmployeeBean("Nirmal Deb", "Architect", 31000, "IT"));
}
return employeeList;
}
}
5.we need to create a Webservice. For this, simply add @WebService just before Employees class name and import javax.jws.WebService package.
6.When we write "@Webservice" Upon the class then we got Warning msg symbol click on that to see below Dialog box and select Java EE 6, with support for JAX-WS Annotations. Click OK
9. Starts the Integrated WebLogic Server and initiates the HTTP Analyzer after deploying the Webservice.
Comments
Post a Comment