Commit 8750b183 by Aaron Josue Yaya Maza

[EDIT] SE QUITÓ LLAMADO A planillaws

parent 072daa0b
...@@ -21,6 +21,10 @@ public final class RequestPath { ...@@ -21,6 +21,10 @@ public final class RequestPath {
public static final String LOGIN = BASE + "user/login"; public static final String LOGIN = BASE + "user/login";
public static final String ENVIAR_NUEVO_TOKEN = BASE + "proyecto/enviarNuevoToken"; public static final String ENVIAR_NUEVO_TOKEN = BASE + "proyecto/enviarNuevoToken";
public static final String VERIFICAR_LOGIN = BASE + "user/verificarLogin"; public static final String VERIFICAR_LOGIN = BASE + "user/verificarLogin";
public static final String listarPersonalPorTipoDocNumDoc = BASE + "user/listarPersonalPorTipoDocNumDoc";
public static final String listarPersonalPorCodigo = BASE + "user/listarPersonalPorCodigo";
public static final String listarTipoDocumento = BASE + "user/listarTipoDocumento";
/*Rest Matricula*/ /*Rest Matricula*/
private static final String BASE_MATRICULA = dotenSrv.obtenerValorVariableEntorno("BASE_MATRICULA"); private static final String BASE_MATRICULA = dotenSrv.obtenerValorVariableEntorno("BASE_MATRICULA");
public static final String PERIODO_SERVLET = BASE_MATRICULA + "periodo/periodoServlet"; public static final String PERIODO_SERVLET = BASE_MATRICULA + "periodo/periodoServlet";
......
...@@ -14,14 +14,13 @@ import javax.servlet.http.HttpServlet; ...@@ -14,14 +14,13 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.WebServiceRef; import javax.xml.ws.WebServiceRef;
import moduloSeguridad.config.RequestPath;
import moduloSeguridad.services.UsuarioService; import moduloSeguridad.services.UsuarioService;
import moduloSeguridad.utilities.HttpRequest;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import pe.siso.planillaws.service.Personal;
import pe.siso.planillaws.service.PersonalService_Service;
import pe.siso.planillaws.service.TipoDocumento;
import pe.siso.planillaws.service.TipoDocumentoService_Service;
/** /**
* *
...@@ -29,11 +28,11 @@ import pe.siso.planillaws.service.TipoDocumentoService_Service; ...@@ -29,11 +28,11 @@ import pe.siso.planillaws.service.TipoDocumentoService_Service;
*/ */
public class UsuarioServlet extends HttpServlet { public class UsuarioServlet extends HttpServlet {
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/app9.sacooliveros.edu.pe_8080/PlanillaWS/PersonalService.wsdl") /*@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/app9.sacooliveros.edu.pe_8080/PlanillaWS/PersonalService.wsdl")
private PersonalService_Service service_1; private PersonalService_Service service_1;
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/app9.sacooliveros.edu.pe_8080/PlanillaWS/TipoDocumentoService.wsdl") @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/app9.sacooliveros.edu.pe_8080/PlanillaWS/TipoDocumentoService.wsdl")
private TipoDocumentoService_Service service; private TipoDocumentoService_Service service;*/
@Override @Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
...@@ -191,13 +190,26 @@ public class UsuarioServlet extends HttpServlet { ...@@ -191,13 +190,26 @@ public class UsuarioServlet extends HttpServlet {
response.setContentType("application/json"); response.setContentType("application/json");
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
List<TipoDocumento> lista = listarTipoDocumento(); /*List<TipoDocumento> lista = listarTipoDocumento();
for (int i = 0; i < lista.size(); i++) { for (int i = 0; i < lista.size(); i++) {
JSONObject rs = new JSONObject(); JSONObject rs = new JSONObject();
rs.put("codTipoDocumento", lista.get(i).getCodTipoDocumento()); rs.put("codTipoDocumento", lista.get(i).getCodTipoDocumento());
rs.put("tipoDocumento", lista.get(i).getNomCor()); rs.put("tipoDocumento", lista.get(i).getNomCor());
rs.put("longitud", lista.get(i).getLon()); rs.put("longitud", lista.get(i).getLon());
array.put(rs); array.put(rs);
}*/
JSONObject respuesta = null;
JSONObject obj = new JSONObject();
HttpRequest httpRequest = new HttpRequest();
String r = httpRequest.getRespuesta(RequestPath.listarPersonalPorCodigo, HttpRequest.POST, obj, "");//Respuesta del server
respuesta = new JSONObject(r);
JSONArray data = respuesta.getJSONArray("data");
for (int i = 0; i < data.length(); i++) {
JSONObject rs = new JSONObject();
rs.put("codTipoDocumento", data.getJSONObject(i).getString("cod_tipo_documento"));
rs.put("tipoDocumento", data.getJSONObject(i).getString("nom_cor"));
rs.put("longitud", data.getJSONObject(i).getString("lon"));
array.put(rs);
} }
out.println(array); out.println(array);
...@@ -334,25 +346,41 @@ public class UsuarioServlet extends HttpServlet { ...@@ -334,25 +346,41 @@ public class UsuarioServlet extends HttpServlet {
out.println(rs); out.println(rs);
} }
private java.util.List<pe.siso.planillaws.service.TipoDocumento> listarTipoDocumento() { //private java.util.List<pe.siso.planillaws.service.TipoDocumento> listarTipoDocumento() {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe. // Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required. // If the calling of port operations may lead to race condition some synchronization is required.
pe.siso.planillaws.service.TipoDocumentoService port = service.getTipoDocumentoServicePort(); /*pe.siso.planillaws.service.TipoDocumentoService port = service.getTipoDocumentoServicePort();
return port.listarTipoDocumento(); return port.listarTipoDocumento();
} }*/
private Personal listarPersonalPorTipoDocNumDoc(java.lang.String tipoDocumento, java.lang.String numeroDocumento, java.lang.String estado) { private JSONObject listarPersonalPorTipoDocNumDoc(java.lang.String tipoDocumento, java.lang.String numeroDocumento, java.lang.String estado) throws IOException {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe. // Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required. // If the calling of port operations may lead to race condition some synchronization is required.
pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort(); /*pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort();
return port.listarPersonalPorTipoDocNumDoc(tipoDocumento, numeroDocumento, estado); return port.listarPersonalPorTipoDocNumDoc(tipoDocumento, numeroDocumento, estado);*/
} JSONObject respuesta = null;
JSONObject obj = new JSONObject()
private Personal listarPersonalPorCodigo(java.lang.String tipoDocumento) { .put("tipoDocumento", tipoDocumento)
.put("numeroDocumento", numeroDocumento)
.put("estado", estado);
HttpRequest httpRequest = new HttpRequest();
String r = httpRequest.getRespuesta(RequestPath.listarPersonalPorTipoDocNumDoc, HttpRequest.POST, obj, "");//Respuesta del server
respuesta = new JSONObject(r);
return respuesta;
}
private JSONObject listarPersonalPorCodigo(java.lang.String tipoDocumento) throws IOException {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe. // Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required. // If the calling of port operations may lead to race condition some synchronization is required.
pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort(); /*pe.siso.planillaws.service.PersonalService port = service_1.getPersonalServicePort();
return port.listarPersonalPorCodigo(tipoDocumento); return port.listarPersonalPorCodigo(tipoDocumento);*/
JSONObject respuesta = null;
JSONObject obj = new JSONObject()
.put("tipoDocumento", tipoDocumento);
HttpRequest httpRequest = new HttpRequest();
String r = httpRequest.getRespuesta(RequestPath.listarPersonalPorCodigo, HttpRequest.POST, obj, "");//Respuesta del server
respuesta = new JSONObject(r);
return respuesta;
} }
private void listarUsuarioManual(HttpServletRequest request, HttpServletResponse response) throws IOException { private void listarUsuarioManual(HttpServletRequest request, HttpServletResponse response) throws IOException {
......
...@@ -29,10 +29,6 @@ public class SqlServerDAOFactory extends DAOFactory { ...@@ -29,10 +29,6 @@ public class SqlServerDAOFactory extends DAOFactory {
String userSgbd = ""; String userSgbd = "";
String passwordSgbd = ""; String passwordSgbd = "";
if (base.equalsIgnoreCase("security")) { if (base.equalsIgnoreCase("security")) {
/*String user = "###########";
String pwd = "########";
String url = "jdbc:sqlserver://172.16.0.6:1433;databaseName=security";*/
// String url = "jdbc:sqlserver://172.16.2.40:1433;databaseName=Security";
host = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_HOST"); host = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_HOST");
port = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_PORT"); port = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_PORT");
databaseName = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_NAME"); databaseName = dotenSrv.obtenerValorVariableEntorno("SQLSERVER_SECURITY_DB_NAME");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment