diff --git a/dbcmnpsrc/FE/mnpdev/build/build_WS_IBK61.cmd b/dbcmnpsrc/FE/mnpdev/build/build_WS_IBK61.cmd new file mode 100644 index 0000000..54ef3ef --- /dev/null +++ b/dbcmnpsrc/FE/mnpdev/build/build_WS_IBK61.cmd @@ -0,0 +1,8 @@ +@set ANT_HOME=apache-ant-1.9.2 +@set JAVA_HOME=C:\jdk1.6.0_45 +@set PATH=%ANT_HOME%/bin;%JAVA_HOME%/bin +@set ANT_OPTS=-Xms512m -Xmx512m + +@call ant -buildfile build_ws.xml WSO2CIBK61ClientGen + +@pause \ No newline at end of file diff --git a/dbcmnpsrc/FE/mnpdev/mnp/ear/APP-INF/lib/WSO2CIBK61Client.jar b/dbcmnpsrc/FE/mnpdev/mnp/ear/APP-INF/lib/WSO2CIBK61Client.jar new file mode 100644 index 0000000..835f53d Binary files /dev/null and b/dbcmnpsrc/FE/mnpdev/mnp/ear/APP-INF/lib/WSO2CIBK61Client.jar differ diff --git a/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61Client.java b/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61Client.java new file mode 100644 index 0000000..7aa5781 --- /dev/null +++ b/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61Client.java @@ -0,0 +1,325 @@ +package mnp.proxy.ws.o2c.client; + +import com.tibco.tns.bw.json.x1718779962104.Header; +import com.tibco.tns.bw.json.x1718779962104.IBK61_RequestElementType; +import com.tibco.tns.bw.json.x1718779962104.Message; +import com.tibco.tns.bw.json.x1718779962104.RequestParameters; +import it.valueteam.mnp.ws.o2c.client.IBK61_Service_Impl; +import it.valueteam.mnp.ws.o2c.client.IBK61_PortType; +import mnp.database.hb.dto.MnpGispAttOut; + +import mnp.database.hb.dto.MnpGispCessOut; +import mnp.log.Loggable; +import mnp.log.ProcessLogger; +import mnp.objects.LogInfo; +import mnp.objects.LogProcess; + +import mnp.utility.DateUtils; +import mnp.utility.Resources; +import org.example.ibk61_responseresource.IBK61_ResponseElementType; +import tim.infobus.data.TID; + +import javax.ejb.CreateException; +import javax.xml.rpc.Stub; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Locale; + +public class IBK61Client implements Loggable { + private String url; + private int timeOut; + private static final int defaultTimeOut = 30000; + private static final String dateFormat = "yyyy-MM-dd"; + private static final String timeFormat = "HH:mm:ss"; + + protected ProcessLogger log; + + protected String codiceProcesso = "MS"; // come da MNP_ANAGRAFICA_PROCESSO + private static final String SYSTEM_DBC = "DBC"; + + public static final String DATA_ESPL_FORMAT = "dd-MMM-yyyy HH:mm:ss"; + + protected String versione = "1.0.0.0"; + + public IBK61Client() throws Exception{ + try { + LogProcess logProcess = new LogProcess(); + logProcess.setCodice(codiceProcesso); + logProcess.setProcess(this); + log = new ProcessLogger(logProcess); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("Errore nella creazione del ProcessLogger, classe:" + IBK61Client.class + " - " + ex.toString()); + throw new CreateException(); + } + log.write("0001", " versione " + versione); + + //setto l'url che verrā utilizzato nelle richieste di attiv/disattiv + url = Resources.getURL_WS_O2C_DISATMNPG_ATTIVGSM_DONOR(); + + if ("".equals(url)) { + log.write("0003", ""); + throw new Exception("errore in creazione client IBK61Client - impossibile recuperare url del ws da properties"); + } + + String timeOutStr = Resources.getTIMEOUT_WS_O2C_DISATMNPG_ATTIVGSM_DONOR(); + log.write("9999", " IBK61Client - url: " + url + " - timeOut: " + timeOutStr); + + //se non esiste la properties timer, allora la setto con la var. statica della classe + try { + timeOut = Integer.parseInt(timeOutStr); + } catch (NumberFormatException nfe) { + log.write("9999", " impossibile recuperare property timeout - impostato valore di default: " + defaultTimeOut); + timeOut = defaultTimeOut; + } + } + + @Override + public LogInfo getLogInfo() throws Exception { + LogInfo logInfo = new LogInfo(); + logInfo.setProcess(getClass().getName()); + logInfo.setLogPath(Resources.getLogPath()); + logInfo.setTypeInfo(Resources.getTypeInfo()); + logInfo.setTypeDebug(Resources.getTypeDebug()); + logInfo.setTypeError(Resources.getTypeError()); + return logInfo; + } + + /** + * Creazione Request servizio richiestaAttivaztioneCessazioneLinea esposto da O2C + * per richieste di attivazione (ATTIVGSM) + * + * @param mnpGispAttOut oggetto legato al dao che referenzia la tabella MNP_GISP_ATT_OUT + * @return oggetto di tipo IBK61_RequestElementType + */ + public IBK61_RequestElementType createRequest(MnpGispAttOut mnpGispAttOut) { + IBK61_RequestElementType richiestaAttivazione = new IBK61_RequestElementType(); + Message message = new Message(); + List parameters = new ArrayList(); + + RequestParameters nomeRichiesta = new RequestParameters(); + if (mnpGispAttOut.getNomeRichiesta() != null) { + nomeRichiesta.setName("NOME_RICHIESTA"); + nomeRichiesta.setValue(mnpGispAttOut.getNomeRichiesta()); + parameters.add(nomeRichiesta); + } + + RequestParameters cas = new RequestParameters(); + if (mnpGispAttOut.getCas() != null) { + cas.setName("CAS"); + cas.setValue(mnpGispAttOut.getCas()); + parameters.add(cas); + } + + RequestParameters numTel = new RequestParameters(); + if (mnpGispAttOut.getNumTel() != null) { + numTel.setName("NUM_TEL"); + numTel.setValue(mnpGispAttOut.getNumTel()); + parameters.add(numTel); + } + + RequestParameters dataEspl = new RequestParameters(); + if (mnpGispAttOut.getDataEspl() != null) { + dataEspl.setName("DATA_ESPL"); + dataEspl.setValue(DateUtils. + toStringLocale(mnpGispAttOut.getDataEspl(), + DATA_ESPL_FORMAT, + Locale.ENGLISH)); + parameters.add(dataEspl); + } + + + RequestParameters imsi = new RequestParameters(); + if (mnpGispAttOut.getImsi() != null) { + imsi.setName("IMSI"); + imsi.setValue(mnpGispAttOut.getImsi()); + parameters.add(imsi); + } + + RequestParameters profilo = new RequestParameters(); + if (mnpGispAttOut.getProfilo() != null) { + profilo.setName("PROFILO"); + profilo.setValue(mnpGispAttOut.getProfilo()); + parameters.add(profilo); + } + + RequestParameters tid = new RequestParameters(); + if (mnpGispAttOut.getTid() != null) { + tid.setName("TID"); + tid.setValue(mnpGispAttOut.getTid()); + parameters.add(tid); + } + + + RequestParameters interna = new RequestParameters(); + if (String.valueOf(mnpGispAttOut.getInterna()) != null) { + interna.setName("INTERNA"); + interna.setValue(String.valueOf(mnpGispAttOut.getInterna())); + parameters.add(interna); + } + + + //trasformo la lista in array + RequestParameters[] array_param = new RequestParameters[parameters.size()]; + int p = 0; + + for (RequestParameters param : parameters) { + array_param[p] = param; + p++; + } + + message.setRequestParameters(array_param); + richiestaAttivazione.setMessage(message); + + return richiestaAttivazione; + } + + /** + * Creazione Request servizio richiestaAttivaztioneCessazioneLinea esposto da O2C + * per richieste di attivazione (DISATMNPG) + * + * @param MnpGispCessOut oggetto legato al dao che referenzia la tabella MNP_GISP_CESS_OUT + * @return oggetto di tipo IBK61_RequestElementType + */ + public IBK61_RequestElementType createRequest(MnpGispCessOut MnpGispCessOut) { + IBK61_RequestElementType richiestaCessazione = new IBK61_RequestElementType(); + Message message = new Message(); + List parameters = new ArrayList(); + + RequestParameters nomeRichiesta = new RequestParameters(); + if (MnpGispCessOut.getNomeRichiesta() != null) { + nomeRichiesta.setName("NOME_RICHIESTA"); + nomeRichiesta.setValue(MnpGispCessOut.getNomeRichiesta()); + parameters.add(nomeRichiesta); + } + + RequestParameters cas = new RequestParameters(); + if (MnpGispCessOut.getCas() != null) { + cas.setName("CAS"); + cas.setValue(MnpGispCessOut.getCas()); + parameters.add(cas); + } + + RequestParameters numTel = new RequestParameters(); + if (MnpGispCessOut != null) { + numTel.setName("NUM_TEL"); + numTel.setValue(MnpGispCessOut.getNumTel()); + parameters.add(numTel); + } + + RequestParameters dataEspl = new RequestParameters(); + if (MnpGispCessOut.getDataEspl() != null) { + dataEspl.setName("DATA_ESPL"); + dataEspl.setValue(DateUtils. + toStringLocale(MnpGispCessOut.getDataEspl(), + DATA_ESPL_FORMAT, + Locale.ENGLISH)); + parameters.add(dataEspl); + } + + RequestParameters oloCode = new RequestParameters(); + if (MnpGispCessOut != null) { + oloCode.setName("OLOCODE"); + oloCode.setValue(MnpGispCessOut.getOlocode()); + parameters.add(oloCode); + } + + RequestParameters tid = new RequestParameters(); + if (MnpGispCessOut.getTid() != null) { + tid.setName("TID"); + tid.setValue(MnpGispCessOut.getTid()); + parameters.add(tid); + } + + //trasformo la lista in array + RequestParameters[] array_param = new RequestParameters[parameters.size()]; + int p = 0; + for (RequestParameters param : parameters) { + array_param[p] = param; + p++; + } + + message.setRequestParameters(array_param); + richiestaCessazione.setMessage(message); + + return richiestaCessazione; + } + + /** Metodo utilizzato per invocare l'endPoint di IBK61 sul + * servizio richiestaAttivaztioneCessazioneLinea per attivazioni + * + * @param body + * @param eventType + * @return + * @throws Exception + */ + public IBK61_ResponseElementType iBK61RichiestaAttivazioneLineaDonor(IBK61_RequestElementType body, String eventType) throws Exception { + + IBK61_Service_Impl service = new IBK61_Service_Impl(); + IBK61_PortType endPoint; + endPoint = service.getIBK61SOAP(); + ((Stub) endPoint)._setProperty("javax.xml.rpc.service.endpoint.address", url); + ((Stub) endPoint)._setProperty("weblogic.wsee.transport.connection.timeout", timeOut); + + Header header = new Header(); + + Date date = new Date(); + header.setInteractionDateDate(new SimpleDateFormat(dateFormat).format(date)); + header.setInteractionDateTime(new SimpleDateFormat(timeFormat).format(date)); + + header.setSourceSystem(SYSTEM_DBC); + header.setChannel(SYSTEM_DBC); + header.setEventType(eventType); + + header.setBusinessID(new TID().toString()); + header.setTransactionID(new TID().toString()); + header.setMessageID(new TID().toString()); + //in uniformitā alla IBK50 non mettiamo SessionID + + body.setHeader(header); + + IBK61_ResponseElementType response = endPoint.richiestaAttivaztioneCessazioneLinea(body); + + return response; + } + + /** Metodo utilizzato per invocare l'endPoint di IBK61 + * sul servizio richiestaAttivaztioneCessazioneLinea per cessazioni. + * + * @param body + * @param eventType + * @return + * @throws Exception + */ + public IBK61_ResponseElementType iBK61RichiestaCessazioneLineaDonor(IBK61_RequestElementType body, String eventType) throws Exception { + + IBK61_Service_Impl service = new IBK61_Service_Impl(); + IBK61_PortType endPoint; + endPoint = service.getIBK61SOAP(); + ((Stub) endPoint)._setProperty("javax.xml.rpc.service.endpoint.address", url); + ((Stub) endPoint)._setProperty("weblogic.wsee.transport.connection.timeout", timeOut); + + Header header = new Header(); + + Date date = new Date(); + header.setInteractionDateDate(new SimpleDateFormat(dateFormat).format(date)); + header.setInteractionDateTime(new SimpleDateFormat(timeFormat).format(date)); + + header.setSourceSystem(SYSTEM_DBC); + header.setChannel(SYSTEM_DBC); + header.setEventType(eventType); + + header.setBusinessID(new TID().toString()); + header.setTransactionID(new TID().toString()); + header.setMessageID(new TID().toString()); + //in uniformitā alla IBK50 non mettiamo SessionID + + body.setHeader(header); + + IBK61_ResponseElementType response = endPoint.richiestaAttivaztioneCessazioneLinea(body); + + return response; + } +} diff --git a/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61SOAPHandler.java b/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61SOAPHandler.java new file mode 100644 index 0000000..2ee2280 --- /dev/null +++ b/dbcmnpsrc/FE/mnpdev/mnp/src/mnp/proxy/ws/o2c/client/IBK61SOAPHandler.java @@ -0,0 +1,52 @@ +package mnp.proxy.ws.o2c.client; + +import javax.xml.namespace.QName; +import javax.xml.rpc.handler.GenericHandler; +import javax.xml.rpc.handler.MessageContext; +import javax.xml.rpc.handler.soap.SOAPMessageContext; +import java.io.ByteArrayOutputStream; + +public class IBK61SOAPHandler extends GenericHandler { + + + private QName[] headers; + + public QName[] getHeaders() { + return headers; + } + + public boolean handleRequest(MessageContext context) { + SOAPMessageContext soapMsgCtx = (SOAPMessageContext) context; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try { + System.out.println("[IBK61SOAPHandler] - Inizio Log Invio Notifica"); + System.out.println("----------------------------------------------------------------------------------------------"); + soapMsgCtx.getMessage().writeTo(baos); + System.out.println(baos.toString()); + System.out.println("[IBK61SOAPHandler] - Fine Log Invio Notifica"); + } catch (Exception ex) { + ex.printStackTrace(); + return false; + } + return true; + } + + public boolean handleFault(MessageContext context) { + SOAPMessageContext soapMsgCtx = (SOAPMessageContext) context; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try { + System.out.println("[IBK61SOAPHandler] - Inizio Log Errore Invio Notifica"); + System.out.println("----------------------------------------------------------------------------------------------"); + soapMsgCtx.getMessage().writeTo(baos); + System.out.println(baos.toString()); + System.out.println("[IBK61SOAPHandler] - Fine Log Errore Invio Notifica"); + } catch (Exception ex) { + ex.printStackTrace(); + return false; + } + return true; + } + +} diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK61/WSO2CIBK61Client.jar b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK61/WSO2CIBK61Client.jar new file mode 100644 index 0000000..835f53d Binary files /dev/null and b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK61/WSO2CIBK61Client.jar differ diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICATTLMVNO/tempFile b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK63/tempFile similarity index 100% rename from dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICATTLMVNO/tempFile rename to dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK63/tempFile diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICCESDBCTP/tempFile2 b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK65/tempFile2 similarity index 100% rename from dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICCESDBCTP/tempFile2 rename to dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/IBK65/tempFile2 diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICESSLMVNO/tempFile3 b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICESSLMVNO/tempFile3 deleted file mode 100644 index e69de29..0000000 diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICRESDBCNM/tempFile4 b/dbcmnpsrc/FE/mnpdev/wsdbc/o2c/client/RICRESDBCNM/tempFile4 deleted file mode 100644 index e69de29..0000000 diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/IBK61_Concrete.wsdl b/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/IBK61_Concrete.wsdl new file mode 100644 index 0000000..e5baac7 --- /dev/null +++ b/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/IBK61_Concrete.wsdl @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/handlerClientIBK61.config.xml b/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/handlerClientIBK61.config.xml new file mode 100644 index 0000000..e179275 --- /dev/null +++ b/dbcmnpsrc/FE/mnpdev/wsdbc/wsdl/o2c/IBK61/handlerClientIBK61.config.xml @@ -0,0 +1,10 @@ + + + + IBK61SOAPHandler + mnp.proxy.ws.o2c.client.IBK61SOAPHandler + + \ No newline at end of file