ENI (3) Sedipuialba Consuming Web Services
1. Introduction
These main dependencies are used (gradle format):
- 'org.projectlombok:lombok:1.18.24'
- 'org.apache.commons:commons-lang3:3.12.0'
- 'org.apache.cxf:cxf-core:3.5.4'
- 'org.apache.cxf:cxf-rt-features-logging:3.5.4'
- 'org.apache.cxf:cxf-rt-ws-security:3.5.4'
- 'org.apache.cxf:cxf-rt-frontend-jaxws:3.5.4'
- 'org.apache.cxf:cxf-rt-transports-http:3.5.4'
- 'com.sun.xml.ws:jaxws-ri:2.3.5'
- 'com.fasterxml.jackson.core:jackson-databind:2.13.4'
- 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4'
- 'org.glassfish.web:jakarta.servlet.jsp.jstl:2.0.0'
- 'jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:3.0.0'
- 'org.slf4j:slf4j-api:2.0.4'
- 'org.slf4j:slf4j-simple:2.0.4'
For consuming WS in Sedipualba these resources will be used
- A property file that stores all the parameters
- A general class for any WS (WsManger.java)
- A specific class with all the needed calls to Sedipualba. You can add more specific calls (WsAlba.java)
- Examples of using calls
2. Properties file
This is the property files, change your passwords and DIR3 codes and townhall codes
#===================================================== # 1. SEDIPUALBA #==================================================== alba.keys=sefycu,segra,segex,seres_registro,seres_ciudadanos,directorio,sello alba.opts=prod,demo # 1.0.0 alba.sefycu.prod alba.url.sefycu.prod=https://ayto-code.sedipualba.es/sefycu/wssefycu.asmx?wsdl alba.username.sefycu.prod=integraciows alba.password.sefycu.prod=my-production-password alba.pkg.sefycu.prod=https.eadmin_dipualba_es.sefycu.wssefycu # 1.0.1 alba.sefycu.demo alba.url.sefycu.demo=https://pre-ayto-code.sedipualba.es/sefycu/wssefycu.asmx?wsdl alba.username.sefycu.demo=integraciows alba.password.sefycu.demo=my-demo-password alba.pkg.sefycu.demo=https.eadmin_dipualba_es.sefycu.wssefycu # 1.1.0 alba.segra.prod alba.url.segra.prod=https://ayto-code.sedipualba.es/sefycu/wssegra.asmx?wsdl alba.username.segra.prod=integraciows alba.password.segra.prod=my-production-password alba.pkg.segra.prod=https.eadmin_dipualba_es.sefycu.wssegra # 1.1.1 alba.segra.demo alba.url.segra.demo=https://pre-ayto-code.sedipualba.es/sefycu/wssefycu.asmx?wsdl alba.username.segra.demo=integraciows alba.password.segra.demo=my-demo-password alba.pkg.segra.demo=https.eadmin_dipualba_es.sefycu.wssegra # 1,2.0 alba.segex.prod alba.url.segex.prod=https://ayto-code.sedipualba.es/segex/wssegex.asmx?wsdl alba.username.segex.prod=integraciows alba.password.segex.prod=my-production-password alba.pkg.segex.prod=https.eadmin_dipualba_es.segex/wssegex # 1.2.1 alba.segex.demo alba.url.segex.demo=https://pre-ayto-code.sedipualba.es/segex/wssegex.asmx?wsdl alba.username.segex.demo=integraciows alba.password.segex.demo=my-demo-password alba.pkg.segex.demo=https.eadmin_dipualba_es.segex/wssegex # 1.3.0 alba.seres.prod alba.url.seres_registro.prod=https://ayto-code.sedipualba.es/seres/Servicios/wsseresregistro.asmx?wsdl alba.username.seres_registro.prod=integraciows alba.password.seres_registro.prod=my-production-password alba.pkg.seres_registro.prod=es.sedipualba.wsseresv1 # 1.3.1 alba.seres.demo alba.url.seres_registro.demo=https://pre-ayto-code.sedipualba.es/seres/Servicios/wsseresregistro.asmx?wsdl alba.username.seres_registro.demo=integraciows alba.password.seres_registro.demo=my-demo-password alba.pkg.seres_registro.demo=es.sedipualba.wsseresv1 # 1.4.0 alba.seres_ciudadanos.prod alba.url.seres_ciudadanos.prod=https://ayto-code.sedipualba.es/seres/Servicios/wsseresciudadano.asmx?wsdl alba.username.seres_ciudadanos.prod=integraciows alba.password.seres_ciudadanos.prod=my-production-password alba.pkg.seres_ciudadanos.prod=es.sedipualba.wsseresv1 # 1.4.1 alba.seres_ciudadanos.demo alba.url.seres_ciudadanos.demo=https://pre-ayto-code.sedipualba.es/seres/Servicios/wsseresciudadano.asmx?wsdl alba.username.seres_ciudadanos.demo=integraciows alba.password.seres_ciudadanos.demo=my-demo-password alba.pkg.seres_ciudadanos.demo=es.sedipualba.wsseresv1 # 1.5.0 alba.directorio.prod alba.url.directorio.prod=https://ayto-code.sedipualba.es/wsdirectorio.asmx?wsdl alba.username.directorio.prod=integraciows alba.password.directorio.prod=my-production-password alba.pkg.directorio.prod=https.sedipualba_es.wsdirectorio # 1.5.1 alba.directorio.demo alba.url.directorio.demo=https://pre-ayto-code.sedipualba.es/wsdirectorio.asmx?wsdl alba.username.directorio.demo=integraciows alba.password.directorio.demo=my-demo-password alba.pkg.directorio.demo=https.sedipualba_es.wsdirectorio # 1.6.0 alba.sello.prod alba.url.sello.prod=https://ayto-code.sedipualba.es/firma/wsselloelectronico.asmx?wsdl alba.username.sello.prod=integraciows alba.password.sello.prod=my-production-password alba.pkg.sello.prod=es.sedipualba.firma.wsselloelectronico # 1.6.1 alba.sello.demo alba.url.sello.demo=https://pre-ayto-code.sedipualba.es/firma/wsselloelectronico.asmx?wsdl alba.username.sello.demo=integraciows alba.password.sello.demo=my-demo-password alba.pkg.sello.demo=es.sedipualba.firma.wsselloelectronico # parameters.prod alba.param.entidad.prod= ayto-code alba.param.dir3.prod= DIR3-code alba.param.seres.destino.registro.prod=26265 alba.param.seres.destino.factures.prod=24180 # parameters.demo alba.param.entidad.demo= ayto-code alba.param.dir3.demo= DIR3-code alba.param.seres.destino.registro.demo=16517 alba.param.seres.destino.factures.demo=18847
3. WsManager.java (The general class)
This is a general class for any WS
package ximodante.ws.utils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor; import org.apache.cxf.endpoint.Client; import org.apache.cxf.ext.logging.LoggingInInterceptor; import org.apache.cxf.ext.logging.LoggingOutInterceptor; import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; import lombok.Getter; import ximodante.basic.utils.basic.StringUtilsEdu; import ximodante.basic.utils.runthreads.RunThreadWithTimeOut; public class WsManager { //1. Collection of ws-client, ws-class loader and ws package(?) and properties @Getter private Map<String, List<Object>> mpClients=new HashMap<String,List<Object>>(); @Getter private Properties propsWs=null; @Getter private long timeOut=20000L; @Getter private boolean isInfo=false; /** * Add a client, class loader, package name and properties to mpClient * @param props * @param isInfo */ public WsManager(Properties propsWs, String app_key_opt, boolean isInfo, long timeOut) throws Exception { this.propsWs=propsWs; this.timeOut=timeOut; this.isInfo=isInfo; this.addClient(app_key_opt); } public WsManager(Properties propsWs, String[] appKeyOpt, boolean isInfo, long timeOut) throws Exception { this(propsWs,StringUtilsEdu.concatWithDot(appKeyOpt), isInfo, timeOut); } public WsManager(Properties propsWs, String app, String key, String opt, boolean isInfo, long timeOut) throws Exception { this(propsWs,StringUtilsEdu.concatWithDot(app,key, opt), isInfo, timeOut); } public void addClient(String[] appKeyOpt) throws Exception { addClient(StringUtilsEdu.concatWithDot(appKeyOpt)); } public void addClient(String app, String key, String opt ) throws Exception { addClient(StringUtilsEdu.concatWithDot(app, key, opt)); } @SuppressWarnings("unchecked") public void addClient(String app_key_opt) throws Exception { List<Object>lObj=mpClients.get(app_key_opt); if (lObj==null) { lObj=(List<Object>) new RunThreadWithTimeOut ( (a)-> { try { return getElemsAndCreateService((String) a); } catch (Exception e) { e.printStackTrace(); return null; } }, this.timeOut, app_key_opt).run(); if (lObj==null) throw new Exception ("cannot create client for '"+ app_key_opt+ "'"); this.mpClients.put(app_key_opt, lObj); } } private List<Object> getElemsAndCreateService(String app_key_opt) throws Exception { var lObj=new ArrayList<Object>(); WsApp wsApp=new WsApp(propsWs,app_key_opt); if (wsApp.getProps().entrySet().size()<4) throw new Exception("wsApp has not enough properties"); Properties props=wsApp.getProps(); JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); //0. Client String url=props.getProperty("url"); Client client = dcf.createClient(url); //0.1.Interceptors EDUUUUUU client.getInInterceptors().add(new LoggingInInterceptor()); client.getInFaultInterceptors().add(new LoggingInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutFaultInterceptors().add(new LoggingOutInterceptor()); //FI 0.1. Interceptors EDUUUUUU if (client==null) throw new Exception("Client not created"); if (isInfo) System.out.println("Client got OK!"); lObj.add(client); //1. class loader ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader==null) throw new Exception("ClassLoader not created"); if (isInfo) System.out.println("got class loader..."); lObj.add(classLoader); //2. Package String pkg=props.getProperty("pkg"); if (pkg==null) throw new Exception("pkg not created"); lObj.add(pkg); //3. Properties lObj.add(wsApp); return lObj; } /** * Invoke an operation * @param wsKey is the key to get the client in the hashmap of clients mpClients * @param operation is the name of the operation * @param objects are the object to pass to the operation * @return * @throws Exception */ public Object[] invoke (String app, String key, String opt, String operation, Object... objects) throws Exception { return invoke (StringUtilsEdu.concatWithDot(app, key, opt), operation, objects); } public Object[] invoke (String[] appKeyOpt, String operation, Object ...objects) throws Exception { return invoke (StringUtilsEdu.concatWithDot(appKeyOpt), operation, objects); } public Object[] invoke (String app_key_opt, String operation, Object ...objects) throws Exception { Client client=this.getClient(app_key_opt); Object[] res= client.invokeWrapped(operation, objects); return res; } // Client and others public List<Object> getClientAndOthers(String app_key_opt) throws Exception{ List<Object> lObj=this.mpClients.get(app_key_opt); if (lObj==null) { this.addClient(app_key_opt); lObj=this.mpClients.get(app_key_opt); } return lObj; } public List<Object> getClientAndOthers(String app, String key, String opt) throws Exception{ return this.getClientAndOthers(StringUtilsEdu.concatWithDot(app, key, opt)); } public List<Object> getClientAndOthers(String[] appKeyOpt) throws Exception{ return this.getClientAndOthers(StringUtilsEdu.concatWithDot(appKeyOpt)); } //----------------------- // Client protected Client getClient(String app_key_opt) throws Exception{ return (Client) this.getClientAndOthers(app_key_opt).get(0); } protected Client getClient(String app, String key, String opt) throws Exception{ return this.getClient(StringUtilsEdu.concatWithDot(app, key, opt)); } protected Client getClient(String[] appKeyOpt) throws Exception{ return this.getClient(StringUtilsEdu.concatWithDot(appKeyOpt)); } //----------------------- public ClassLoader getClassLoader(String app_key_opt) throws Exception{ return (ClassLoader) this.getClientAndOthers(app_key_opt).get(1); } public ClassLoader getClassLoader(String app, String key, String opt) throws Exception{ return this.getClassLoader(StringUtilsEdu.concatWithDot(app, key, opt)); } public ClassLoader getClassLoader(String[] appKeyOpt) throws Exception{ return this.getClassLoader(StringUtilsEdu.concatWithDot(appKeyOpt)); } //----------------------- public String getPkg(String app_key_opt) throws Exception{ return (String) this.getClientAndOthers(app_key_opt).get(2); } public String getPkg(String app, String key, String opt) throws Exception{ return this.getPkg(StringUtilsEdu.concatWithDot(app, key, opt)); } public String getPkg(String[] appKeyOpt) throws Exception{ return this.getPkg(StringUtilsEdu.concatWithDot(appKeyOpt)); } //----------------------- public WsApp getWsApp(String app_key_opt) throws Exception{ return (WsApp) this.getClientAndOthers(app_key_opt).get(3); } public WsApp getWsApp(String app, String key, String opt) throws Exception{ return this.getWsApp(StringUtilsEdu.concatWithDot(app, key, opt)); } public WsApp getWsApp(String[] appKeyOpt) throws Exception{ return this.getWsApp(StringUtilsEdu.concatWithDot(appKeyOpt)); } /* public static void main (String[] args) throws FileNotFoundException, IOException { WSManager wsmngr= new WSManager(); String path= System.getProperty("user.dir") + File.separator + "src" + File.separator + "main" + File.separator + "resources" + File.separator + "properties" + File.separator + "wsOrveExportPROD.properties"; Properties props=new Properties(); props.load(new FileInputStream(path)); wsmngr.addClient(props, false); wsmngr.invoke(props.getProperty("key"), "obtenerIdentificadores", args) System.out.println("Se acabo"); } */ }
4. WsAlba.java (the specific class)
package ximodante.ws.alba; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; //import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Properties; import java.util.TimeZone; import java.util.function.Function; import java.util.stream.Collectors; //import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.reflect.FieldUtils; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import ximodante.basic.utils.basic.Pwd; import ximodante.basic.utils.nif.CIFValidatorEdu; import ximodante.basic.utils.reflection.Obj2StringWrapper; import ximodante.basic.utils.reflection.ReflectionBasic; import ximodante.basic.utils.ws.WsOutput; import ximodante.ws.Ws; import ximodante.ws.utils.WsManager; public class WsAlba extends Ws{ //!!!!!!!CANNOT set to null these properties as the constructor resets then to null; private String username; private String password; private String entidad; private String modifPwd; private String nif; public WsAlba(Properties wsProps, String app, String key, String opt, boolean isInfo, long timeOut) throws Exception { super(wsProps,app,key,opt, isInfo, timeOut); initMe(); } public WsAlba(Properties wsProps, String[] appKeyOpt, boolean isInfo, long timeOut) throws Exception { super(wsProps, appKeyOpt, isInfo, timeOut); initMe(); } public WsAlba(Properties wsProps, String app_key_opt, boolean isInfo, long timeOut) throws Exception { super(wsProps, app_key_opt, isInfo, timeOut); initMe(); } protected void initMe() throws Exception { if (!appKeyOpt[0].equals("alba")) throw new Exception ("app must be 'alba'"); this.createSecurity(this.appKeyOpt); } private void createSecurity(String[] myAppKeyOpt) throws Exception { this.wsMngr.addClient(myAppKeyOpt); Properties props=this.wsMngr.getWsApp (myAppKeyOpt).getProps(); this.username= props.getProperty("username","").trim(); this.password= props.getProperty("password","").trim(); if (this.username.length()>100) { this.username=Pwd.unhide(username); this.password=Pwd.unhide(password); } //this.username=Pwd.unhide(props.getProperty("username")); //this.password=Pwd.unhide(props.getProperty("password")); this.entidad=props.getProperty("param.entidad"); this.modifPwd =getModifiedPwd(this.password); this.nif="73912286S"; //Edu } private String getModifiedPwd(String myPassword) throws NoSuchAlgorithmException { // 1. Obtener la fecha y hora en formato UTC (Estamos a UTC+2 -> hay que quitar 2 horas) SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHHmmss"); fmt.setTimeZone(TimeZone.getTimeZone("UTC")); String myUTCDate = fmt.format(new Date()); // 2.Concatenamos el timestamp y la contraseña en texto claro String cadena = myUTCDate + myPassword; // 3. codificamos el resultado a UTF8 byte[] bytes = cadena.getBytes(StandardCharsets.UTF_8); // 4. Obtenemos el hash en SHA-256 byte[] encodedhash = MessageDigest.getInstance("SHA-256").digest(bytes); // 5. codificamos el hash en base64 String b64String = Base64.getEncoder().encodeToString(encodedhash); // 6. Concatenamos el timestamp con eñ hash en Base 64 String resultadoFinal = myUTCDate + b64String; return resultadoFinal; } @Override protected WsOutput invoke(String operation,String myKey, String outputField, Object... objects) throws Exception { String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); boolean ok=true; String code= "00"; String description="Llamada correcta"; Object b=null; try { ObjectMapper objectMapper= new ObjectMapper(); objectMapper.registerModule(new JavaTimeModule()); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); Obj2StringWrapper obj2String=new Obj2StringWrapper(objectMapper); System.out.println("Parametros:" + obj2String.writeValueAsString(objects)); Object[] res =wsMngr.invoke(myAppKeyOpt, operation, objects); b=res[0]; if (outputField!=null && outputField.trim().length()>0) { //NestedProperty if (outputField.contains(".")) b=PropertyUtils.getNestedProperty(b, outputField); //Simple property else b=FieldUtils.readField(b, outputField, true); } } catch (Exception e) { ok=false; code= "01"; description=e.getMessage(); } WsOutput wsOutput=new WsOutput(ok,code + "-" + description, b); return wsOutput; } /** * * Determina el ID de subprocediment obtingut desde * Para preproducción: * https://pre-tavernesdevalldigna.sedipualba.es/segex/listar_procedimientos.aspx * * Para producción: * https://tavernesdevalldigna.sedipualba.es/segex/listar_procedimientos.aspx * * * @param extracto del expedient * @param seccio (codi de la secció A001, B004...) * @return un array dels ids dels subtipus de procediments on * EL primer valor es PREPRODUCCI�" i el segón es el REAL o PRODUCCI�" */ public Integer[] getProcedimiento(String extracto, String seccio) { Integer[] idProc=new Integer[] {0,0}; String ext1=extracto.toLowerCase(); if (ext1.contains("contra") && ext1.contains("menor")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial (869) if (seccio.trim().equalsIgnoreCase("A001")) { if (ext1.contains("convocat") && ext1.contains("sessi") && ext1.contains("ple")) return new Integer[] { 245501, 269282}; //Plenari (49) if (ext1.contains("propost") && ext1.contains("ple")) return new Integer[] { 245501, 269282}; //Propostes Plenari (49) if (ext1.contains("rmav") || ext1.contains("associaci")) return new Integer[] { 244815, 268592}; //Associacions->Ferias (86) if (ext1.contains("act") | ext1.contains("comis") && ext1.contains("informativa") ) return new Integer[] { 244623, 268388}; //Actas Comisiones informativas (4) if (ext1.contains("comis") && ext1.contains("informativa") ) return new Integer[] { 244624, 268389}; //Comisiones informativas (27) if (ext1.contains("junta") && ext1.contains("portav") ) return new Integer[] { 245498, 269277}; //Junta de portavoces (5) if (ext1.contains("junta") && ext1.contains("govern") ) return new Integer[] { 245498, 269273}; //Junta de govern (5) if (ext1.contains("eleccio") && !ext1.contains("seleccio") && !ext1.contains("alcalde") && !ext1.contains("jutge") ) return new Integer[] { 245316, 269097}; //Eleccciones (7) if (ext1.contains("eleccio") && !ext1.contains("seleccio")) return new Integer[] { 245144, 269097}; //Eleccciones (7) if (ext1.contains("assist") && ext1.contains("jur")) return new Integer[] { 244652, 268418}; //Assistencia juridica=contracte menor (6) if (ext1.contains("indemni") && ext1.contains("membre")) return new Integer[] { 245157, 268925}; //Nomenaments (6) if (ext1.contains("diet")) return new Integer[] { 245157, 268940}; //Nomines indemnitzacions (6) if (ext1.contains("regula")) return new Integer[] { 245171, 268946}; //Normes entitats locals (5) if (ext1.contains("inform")) return new Integer[] { 245044, 268288}; //Informes (5) if (ext1.contains("certific")) return new Integer[] { 244808, 268586}; //Fe publica (5) if (ext1.contains("corporac")) return new Integer[] { 245144, 268925}; //Corporacio (5) if (ext1.contains("substituc")) return new Integer[] { 245478, 269255}; //Nombramiento accidental (5) if (ext1.contains("protec") && ext1.contains("dades")) return new Integer[] { 244914, 268500}; //Proteccion de datos () return new Integer[] { 245481, 269261}; //Solicitud documentos () } else if (seccio.trim().equalsIgnoreCase("A002")) { if (ext1.contains("certific") && ext1.contains("electr") ) return new Integer[] { 245271, 268260}; //Administracion electronica if (ext1.contains("certific") || ext1.contains("volant") ) return new Integer[] { 244808, 268586}; //Fe publica (5) if (ext1.contains("matrimoni") && ext1.contains("civil")) return new Integer[] { 245280, 269065}; //Matrimoni civil if (ext1.contains("padr") && ext1.contains("alt")) return new Integer[] { 245282, 269068}; //Padron altas () if (ext1.contains("baix")) return new Integer[] { 245283, 269070}; //Padron bajas () if (ext1.contains("padr") && ext1.contains("modif")) return new Integer[] { 245285, 269073}; //Padron modificacion () if (ext1.contains("mod") && ext1.contains("canv")) return new Integer[] { 245285, 269073}; //Padron modificacion () if (ext1.contains("variaci")) return new Integer[] { 245285, 269073}; //Padron modificacion () if (ext1.contains("renovaci")) return new Integer[] { 245281, 269072}; //Informacion padronal () if (ext1.contains("revisi")) return new Integer[] { 245281, 269072}; //Informacion padronal () if (ext1.contains("tauler")) return new Integer[] { 244758, 268528}; //Edictos(5) if (ext1.contains("justific")) return new Integer[] { 245425, 269202}; //Justificants ORVE(5) if (ext1.contains("material")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial (869) return new Integer[] { 245506,269296}; // Suministro informacion otros } else if (seccio.trim().equalsIgnoreCase("A003")) { if (ext1.contains("taxa")) return new Integer[] { 245028, 268910}; //Tasas if (ext1.contains("adquisi")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("renovac")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("contract")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("mantenim")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("subminist")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("servei")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("monit")) return new Integer[] { 244652, 268418}; //Contrato administrativo especial () if (ext1.contains("solicit")) return new Integer[] { 245481, 269261}; //Consultas solicitudes if (ext1.contains("actuac")) return new Integer[] { 244784, 269261}; //Equipamientos y rogramas planes if (ext1.contains("protec") && ext1.contains("dades")) return new Integer[] { 244914, 268500}; //Proteccion de datos () if (ext1.contains("inventar")) return new Integer[] { 245224, 268994}; //Inventari if (ext1.contains("ordenan")) return new Integer[] { 245171, 268946}; //Normes entitats locals (5) if (ext1.contains("ordenan")) return new Integer[] { 245171, 268946}; //Normes entitats locals (5) return new Integer[] { 245506, 269296}; // Suministro informacion otros } else if (seccio.trim().equalsIgnoreCase("A038")) { if (ext1.contains("subven")) return new Integer[] { 245323, 245323}; //Subvencions return new Integer[] { 245318, 269099}; // Promocio cultural } else if (seccio.trim().equalsIgnoreCase("B004")) { return new Integer[] { 245159, 268938}; // Nomines }else if (seccio.trim().equalsIgnoreCase("C008")) { if (ext1.contains("mercat") || ext1.contains("parada") || ext1.contains("venda")) return new Integer[] { 245136, 268914}; // Mercats if (ext1.contains("sanci") ) return new Integer[] { 244913, 269234}; // Sancio animals if (ext1.contains("perill") ) return new Integer[] { 245458, 269237}; // Animal perillos if (ext1.contains("gos") || ext1.contains("animal")) return new Integer[] { 245457, 269236}; // Animal if (ext1.contains("cement") || ext1.contains("difunt")) return new Integer[] { 244610, 268364}; // Cementeri difunts if (ext1.contains("adhesi") || ext1.contains("conveni")) return new Integer[] { 244985, 268505}; // Convenis if (ext1.contains("seguient") || ext1.contains("conveni")) return new Integer[] { 244732, 268496}; // Seguiment i control if (ext1.contains("servei")) return new Integer[] { 244669, 268441}; // Serveis if (ext1.contains("contracte") ) return new Integer[] { 244711, 268477}; // Contracte return new Integer[] { 244735, 268508}; // Otros } if (ext1.contains("iivtnu")) return new Integer[] { 244568, 268308}; //Plusvalues (1862) if ((ext1.contains(" obra") || ext1.contains("d'obra")) && ext1.contains("menor") ) return new Integer[] { 244973, 268742}; // Obres menors (895) if (ext1.contains(" gual ") || ext1.contains(" guals ")) return new Integer[] { 244597, 268339}; return idProc; } /** * Torna el id del node del departament el component 0 es en PRE i el 1 en PRODUCCIO o real * @param codiDep * @return */ public Integer[] getNodo(String codiDep) { Integer[] idNodo=new Integer[] {0,0}; switch (codiDep.toUpperCase().trim()) { case "A000" : idNodo=new Integer[] {16515,24198}; break; case "A001" : idNodo=new Integer[] {16516,23996}; break; case "A002" : idNodo=new Integer[] {16517,23998}; break; case "A003" : idNodo=new Integer[] {16553,23995}; break; case "A038" : idNodo=new Integer[] {16683,24168}; break; case "B004" : idNodo=new Integer[] {16685,24048}; break; case "B005" : idNodo=new Integer[] {16690,24053}; break; case "C008" : idNodo=new Integer[] {16554,23999}; break; case "D000" : idNodo=new Integer[] {16588,24169}; break; case "E062" : idNodo=new Integer[] {16520,23997}; break; case "E062_18": idNodo=new Integer[] {16518,24194}; break; case "E062_19": idNodo=new Integer[] {16519,24195}; break; case "F000" : idNodo=new Integer[] {16703,24181}; break; case "F012" : idNodo=new Integer[] {16711,24054}; break; case "F013" : idNodo=new Integer[] {16712,24180}; break; case "F014" : idNodo=new Integer[] {16713,24182}; break; case "G000" : idNodo=new Integer[] {16714,24116}; break; case "G007" : idNodo=new Integer[] {16726,24106}; break; case "G015" : idNodo=new Integer[] {16730,24199}; break; case "G016" : idNodo=new Integer[] {16731,24197}; break; case "G017" : idNodo=new Integer[] {16732,24196}; break; case "H000" : idNodo=new Integer[] {16733,24109}; break; case "I024" : idNodo=new Integer[] {16740,24024}; break; case "J025" : idNodo=new Integer[] {16755,24189}; break; case "J026" : idNodo=new Integer[] {16758,24187}; break; case "J035" : idNodo=new Integer[] {16760,24104}; break; case "K000" : idNodo=new Integer[] {16763,24127}; break; case "P065" : idNodo=new Integer[] {16765,24192}; break; default: } return idNodo; } public Object getPersonalidad(String cif, ClassLoader clsLoader, String pkg ) throws Exception { String pers=null; if (cif==null) throw new Exception("cif null!!!"); else { int a=CIFValidatorEdu.getPersonalidad(cif); if (a==0) pers= "FisicaNIF"; else if (a==1) pers= "ExtranjeroNIE"; else if (a==2) pers= "JuridicaCIF"; //else if (SedipualbaUtils.isGoodPassport(cif)) pers= "Pasaporte"; else if (CIFValidatorEdu.isPassport(cif)) pers= "Pasaporte"; else throw new Exception("cif invalido!!!"); } return ReflectionBasic.createEnum(clsLoader,pkg+ "."+ "TipoPersonalidad",pers); // OJO: "PASAPORTE" NO VA } public Object getTipoTelf(String telf, ClassLoader clsLoader, String pkg ) throws Exception { String tTelf=null; if (telf==null) return null; String a=telf.substring(0,1); if (a.compareToIgnoreCase("0")>=0 && a.compareToIgnoreCase("9")<0) tTelf="Movil"; else tTelf="Fijo"; return ReflectionBasic.createEnum(clsLoader,pkg+ "."+ "TipoTelefono",tTelf); // OJO: "FIJO" NO VA } public Object getTelf(String telf, boolean predeterminado, ClassLoader clsLoader, String pkg) throws Exception { String[] fieldNamesTelf={"nTelefono","tipo","predeterminado", "excluido"}; //Object[] fieldValuesTelf={telf, getTipoTelf(telf, clsLoader, pkg) ,predeterminado , false }; Object[] fieldValuesTelf={telf, getTipoTelf(telf, clsLoader, pkg) ,false , false }; return ReflectionBasic.createObject(clsLoader, pkg+ "."+"TelefonoEditViewModel", fieldNamesTelf, fieldValuesTelf, false, null); } public Object getTelfs(Object[] telfs, ClassLoader clsLoader, String pkg) throws Exception { List<Object> lTelfs=new ArrayList<Object>(); int i=0; for (Object telf: telfs) { if (telf!=null) { if(telf.toString().trim().length()>6) lTelfs.add(getTelf(telf.toString(), (i==0), clsLoader, pkg)); i++; } } if (lTelfs.size()>0) return ReflectionBasic.createArrayOfObject(clsLoader, pkg+ "."+"ArrayOfTelefonoEditViewModel", "getTelefonoEditViewModel", lTelfs.toArray()); else return null; } public Object getDireccion(Object[] reg, ClassLoader clsLoader, String pkg) throws Exception { String direccion=""; if (reg[7]!=null && reg[8]!=null) { if (reg[7].toString().trim().length()>0 && reg[8].toString().trim().length()>0) direccion=reg[ 7].toString().trim()+ " " + reg[ 8].toString().trim(); } if (direccion.length()<5) direccion=reg[12].toString().trim(); String[] fieldNamesDomi={ "codPais" ,"codPostal" ,"municipioDescripcion", "paisDescripcion" ,"provinciaDescripcion" ,"direccion", "escPisPue" ,"numVia" ,"observaciones", "excluido"}; String numvia=""; if (reg[ 9]!=null) numvia=reg[ 9].toString().trim(); Object[] fieldValuesDomi={ //"661086" ,reg[13].toString() ,reg[15].toString(), "661086" ,arreglarCP(reg[13]) ,arreglarPoble(reg), "ESPA�'A" ,provincias[-1+Integer.parseInt(reg[14].toString().trim())] ,direccion, reg[10].toString(),numvia ,reg[16].toString(), false }; return ReflectionBasic.createObject(clsLoader, pkg+ "."+ "DomCiudadanoEditExternoModel", fieldNamesDomi, fieldValuesDomi, false, null); } public Object getDireccions(Object[] reg, ClassLoader clsLoader, String pkg) throws Exception { return ReflectionBasic.createArrayOfObject(clsLoader, pkg+ "."+"ArrayOfDomCiudadanoEditExternoModel", "getDomCiudadanoEditExternoModel", getDireccion(reg, clsLoader, pkg)); } public static Object getEmail(Object email, boolean predeterminado, ClassLoader clsLoader, String pkg) throws Exception { String[] fieldNamesEmail={"email","predeterminado", "excluido"}; Object[] fieldValuesEmail={email.toString(), predeterminado , false }; return ReflectionBasic.createObject(clsLoader, pkg+ "."+ "CorreoElectronicoEditViewModel", fieldNamesEmail, fieldValuesEmail, false, null); } public static Object getEmails(Object[] emails, ClassLoader clsLoader, String pkg) throws Exception { List<Object>lEmails=new ArrayList<Object>(); int i=0; for (Object email: emails) { if (email!=null) { if (email.toString().trim().length()>3) lEmails.add(getEmail(email, (i==0), clsLoader, pkg)); i++; } } if (lEmails.size()>0) return ReflectionBasic.createArrayOfObject(clsLoader, pkg+ "."+"ArrayOfCorreoElectronicoEditViewModel", "getCorreoElectronicoEditViewModel", lEmails.toArray()); else return null; } public XMLGregorianCalendar getGregCal(Object obj) throws Exception { if (obj==null) return null; if (obj.toString().trim().length()<10) return null; else { DateFormat format = new SimpleDateFormat("dd-MM-yyyy"); Date date = format.parse(obj.toString().trim()); GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar xmlGregCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); return xmlGregCal; } } public static String arreglarCP(Object cp) { String cp1=cp.toString().trim(); int le=cp1.length(); if (le>5) cp1=cp1.substring(le-5); else { for (int i=0; i<5-le; i++) cp1="0"+cp1; } return cp1; } public static String arreglarPoble(Object[] obs) { String cp=obs[13].toString().trim(); cp= arreglarCP(cp); String poble=obs[15].toString().trim(); switch(cp) { case "01015": poble="Vitoria-Gasteiz";break; case "02520": poble="Chinchilla de Monte-Aragón";break; case "02693": poble="Corral-Rubio";break; case "02610": poble="BONILLO (EL)";break;//Bonillo, El" case "03000": case "03003": case "03005": case "03007": poble="Alicante/Alacant";break; case "03110": poble="Mutxamel";break; case "03530": poble="NUCIA (LA)";break;//"Nucia, la" case "03690": poble="San Vicente del Raspeig/Sant Vicent del Raspeig";break; case "03699": poble="Alicante/Alacant";break; case "03700": case "03709": poble="Dénia";break; case "05003": poble="Ávila";break; case "05270": poble="Tiemblo, El";break; case "07002": case "07015": poble="Palma";break; case "07150": poble="Andratx";break; case "07814": poble="Santa Eulària des Riu";break; case "08190": poble="Sant Cugat del Vallés";break; case "08820": poble="PRAT DE LLOBREGAT (EL)";break;//Prat de Llobregat, El case "08980": poble="Sant Feliu de Llobregat";break; case "12001": case "12100": poble="Castelló de la Plana";break; case "12540": poble="Vila-real";break; case "12579": poble="Alcalà de Xivert";break; case "12600": poble="VALL D'UIX�" (LA)";break;//Vall d'Uixó, la" case "13170": poble="Miguelturra";break; case "13670": poble="Villarrubia de los Ojos";break; case "13680": poble="Fuente el Fresno";break; case "15007": poble="CORU�'A (A)";break;//"Coruña, A" case "15940": poble="POBRA DO CARAMI�'AL (A)";break;// case "16620": poble="ALBERCA DE ZÁNCARA (LA)";break;//Alberca de Záncara, La" case "16720": poble="Cañada Juncosa";break; case "16770": poble="San Lorenzo de la Parrilla";break; case "18212": poble="Güevéjar";break; case "19174": poble="Galápagos";break; case "19161": poble="Pozo de Guadalajara";break; case "19170": poble="CASAR (EL)";break;//"Casar, El" case "19463": poble="Poveda de la Sierra";break; case "20004": case "20071": poble="Donostia/San Sebastián";break; case "20110": poble="Pasaia";break; case "23350": poble="Puente de Génave";break; case "24280": poble="Benavides"; break; case "28028": case "28044": case "28080": poble="Madrid"; break; case "28109": poble="Alcobendas"; break; case "28150": poble="Valdetorres de Jarama"; break; case "28224": poble="Pozuelo de Alarcón";break; case "28229": poble="Villanueva del Pardillo";break; case "28230": case "28231": case "28232": case "28280": case "28290": poble="ROZAS DE MADRID (LAS)";break;//"Rozas de Madrid, Las" case "28292": poble="Escorial, El";break; case "28300": poble="Aranjuez";break; case "28400": poble="Collado Villalba";break; case "28412": case "28413": poble="BOALO (EL)";break;//"Boalo, El" case "28420": poble="Galapagar";break; case "28430": poble="Alpedrete";break; case "28500": poble="Arganda del Rey";break; case "28514": poble="Villar del Olmo";break; case "28521": case "28522": case "28529": poble="Rivas-Vaciamadrid";break; case "28607": poble="ÁLAMO (EL)";break;//"Álamo, El" case "28630": poble="Villa del Prado";break; case "28680": poble="San Martín de Valdeiglesias";break; case "28700": case "28701": case "28702": case "28703": case "28706": poble="San Sebastián de los Reyes";break; case "28722": poble="Vellón, El";break; case "28810": poble="Villalbilla";break; case "28816": poble="Valdeavero";break; case "28817": poble="SANTOS DE LA HUMOSA (LOS)";break;//"Santos de la Humosa, Los" case "28830": poble="San Fernando de Henares";break; case "28840": poble="Mejorada del Campo";break; case "28860": case "28861": case "28862": case "28863": poble="Paracuellos de Jarama";break; case "28931": poble="Móstoles";break; case "28950": poble="Moraleja de Enmedio";break; case "30150": case "30153": poble="Murcia";break; case "31014": poble="Pamplona/Iruña";break; case "33612": poble="Mieres";break; case "37184": poble="Monterrubio de Armuña";break; case "40100": poble="Real Sitio de San Ildefonso";break; case "40400": poble="ESPINAR (EL)";break;//"Espinar, El" case "40250": poble="Mozoncillo";break; case "40590": poble="Casla";break; case "41439": poble="Cañada Rosal";break; case "45123": poble="Seseña";break; case "45215": poble="VISO DE SAN JUAN (EL)";break;//"Viso de San Juan, El" case "45223": poble="Seseña";break; case "45216": poble="Carranque";break; case "45500": poble="Torrijos";break; case "45520": poble="Villaluenga de la Sagra";break; case "45534": poble="MATA (LA)";break;//"Mata, La" case "45570": poble="PUENTE DEL ARZOBISPO (EL)";break;//"Puente del Arzobispo, El" case "45680": poble="Cebolla";break; //case "46015": poble="Beniferri";break; case "46015": poble="VALÈNCIA";break;//Valencia case "46059": poble="Benifairó de la Valldigna";break; case "46120": poble="Alboraia/Alboraya";break; case "46131": poble="Bonrepòs i Mirambell";break; case "46182": poble="Paterna";break; case "46183": poble="ELIANA (L')";break;//"Eliana, l'" case "46190": poble="Riba-roja de Túria";break; case "46192": poble="Montserrat";break; case "46250": poble="ALCÚDIA (L')";break;//"Alcúdia, l'" case "46419": poble="Sueca";break; case "46670": poble="Pobla Llarga, la";break; case "46690": poble="ALCÚDIA DE CRESPINS (L')";break;//"Alcúdia de Crespins, l'";break; case "46700": poble="Gandia";break; case "46711": poble="Guardamar de la Safor";break; case "46715": poble="Alqueria de la Comtessa, l'";break; case "46717": poble="FONT D'EN CARR�'S (LA)";break; //"La Font d'En Carròs"; case "46730": poble="Gandia";break; case "46792": poble="Alzira";break; case "46800": poble="Xàtiva";break; case "46815": poble="LLOSA DE RANES (LA)";break;//"Llosa de Ranes, la"; case "46842": poble="MONTITXELVO/MONTICHELVO";break;//"Montixelvo" case "46840": poble="POBLA DEL DUC (LA)";break;//"Pobla del Duc, la" case "46850": poble="OLLERIA (L')";break;//"Olleria, l'" case "46910": poble="Alfafar";break; case "49410": poble="Fuentelapeña";break; default: } return poble; } public Map<String,Object> getCiudadano (Object[] reg, ClassLoader clsLoader, String pkg) throws Exception { boolean separarNom=false; if (reg[2]==null) separarNom=true; else if (reg[2].toString().trim().length()==0) separarNom=true; Map<String,Object>hmapCiudadano=new HashMap<String,Object>(); if (separarNom) { String[] ss= separaNom(reg [ 6]); hmapCiudadano.put("nombre" , ss [ 0] ); hmapCiudadano.put("apellido1" , ss [ 1] ); hmapCiudadano.put("apellido2" , ss [ 2] ); hmapCiudadano.put("apellidoNombre" , reg [ 6] ); }else { hmapCiudadano.put("nombre" , reg [ 2] ); hmapCiudadano.put("apellido1" , reg [ 3] ); hmapCiudadano.put("apellido2" , reg [ 4] ); hmapCiudadano.put("apellidoNombre" , combinaNom(reg [ 2],reg [ 3],reg [ 4]) ); } hmapCiudadano.put("nif" , reg [ 0] ); hmapCiudadano.put("domCiudadanoPrincipalId" , null ); hmapCiudadano.put("personalidad" , getPersonalidad(reg [ 0].toString(), clsLoader, pkg) ); hmapCiudadano.put("observaciones" , reg[16].toString() ); //hmapCiudadano.put("procedenciaId" , "0" ); // De "ListarProcedencias" hay una con id="0" pre hmapCiudadano.put("procedenciaId" , "INI-MIGRA" ); // De "ListarProcedencias" hay una con id="INI-MIGRA" pro hmapCiudadano.put("notElectronica" , false ); hmapCiudadano.put("idiomaComunicaciones" , "Castellano" ); hmapCiudadano.put("fechaNacimiento" , getGregCal(reg[ 5]) ); hmapCiudadano.put("correosElectronicos" , getEmails(ArrayUtils.subarray(reg, 21, 23 + 1), clsLoader, pkg)); hmapCiudadano.put("direccionesElectronicas" , null ); hmapCiudadano.put("telefonos" , getTelfs (ArrayUtils.subarray(reg, 18, 20 + 1), clsLoader, pkg)); hmapCiudadano.put("domicilios" , getDireccions(reg, clsLoader, pkg) ); hmapCiudadano.put("representantes" , null ); return hmapCiudadano; } public String[] separaNom(Object nomComp) { String[] particulas= {"DE", "DEL","LA","EL","LAS","LOS","AL"}; if (nomComp==null) return null; String ss=nomComp.toString(); String[] aS = ss.split("\\s+"); List<String>lS=new ArrayList<String>(); String s1=""; for (String s2:aS) { s1=s1+" " + s2; if (!Arrays.asList(particulas).contains(s2.toUpperCase()) && s2.length()>1) { lS.add(s1.trim()); s1=""; } } String[] ssss=lS.toArray(new String[0]); String[] ss1=new String[3]; if (ssss.length==1) ss1[1]=ssss[0]; if (ssss.length==2) { ss1[1]=ssss[0]; //ape1 ss1[0]=ssss[1]; //nom } if (ssss.length==3) { ss1[1]=ssss[0]; //ape1 ss1[2]=ssss[1]; //ape2 ss1[0]=ssss[2]; //nom } if (ssss.length>3) { ss1[1]=ssss[0]; //ape1 ss1[2]=ssss[1]; //ape2 ss1[0]=ssss[2]; //nom for (int i=3; i<ssss.length; i++) { ss1[0]=ss1[0]+" " + ssss[i]; //afegim lo que sobra al nom } } return ss1; } public String combinaNom(Object nom, Object ap1, Object ap2) { String nomComp=""; if (ap1!=null) nomComp=(nomComp+ " " + ap1.toString().trim()).trim(); if (ap2!=null) nomComp=(nomComp+ " " + ap2.toString().trim()).trim(); if (nom!=null) nomComp=(nomComp+ " " + nom.toString().trim()).trim(); return nomComp; } public String[] provincias= { "ARABA/ALAVA", "ALBACETE", "ALICANTE", "ALMERIA", "AVILA", "BADAJOZ", "I. BALEARS", "BARCELONA", "BURGOS", "CACERES", "CADIZ", "CASTELLON", "CIUDAD REAL", "CORDOBA", "A CORU�'A", "CUENCA", "GIRONA", "GRANADA", "GUADALAJARA", "GIPUZKOA", "HUELVA", "HUESCA", "JAEN", "LEON", "LLEIDA", "LA RIOJA", "LUGO", "MADRID", "MALAGA", "MURCIA", "NAVARRA", "OURENSE", "ASTURIAS", "PALENCIA", "LAS PALMAS", "PONTEVEDRA", "SALAMANCA", "S.C.TENERIFE", "CANTABRIA", "SEGOVIA", "SEVILLA", "SORIA", "TARRAGONA", "TERUEL", "TOLEDO", "VALENCIA", "VALLADOLID", "BIZKAIA", "ZAMORA", "ZARAGOZA", "CEUTA", "MELILLA"}; /********************************************************************************************* * 0. SEFICU * *******************************************************************************************/ public WsOutput NuevoFirmanteServidor(int idDoc, String nomFirmante, String textoFirma) throws Exception { String operation = "NuevoFirmanteServidor"; String simpleClassName = operation; String myKey="sefycu"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "pkDocuFirma", "descripcion", "textoFirma" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idDoc, nomFirmante, textoFirma }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false , null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerDocuFirmaIDPorCSV(String csv) throws Exception { String operation = "ObtenerDocuFirmaIDPorCSV"; String simpleClassName = operation; String myKey="sefycu"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "csv" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, csv }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerDocuFirmaInfoV2(int idDocuFirma) throws Exception { String operation = "ObtenerDocuFirmaInfoV2"; String simpleClassName = operation; String myKey="sefycu"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "idDocuFirma" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idDocuFirma }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 1. SEGRA * *******************************************************************************************/ public WsOutput ObtenerPropuestaIDPorCSV(String csv) throws Exception { String operation = "ObtenerPropuestaIDPorCSV"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "csv" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, csv }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerPropuestaInfoV2(int pkPropuesta) throws Exception { String operation = "ObtenerPropuestaInfoV2"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "pkPropuesta" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, pkPropuesta }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NuevaPropuestaV2(String nifUsuario, int idNodoContenedor,String descripcion, String formato, boolean mostrarNotificadosAFirmantes, String referenciaInterna1, String referenciaInterna2) throws Exception { String operation = "NuevaPropuestaV2"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "pkEntidad", "nifUsuario", "idNodoContenedor", "descripcion", "formato","mostrarNotificadosAFirmantes","referenciaInterna1","referenciaInterna2" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, nifUsuario, idNodoContenedor, descripcion, formato, mostrarNotificadosAFirmantes, referenciaInterna1, referenciaInterna2}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput SetPropuestaPdfBase64(int pkPropuesta, String b64) throws Exception { String operation = "SetPropuestaPdfBase64"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "pkPropuesta", "b64"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad,pkPropuesta , b64}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NuevoAnexoBase64(int pkPropuesta, String b64, String extension,String descripcion, boolean notificar) throws Exception { String operation = "NuevoAnexoBase64"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "pkPropuesta", "b64", "extension","descripcion", "notificar" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, pkPropuesta , b64, extension, descripcion, notificar}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput SetPresidenteV2(int idPropuesta, int idRolEntidad) throws Exception { String operation = "SetPresidenteV2"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "idPropuesta", "idRolEntidad"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idPropuesta, idRolEntidad}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput EnviarPropuestaAFirmar(int pkPropuesta) throws Exception { String operation = "EnviarPropuestaAFirmar"; String simpleClassName = operation; String myKey="segra"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "pkPropuesta"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, pkPropuesta}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 2. SEGEX * *******************************************************************************************/ public WsOutput ListarCarpetas(String codExpedient) throws Exception { String operation = "ListarCarpetas"; String simpleClassName = operation; String myKey="segex"; String outputField="carpetaItem"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff int pkCarpetaPadre= -1; // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente","pkCarpetaPadre" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpedient, pkCarpetaPadre }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListarDocumentos(String codExpedient) throws Exception { String operation = "ListarDocumentos"; String simpleClassName = operation; String myKey="segex"; String outputField="documentoItem"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff int pkCarpetaPadre= -1; // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente","pkCarpetaPadre" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpedient, pkCarpetaPadre }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListMaterias() throws Exception { String operation = "ListMaterias"; String simpleClassName = operation; String myKey="segex"; String outputField="materiaInfo"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff int pkCarpetaPadre= -1; // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "idEntidad" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListSubmaterias(String idMateria) throws Exception { String operation = "ListSubmaterias"; String simpleClassName = operation; String myKey="segex"; String outputField="submateriaInfo"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "idEntidad", "idMateria" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idMateria }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListTiposProcedimiento(String idSubmateria) throws Exception { String operation = "ListTiposProcedimiento"; String simpleClassName = operation; String myKey="segex"; String outputField="tipoProcedimientoInfo"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "idEntidad", "idSubmateria" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idSubmateria }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListSubtiposProcedimiento(int idProcedimiento) throws Exception { String operation = "ListSubtiposProcedimiento"; String simpleClassName = operation; String myKey="segex"; String outputField="subtipoProcedimientoInfo"; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "idEntidad", "idProcedimiento" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idProcedimiento }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NuevoExpedienteV3(String claseExp, String extracto, String codigoExp, String codSeccio, String nifUsuario, Integer idProcedimiento, Integer idNodoAyto) throws Exception { String operation = "NuevoExpedienteV3"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff int pre_pro=(this.appKeyOpt[2]=="demo") ? 0 : 1; //Demo=0, prod=1 int idProc=0; if (idProcedimiento==null) idProc = getProcedimiento(extracto, codSeccio)[pre_pro]; else idProc=idProcedimiento; int idNodo=0; if (idNodoAyto==null) idNodo = getNodo(codSeccio)[pre_pro]; else idNodo=idNodoAyto; // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "idSubtipoProcedimiento", "idClase","descripcion","referenciaInterna","nifUsuario","idNodoContenedor"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, idProc, claseExp, extracto, codigoExp, nifUsuario, idNodo}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NuevoInteresado(String codExpAlba, String nifInte, boolean isSolicitante) throws Exception { String operation = "NuevoInteresado"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff //int pre_pro=(this.appKeyOpt[2]=="demo") ? 0 : 1; //Demo=0, prod=1 Object[] obCiu = GetCiudadanoByDocumentoNou(nifInte); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "codCiud", "codCiudRep", "notificacionElectronica", "domicilio", "telefonoMovil", "email", "esSolicitante", "nifUsuario",}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, obCiu[0], -1, obCiu[2], obCiu[3], obCiu[4], obCiu[5], isSolicitante, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput AñadirDocSegraAExpedientePorId(String codExpAlba, int idSegra, String descripcion, int pkCarpeta, boolean accesoInteresados) throws Exception { String operation = "AñadirDocSegraAExpedientePorId"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "id", "descripcion", "pkCarpeta", "accesoInteresados", "nifUsuario"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, idSegra, descripcion, pkCarpeta, accesoInteresados, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput AñadirDocAExpedientePorCSV(String codExpAlba, String csv, String descripcion, int pkCarpeta, String fkTipoenidocumento, String fkEstadoelaboracion, boolean origenAdministracion, boolean accesoInteresados) throws Exception { String operation = "AñadirDocAExpedientePorCSV"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "csv", "descripcion", "pkCarpeta", "fkTipoenidocumento", "fkEstadoelaboracion", "origenAdministracion", "accesoInteresados", "nifUsuario"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, csv, descripcion, pkCarpeta, fkTipoenidocumento, fkEstadoelaboracion, origenAdministracion, accesoInteresados, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput AnadirDocAExpedientePorContenidoB64(String codExpAlba, String contenidoB64, String extension, String descripcion, int pkCarpeta, String fkTipoenidocumento, String fkEstadoelaboracion, boolean origenAdministracion, boolean accesoInteresados) throws Exception { String operation = "AñadirDocAExpedientePorContenidoB64"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "contenidoB64", "extension", "descripcion", "pkCarpeta", "fkTipoenidocumento", "fkEstadoelaboracion", "origenAdministracion", "accesoInteresados", "nifUsuario"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, contenidoB64, extension, descripcion, pkCarpeta, fkTipoenidocumento, fkEstadoelaboracion, origenAdministracion, accesoInteresados, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput AnadirDocAExpedientePorContenidoB64(String codExpAlba, String csv, String descripcion, int pkCarpeta, String fkTipoenidocumento, String fkEstadoelaboracion, boolean origenAdministracion, boolean accesoInteresados) throws Exception { String operation = "AñadirDocAExpedientePorCSV"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "csv", "descripcion", "pkCarpeta", "fkTipoenidocumento", "fkEstadoelaboracion", "origenAdministracion", "accesoInteresados", "nifUsuario"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, csv, descripcion, pkCarpeta, fkTipoenidocumento, fkEstadoelaboracion, origenAdministracion, accesoInteresados, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NuevaCarpeta(String codExpAlba, String descripcion) throws Exception { String operation = "NuevaCarpeta"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "descripcion", "nifUsuario"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpAlba, descripcion, this.nif}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerInfoDocumento( int pkDocumento) throws Exception { String operation = "ObtenerInfoDocumento"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "pkDocumento"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, pkDocumento,}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerInfoDocumentoConCsv( String csv, String codExpedient) throws Exception { String operation = "ObtenerInfoDocumentoConCsv"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "csv" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpedient, csv }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerUrlDocumento(int pkDocumento, String tipoUrl) throws Exception { String operation = "ObtenerUrlDocumento"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "pkDocumento", "tipoUrl" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, pkDocumento, tipoUrl }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerUrlExpedienteSinProcedimientoComoUsuarioSegexConCertificado(String codigoExpediente) throws Exception { String operation = "ObtenerUrlExpedienteSinProcedimientoComoUsuarioSegexConCertificado"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente", "pkServicio", "pkMateria", "pkTipo", "pkSubtipo", "pkClase" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codigoExpediente, null, null, null, null, null}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ObtenerInfoExpedienteV2( String codExpedient) throws Exception { String operation = "ObtenerInfoExpedienteV2"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "pkEntidad", "codigoExpediente" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpedient }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListarInteresadosExpediente( String codExpedient) throws Exception { String operation = "ListarInteresadosExpediente"; String simpleClassName = operation; String myKey="segex"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPass", "idEntidad", "codigoExpediente" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, codExpedient }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 3. SERES_REGISTRO * *******************************************************************************************/ public WsOutput ListDestinosEntidad() throws Exception { String operation = "ListDestinosEntidad"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput GetRegistroEntrada(int any, int numReg) throws Exception { String operation = "GetRegistroEntrada"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "ejercicio", "numeroRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, any, numReg}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput GetRegistroSalida(int any, int numReg) throws Exception { String operation = "GetRegistroSalida"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "ejercicio", "numeroRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, any, numReg}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NewRegistroEntradaProva() throws Exception { String operation = "NewRegistroEntrada"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); /** Schema: NewRegistroEntrada |-> nuevoRegistro |->tipoRegistro |->destinos |->idRemitentes |->anexos |->anexo |->tipoformato |->tipoDocAnexo |->tipoValidez */ // 3. Get complex fields of the class. // 3.1 TipoRegistro Object tReg = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoRegistro", "E"); // 3.2 idsRemitentes Object idRemitentes = ReflectionBasic.createArrayOfInt(clsLoader, pkg + ".ArrayOfInt", 12570609, 12570373); // 3.3 destinos Object destinos = ReflectionBasic.createArrayOfInt(clsLoader, pkg + ".ArrayOfInt", 16515, 16517); // Secretasria ? // 3.4 TipoAnexo Object tAnexo = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoAnexo", "Adjunto"); // 3.5 TipoValidez Object tValidez = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoValidez", "SinValidez"); // 3.6 TipoFormato anexo Object tFormato = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoFormatoAnexo", "Contenido"); // 3.7 Anexo 1 //byte[] contenido = Base64.getEncoder().encode("Prova Annex Edu".getBytes()); byte[] contenido = "Prova Annex Edu".getBytes(); // No fa falta pasar-ho a base 64. Ho fa ell String descripcion = "descripcio de prova_edu.txt"; String extension = "txt"; String estadoElaboracionEni = "EE99"; String tipoDocumentalEni = "TD99"; String identificadorEni = "ES_A47777777_1900_TATIA"; String idioma = "es"; String[] fieldNameAnexo = { "tipoFormato", "contenido", "descripcion", "extension", "tipoDocAnexo", "tipoValidez", "estadoElaboracionEni", "tipoDocumentalEni", "identificadorEni", "idioma" }; Object[] fieldValueAnexo = { tFormato, contenido, descripcion, extension, tAnexo, tValidez, estadoElaboracionEni, tipoDocumentalEni, identificadorEni, idioma }; Object anexo = ReflectionBasic.createObject(clsLoader, pkg + ".AnexoNewRegistroDto", fieldNameAnexo, fieldValueAnexo, false, null); //====== ANEXO NOOOOO URL ==== //Object tFormato1 = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoFormatoAnexo", "Url"); Object tFormato1 = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoFormatoAnexo", "Contenido"); // 3.7 Anexo 2 //String url1="https://sede.administracionespublicas.gob.es/valida/validar/servicio_csv_id/10/hash_firma_formularioweb/ORVE-0999f6b991627bc31b77a5998fb78245"; //byte[] inFileBytes = Files.readAllBytes(Paths.get("/home/eduard/kk/3.pdf")); //byte[] contenido1 = Base64.getEncoder().encode(inFileBytes); //NO VOL QUE EL PDF EL CONVERTIM A BASE64!!!! byte[] contenido1 = Files.readAllBytes(Paths.get("/home/eduard/kk/3.pdf")); String descripcion1 = "3.pdf"; String extension1 = "pdf"; String estadoElaboracionEni1 = "EE99"; String tipoDocumentalEni1 = "TD99"; String identificadorEni1 = "ES_A47777777_1900_TATIA1"; String idioma1 = "es"; //String[] fieldNameAnexo1 = { "tipoFormato", "url", "descripcion", "extension", "tipoDocAnexo", String[] fieldNameAnexo1 = { "tipoFormato", "contenido", "descripcion", "extension", "tipoDocAnexo", "tipoValidez", "estadoElaboracionEni", "tipoDocumentalEni", "identificadorEni", "idioma" }; //Object[] fieldValueAnexo1 = { tFormato1, url1, descripcion1, extension1, tAnexo, tValidez, Object[] fieldValueAnexo1 = { tFormato1, contenido1, descripcion1, extension1, tAnexo, tValidez, estadoElaboracionEni1, tipoDocumentalEni1, identificadorEni1, idioma1 }; Object anexo1 = ReflectionBasic.createObject(clsLoader, pkg + ".AnexoNewRegistroDto", fieldNameAnexo1, fieldValueAnexo1, false, null); // 3.7 Anexo 2 contenido = Base64.getEncoder().encode("Prova Annex Edu2".getBytes()); //contenido = "Prova Annex Edu".getBytes(); // No fa falta pasar-ho a base 64. Ho fa ell descripcion = "descripcio de prova_edu2.txt"; extension = "txt"; estadoElaboracionEni = "EE99"; tipoDocumentalEni = "TD99"; identificadorEni = "ES_A47777777_1900_TATIA2"; idioma = "es"; String[] fieldNameAnexo2 = { "tipoFormato", "contenido", "descripcion", "extension", "tipoDocAnexo", "tipoValidez", "estadoElaboracionEni", "tipoDocumentalEni", "identificadorEni", "idioma" }; Object[] fieldValueAnexo2 = { tFormato, contenido, descripcion, extension, tAnexo, tValidez, estadoElaboracionEni, tipoDocumentalEni, identificadorEni, idioma }; Object anexo2 = ReflectionBasic.createObject(clsLoader, pkg + ".AnexoNewRegistroDto", fieldNameAnexo2, fieldValueAnexo2, false, null); // 3.6 Array Anexos //String[] fieldNameAAnexos = {}; //Object[] fieldValueAAnexos = {}; Object arrAnexos = ReflectionBasic.createArrayOfObject(clsLoader, pkg + ".ArrayOfAnexoNewRegistroDto", "getAnexoNewRegistroDto", anexo, anexo1, anexo2); // Secretaria ? // 3.7 newReg GregorianCalendar ahora = new GregorianCalendar(TimeZone.getTimeZone("GMT")); XMLGregorianCalendar fecha = DatatypeFactory.newInstance().newXMLGregorianCalendar(ahora); String resumen = "Prova enregistrar Eixida EDU"; String paisProcedencia = "108"; String provinciaProcedencia = "VALENCIA"; String municipioProcedencia = "TAVERNES DE LA VALLDIGNA"; String descripcionAdicionalProcedencia = "NO RES DE BO"; idioma="es"; int oficina = 561; String fieldNameNewReg[] = { "tipo", "fechaDocumento", "fechaValidezOrigen", "idsRemitentes", "resumen", "paisProcedencia", "provinciaProcedencia", "municipioProcedencia", "descripcionAdicionalProcedencia", "destinos", "anexos", "idioma", "oficina" }; Object fieldValueNewReg[] = { tReg, fecha, fecha, idRemitentes, resumen, paisProcedencia, provinciaProcedencia, municipioProcedencia, descripcionAdicionalProcedencia, destinos, arrAnexos, idioma, oficina }; Object newReg = ReflectionBasic.createObject(clsLoader, pkg + ".NewRegistroDto", fieldNameNewReg, fieldValueNewReg, false, null); // 4. Get the Main object String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador", "nuevoRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, newReg}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NewRegistroEntrada(Object registro) throws Exception { String operation = "NewRegistroEntrada"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador", "nuevoRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, registro}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NewRegistroSalidaProva() throws Exception { String operation = "NewRegistroSalida"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); /** Schema: NewRegistroEntrada |-> nuevoRegistro |->tipoRegistro |->destinos |->idRemitentes |->anexos |->anexo |->tipoformato |->tipoDocAnexo |->tipoValidez */ // 3. Get complex fields of the class. // 3.1 TipoRegistro Object tReg = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoRegistro", "S"); // 3.2 idsRemitentes Object idRemitentes = ReflectionBasic.createArrayOfInt(clsLoader, pkg + ".ArrayOfInt", 12570609, 12570373); // Edu // i // e // Cesar // 3.3 destinos Object destinos = ReflectionBasic.createArrayOfInt(clsLoader, pkg + ".ArrayOfInt", 16515); // Secretasria ? // 3.4 TipoAnexo Object tAnexo = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoAnexo", "Adjunto"); // 3.5 TipoValidez Object tValidez = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoValidez", "SinValidez"); // 3.6 TipoFormato anexo Object tFormato = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoFormatoAnexo", "Contenido"); // 3.7 Anexo byte[] contenido = "Prova Annex Edu".getBytes(); String descripcion = "descripcio de prova_edu.txt"; String extension = "txt"; String estadoElaboracionEni = "EE99"; String tipoDocumentalEni = "TD99"; String identificadorEni = "ES_A47777777_1900_TATIA"; String idioma = "Castellano"; String[] fieldNameAnexo = { "tipoFormato", "contenido", "descripcion", "extension", "tipoDocAnexo", "tipoValidez", "estadoElaboracionEni", "tipoDocumentalEni", "identificadorEni", "idioma" }; Object[] fieldValueAnexo = { tFormato, contenido, descripcion, extension, tAnexo, tValidez, estadoElaboracionEni, tipoDocumentalEni, identificadorEni, idioma }; Object anexo = ReflectionBasic.createObject(clsLoader, pkg + ".AnexoNewRegistroDto", fieldNameAnexo, fieldValueAnexo, false, null); // 3.6 Array Anexos Object arrAnexos = ReflectionBasic.createArrayOfObject(clsLoader, pkg + ".ArrayOfAnexoNewRegistroDto", "getAnexoNewRegistroDto", anexo); // Secretasria ? // 3.7 newReg GregorianCalendar ahora = new GregorianCalendar(TimeZone.getTimeZone("GMT")); XMLGregorianCalendar fecha = DatatypeFactory.newInstance().newXMLGregorianCalendar(ahora); String resumen = "Prova enregistrar Eixida EDU"; String paisProcedencia = "108"; String provinciaProcedencia = "VALENCIA"; String municipioProcedencia = "TAVERNES DE LA VALLDIGNA"; String descripcionAdicionalProcedencia = "NO RES DE BO"; // String idioma="Castellano"; int oficina = 561; String fieldNameNewReg[] = { "tipo", "fechaDocumento", "fechaValidezOrigen", "idsRemitentes", "resumen", "paisProcedencia", "provinciaProcedencia", "municipioProcedencia", "descripcionAdicionalProcedencia", "destinos", "anexos", "idioma", "oficina" }; Object fieldValueNewReg[] = { tReg, fecha, fecha, idRemitentes, resumen, paisProcedencia, provinciaProcedencia, municipioProcedencia, descripcionAdicionalProcedencia, destinos, arrAnexos, idioma, oficina }; Object newReg = ReflectionBasic.createObject(clsLoader, pkg + ".NewRegistroDto", fieldNameNewReg, fieldValueNewReg, false, null); // 4. Get the Main object String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador", "nuevoRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, newReg}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NewPendienteDeRegistro(Object registro) throws Exception { String operation = "NewPendienteDeRegistro"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador", "nuevoRegistro" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, registro}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListRegistrosEntrada(String filtro, int ejercicio) throws Exception { String operation = "ListRegistrosEntrada"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "filtro","ejercicio" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, filtro, ejercicio}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput FilterRegistrosEntrada(String[] filtroCamps, String[] filtroValors, boolean orden, int pagina) throws Exception { String operation = "FilterRegistrosEntrada"; String simpleClassName = operation; String myKey="seres_registro"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class List<Object> lstobj=new ArrayList<Object>(); for (int i=0; i<filtroCamps.length; i++) { switch (filtroCamps[i]) { case "tipo": //E/S lstobj.add(ReflectionBasic.createEnum(clsLoader, pkg + ".TipoRegistro", filtroValors[i].toString())); break; case "ejercicio": //2022 .. lstobj.add(Short.parseShort(filtroValors[i])); break; case "estado": //COMPLETO/INCOMPLETO lstobj.add(ReflectionBasic.createEnum(clsLoader, pkg + ".TipoEstado", filtroValors[i].toString())); break; case "oficina": //entero lstobj.add(Integer.parseInt(filtroValors[i])); break; case "factura": //boolean lstobj.add(Boolean.parseBoolean(filtroValors[i])); break; case "archivado": //boolean lstobj.add(Boolean.parseBoolean(filtroValors[i])); break; case "destinosOrigen": //ArrayOfInt String[] destinosStr=filtroValors[i].split(","); List<Integer> destinosInt= Arrays.stream(destinosStr).map(e->Integer.valueOf(e)).collect(Collectors.toList()); lstobj.add(ReflectionBasic.createArrayOfInt(clsLoader, pkg + ".ArrayOfInt", destinosInt)); // Edu break; case "interesados": //ArrayOfString String[] interesadosStr=filtroValors[i].split(","); lstobj.add(ReflectionBasic.createArrayOfString(clsLoader, pkg + ".ArrayOfString", interesadosStr)); // Edu break; case "fechaGrabacionDesde": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; case "fechaGrabacionHasta": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; case "fechaValidezDesde": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; case "fechaValidezHasta": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; case "FechaCompletoDesde": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; case "fechaCompletoHasta": //XMLGregorianCalendar lstobj.add(ReflectionBasic.getXMLGrgCalyyyy_mm_dd(filtroValors[i])); break; } } Object filtro = ReflectionBasic.createObject(clsLoader, pkg + "." + "FiltroRegistroDto", filtroCamps, lstobj.toArray(), false, null); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "filtro","orden","pagina" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, filtro, orden, pagina }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 4. SERES.CIUDADANO * *******************************************************************************************/ public Object[] GetCiudadanoByDocumentoNou(String nif)throws Exception { String operation="GetCiudadanoByDocumento"; String simpleClassName = operation; String myKey="seres_ciudadanos"; //String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "documento" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, nif }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); //return invoke(operation, myKey, outputField, myInstance); Object[] aObj = new Object[6]; try { Object[] res =wsMngr.invoke(myAppKeyOpt, operation, myInstance); Object e=res[0]; // 0->ID Ciudadano aObj[0] = FieldUtils.readField(e, "id", true); // 1.->ID Representante aObj[1] = 0; Object ob = ReflectionBasic.getNestedFieldList(e, "representantes","representanteEditViewModel"); if (ob != null) aObj[1] = FieldUtils.readField(ob, "getCiudadanoRepresentanteId", true); // 2.--> Notificacion electronica aObj[2] = FieldUtils.readField(e, "notElectronica", true); // 3.--> Domicilio OJO que no està claro aObj[3] = ""; ob = ReflectionBasic.getNestedFieldList(e, "domicilios", "domCiudadanoEditExternoModel"); if (ob != null) aObj[3] = Objects.toString(FieldUtils.readField(ob, "direccion", true), "") + " " + Objects.toString(FieldUtils.readField(ob, "numVia", true), "") + " " + Objects.toString(FieldUtils.readField(ob, "escPisPue", true), "") + " " + Objects.toString(FieldUtils.readField(ob, "codPostal", true), "") + " " + Objects.toString(FieldUtils.readField(ob, "municipioDescripcion", true), "") + " " + Objects.toString(FieldUtils.readField(ob, "provinciaDescripcion", true), ""); // 4.--> Telefon aObj[4] = ""; ob = ReflectionBasic.getNestedFieldList(e, "telefonos", "telefonoEditViewModel"); if (ob != null) aObj[4] = Objects.toString(FieldUtils.readField(ob, "nTelefono", true), ""); // 5.--> Email aObj[5] = ""; ob = ReflectionBasic.getNestedFieldList(e, "correosElectronicos", "correoElectronicoEditViewModel"); if (ob != null) aObj[5] = Objects.toString(FieldUtils.readField(ob, "email", true), ""); } catch (Exception e) {e.printStackTrace();} return aObj; } public WsOutput GetCiudadanoByDocumento(String nif)throws Exception { String operation="GetCiudadanoByDocumento"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "documento" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, nif }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListProcedencias() throws Exception { String operation="ListProcedencias"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListCiudadanosByName(String filtro, String tipoPersonalidad) throws Exception { String operation="ListCiudadanosByName"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff Object personalidad= ReflectionBasic.createEnum(clsLoader,pkg+ "."+ "TipoPersonalidad",tipoPersonalidad); // OJO: // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "filtro", "tipoPersonalidad" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, filtro, personalidad}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput NewProcedencia(String [] idAbrvDesc) throws Exception { String operation="NewProcedencia"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff String[] fieldNamesPrc = { "id", "abreviatura", "descripcion" }; Object[] fieldValuesPrc = { idAbrvDesc[0], idAbrvDesc[1], idAbrvDesc[2] }; Object procedencia = ReflectionBasic.createObject(clsLoader, pkg + "." + "ProcedenciaEditViewModel", fieldNamesPrc, fieldValuesPrc, false, null); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador", "procedencia"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, procedencia}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput getCiudadanoByDocumento(String documento) throws Exception { String operation="GetCiudadanoByDocumento"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad","documento" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, documento}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput SyncCiudadano(Map<String,Object> parameters) throws Exception { String operation="SyncCiudadano"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff // 3. Get ciudadano's data String simpleClassNameCiud="CiudadanoEditExternoModel"; String[] fieldNamesCiud = { "nif" , "domCiudadanoPrincipalId", "nombre", "apellido1" , "apellido2" , "apellidoNombre", "personalidad" , "observaciones" , "procedenciaId", "notElectronica" , "idiomaComunicaciones" , "fechaNacimiento", "correosElectronicos", "direccionesElectronicas", "telefonos", "domicilios" , "representantes" }; Object ciudadano = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassNameCiud, fieldNamesCiud, parameters, false, null); // 4. Fill fields of a class String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad", "nifTramitador","ciudadano" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, ciudadano}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput SyncCiudadano(Object ciudadano) throws Exception { String operation="SyncCiudadano"; String simpleClassName = operation; String myKey="seres_ciudadanos"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); //Other stuff // 3. Get ciudadano's data String[] fieldNames = { "wssegUser", "wssegPassword", "wsEntidad","nifTramitador","ciudadano" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, this.nif, ciudadano}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 5. DIRECTORIO * *******************************************************************************************/ public WsOutput ListarRolesDelUsuarioEnCualquierAmbito(String nifUsuario) throws Exception { String operation="ListarRolesDelUsuarioEnCualquierAmbito"; String simpleClassName = operation; String myKey="directorio"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "nifUsuario" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, nifUsuario }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } public WsOutput ListarNodosContenidosEn(int inodo, boolean soloContenedores) throws Exception { String operation = "ListarNodosContenidosEn"; String simpleClassName = operation; String myKey="directorio"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "idNodoContenedor", "soloContenedores" }; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, inodo, soloContenedores}; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } /********************************************************************************************* * 6. SELLO * *******************************************************************************************/ public WsOutput SellarPdfBase64(String descripcionDocumento, String descripcionSello, String textoSello, String b64Origen, String tipoFormato, String idTipoEni, String idEstadoElaboracion, boolean origenAdministracion, boolean omitirFirmasPrevias) throws Exception { String operation="SellarPdfBase64"; String simpleClassName = operation; String myKey="sello"; String outputField=""; // can have Nested field or no field String[] myAppKeyOpt=fillArray(this.appKeyOpt[0],myKey,this.appKeyOpt[2]); wsMngr.addClient(myAppKeyOpt); //Verify that the client is loaded ClassLoader clsLoader=wsMngr.getClassLoader(myAppKeyOpt); String pkg=wsMngr.getPkg(myAppKeyOpt); this.createSecurity(myAppKeyOpt); // 3. Other stuff Object tFormato = ReflectionBasic.createEnum(clsLoader, pkg + ".TipoFormato", tipoFormato); String[] fieldNameOpcionesSelloElectronicoV2 = { "formato", "idTipoEni", "idEstadoElaboracion", "origenAdministracion", "omitirFirmasPrevias"}; Object[] fieldValueOpcionesSelloElectronicoV2 = { tFormato, idTipoEni, idEstadoElaboracion, origenAdministracion, omitirFirmasPrevias}; Object opcionesSelloElectronicoV2 = ReflectionBasic.createObject(clsLoader, pkg + ".OpcionesSelloElectronicoV2", fieldNameOpcionesSelloElectronicoV2, fieldValueOpcionesSelloElectronicoV2, false, null); // 4. Fill fields of a class String[] fieldNames = { "wsSegUser", "wsSegPass", "idEntidad", "descripcionDocumento", "descripcionSello", "textoSello", "b64Origen", "opciones"}; Object[] fieldValues = { this.username, this.modifPwd, this.entidad, descripcionDocumento,descripcionSello,textoSello, b64Origen, opcionesSelloElectronicoV2 }; Object myInstance = ReflectionBasic.createObject(clsLoader, pkg + "." + simpleClassName, fieldNames, fieldValues, false, null); return invoke(operation, myKey, outputField, myInstance); } }
5. Examples of calling the WS (WSSedipualba.java)
package openadmin.sedipualba.decrets; import java.util.Properties; import com.fasterxml.jackson.databind.ObjectMapper; import ximodante.basic.utils.basic.ExecutionTypeEnum; import ximodante.basic.utils.basic.PropertyUtilsEdu; import ximodante.basic.utils.ws.WsOutput; import ximodante.ws.alba.WsAlba; public class WSSedipualba { //Get Information about a SEGRA by its idSegra public static String SegraObtenerPropuestaInfoV2(int pkPropuesta) throws Exception { Properties propsWs=PropertyUtilsEdu.getProperties(ExecutionTypeEnum.NO_JAR, "ws_encrypt"); String[] appKeyOpt= {"alba","directorio","prod"}; long timeOut=20000L; WsAlba wsAlba = new WsAlba(propsWs, appKeyOpt,true, timeOut); String output=null; //System.out.println("call_01_01-------------------------------"); try { WsOutput wsOutput=wsAlba.ObtenerPropuestaInfoV2(pkPropuesta); System.out.println("Resultado: OK="+wsOutput.isOK() + " Mensaje:" + wsOutput.getMessage()); Object result=wsOutput.getOutput(); output=new ObjectMapper().writeValueAsString(result); System.out.println("Resultado="+output); } catch (Exception e) {e.printStackTrace();} return output; } //Get Information about a SEGRA by its idSegra public static String SegexObtenerInfoDocumentoConCsv(String csv, String expedient) throws Exception { Properties propsWs=PropertyUtilsEdu.getProperties(ExecutionTypeEnum.NO_JAR, "ws_encrypt"); String[] appKeyOpt= {"alba","directorio","prod"}; long timeOut=20000L; WsAlba wsAlba = new WsAlba(propsWs, appKeyOpt,true, timeOut); String output=null; //System.out.println("call_01_01-------------------------------"); try { WsOutput wsOutput=wsAlba.ObtenerInfoDocumentoConCsv(csv,expedient); System.out.println("Resultado: OK="+wsOutput.isOK() + " Mensaje:" + wsOutput.getMessage()); Object result=wsOutput.getOutput(); output=new ObjectMapper().writeValueAsString(result); System.out.println("Resultado="+output); } catch (Exception e) {e.printStackTrace();} return output; } //AñadirDocSegraAExpedientePorId public static String SegexAñadirDocSegraAExpedientePorId(int idSegra, String expedient, String descripcion, int pkCarpeta, boolean accesoInteresados) throws Exception { Properties propsWs=PropertyUtilsEdu.getProperties(ExecutionTypeEnum.NO_JAR, "ws_encrypt"); String[] appKeyOpt= {"alba","directorio","prod"}; long timeOut=20000L; WsAlba wsAlba = new WsAlba(propsWs, appKeyOpt,true, timeOut); String output=null; //System.out.println("call_01_01-------------------------------"); try { WsOutput wsOutput=wsAlba.AñadirDocSegraAExpedientePorId(expedient, idSegra, descripcion, pkCarpeta, accesoInteresados); System.out.println("Resultado: OK="+wsOutput.isOK() + " Mensaje:" + wsOutput.getMessage()); Object result=wsOutput.getOutput(); output=new ObjectMapper().writeValueAsString(result); System.out.println("Resultado="+output); } catch (Exception e) {e.printStackTrace();} return output; } }
Comments
Post a Comment