标签:ping com start 实体类 getpass ESS tor row res
package Services;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface ResultService<E> {
public ArrayList<E> getResultInfo() throws SQLException;
@WebMethod
public String getJsonResultInfo();
}
package Services;
public class Employee {
private String WORKCODE;
private String LASTNAME;
private Long SUBCOMPANYID1;
private Long DEPARTMENTID1;
private String JOBTITLEMARK;
private String JOBCALL;
private String JOBLEVEL;
private long MANAGERID;
private String STATUS;
private String LOCATIONNAME;
private String MOBILE;
private String MOBILECALL;
private String TELEPHONE;
private String STARTDATE;
private String LASTMODDATE;
//set and get.......
}
package Services;
public class Company {
private long ID;
private String SUBCOMPANYNAME;
//get and set.......
}
package Services;
public class Dept {
private long ID;
private String DEPARTMENTNAME;
private long SUPDEPID;
private long SUBCOMPANYID1;
private String DEPARTMENTMARK;
private String CANCELED;
//get and set......
}
package Services;
public class DeptLeader {
private long BMFZR;
private long BM;
//get and set....
}
package Services;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.jws.WebService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@WebService
public class EmployeeServiceImpl implements ResultService<Employee>{
private ArrayList<Employee> employees;
private Log log = LogFactory.getLog(EmployeeServiceImpl.class.getName());
@Override
public ArrayList<Employee> getResultInfo() throws SQLException {
// TODO Auto-generated method stub
PropertiesServiceImpl pro = new PropertiesServiceImpl();//配置文件信息读取类
String conn = pro.getConn();
String user = pro.getUser();
String password = pro.getPassword();
String table = pro.getViewEmployee();
JdbcUtils cs = new JdbcUtils(conn, user, password);//JDBC处理类
String sqlString = "SELECT * FROM " + table;
log.info("SQl:" + sqlString);
employees = cs.queryEmployeeResult(sqlString);
return employees;
}
@Override
public String getJsonResultInfo() {
// TODO Auto-generated method stub
String str = "";
try {
Json<Employee> deJson = new Json<Employee>();//JSON处理类
str = deJson.JsonStr(this.getResultInfo());
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return str;
}
}
package Services;
import java.util.ArrayList;
import net.sf.json.JSONArray;
public class Json<E>{
public String JsonStr(ArrayList<E> Lists){
return JSONArray.fromObject(Lists).toString();
}
}
package Services;
import javax.xml.ws.Endpoint;
public class ServicePublish {
public static void main(String[] args){
PropertiesServiceImpl pro = new PropertiesServiceImpl();
String baseAddress = pro.getUrl();
String employeeAddress = baseAddress + "Service/Employee";
String companyAddress = baseAddress + "Service/Company";
String deptAddress = baseAddress + "Service/Dept";
String deptLeaderAddress = baseAddress + "Service/DeptLeader";
Object implementorEmployee = new EmployeeServiceImpl();
Object implementorCompany = new CompanyServiceImpl();
Object implementorDept = new DeptServiceImpl();
Object implementorDeptLeader = new DeptLeaderServiceImpl();
Endpoint.publish(employeeAddress, implementorEmployee);
Endpoint.publish(companyAddress, implementorCompany);
Endpoint.publish(deptAddress, implementorDept);
Endpoint.publish(deptLeaderAddress, implementorDeptLeader);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>BPMUserService</display-name>
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>EmployeeServiceImpl</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>EmployeeServiceImpl</servlet-name>
<url-pattern>/EmployeeServiceImpl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EmployeeServiceImpl</servlet-name>
<url-pattern>/CompanyServiceImpl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EmployeeServiceImpl</servlet-name>
<url-pattern>/DeptServiceImpl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>EmployeeServiceImpl</servlet-name>
<url-pattern>/DeptLeaderServiceImpl</url-pattern>
</servlet-mapping>
</web-app>
标签:ping com start 实体类 getpass ESS tor row res
原文地址:https://www.cnblogs.com/dennyw/p/14199964.html