Fix MNP_SM_2460 completata + Mock servizio retrieveESO (rimosso TIMAC)
This commit is contained in:
5
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdp18a.json
Normal file
5
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdp18a.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"id": "123",
|
||||||
|
"rifCliente": "0000000859510539",
|
||||||
|
"statoCertificazioneCliente": "C"
|
||||||
|
}
|
||||||
10
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdp20b.json
Normal file
10
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdp20b.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "0000000859510539:3920131398",
|
||||||
|
"numLinea": "3920131398",
|
||||||
|
"rifCliente": "0000000859510539",
|
||||||
|
"statoLinea": {
|
||||||
|
"descrizione": "ATTIVO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
5
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdpBU.json
Normal file
5
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdpBU.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"cf": "0000000859510539",
|
||||||
|
"customerCertification": "Y",
|
||||||
|
"piva": "00859510539"
|
||||||
|
}
|
||||||
50
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdpESO.json
Normal file
50
dbcmnpsrc/FE/mnpapp/mockResponse/retrieveSdpESO.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"attributi": {
|
||||||
|
"blocco": {
|
||||||
|
"anagr": "S",
|
||||||
|
"fraud": "000",
|
||||||
|
"fs": "S"
|
||||||
|
},
|
||||||
|
"dati_commerciali": {
|
||||||
|
"cliente": "DCNFBA80B06F89M",
|
||||||
|
"marcaggio_cliente": "X"
|
||||||
|
},
|
||||||
|
"descrizione_profilo": "ABBONATO",
|
||||||
|
"dettaglio_stato": {
|
||||||
|
"cessazione_mnp": "S"
|
||||||
|
},
|
||||||
|
"esp": "TIM",
|
||||||
|
"prepagato": "S",
|
||||||
|
"profilo": "00",
|
||||||
|
"stato": "PREATTIVO",
|
||||||
|
"tipologia": "BU",
|
||||||
|
"usage": {
|
||||||
|
"main_msisdn": "3245562345",
|
||||||
|
"value": "MAIN"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"carta": {
|
||||||
|
"icc-id20": "00000000000001313901"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"code": "00",
|
||||||
|
"msg": "OK"
|
||||||
|
},
|
||||||
|
"msisdn": "3631517588",
|
||||||
|
"risorse_rete": {
|
||||||
|
"Data_ultima_operazione": "20030502160251",
|
||||||
|
"stato": "LI",
|
||||||
|
"tipologia": "A"
|
||||||
|
},
|
||||||
|
"servizi": {
|
||||||
|
"servizio": [
|
||||||
|
{
|
||||||
|
"attributi_servizio": {
|
||||||
|
"additional": "3355173796",
|
||||||
|
"sottoservizio": "BEAR"
|
||||||
|
},
|
||||||
|
"name": "BEAR"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
############### Middleware Modernization 2024: Servizi GISP lotto7 - Authorization HTTP - Basic - BEGIN - ##############
|
||||||
|
|
||||||
|
#La stringa rappresenta la concatenazione della '<USERNAME>:<PASSWORD>' fornite da ESO per l'autenticazione
|
||||||
|
ESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64 = RVNPX00yTV9TRFA6RXNvW1N0ZzJdLQ==
|
||||||
|
|
||||||
|
#Properties utili SOLO per SVILUPPO (VALORI: 0 = COMUNICAZIONE REST WS, 1 = MOCK RETRIEVE ESO RESPONSE)
|
||||||
|
ESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED = 0
|
||||||
|
ESO_RETRIEVE_REST_POST_MOCK_RESPONSE=/mnpapp/mockResponse/retrieveSdpESO.json
|
||||||
|
|
||||||
|
############### Middleware Modernization 2024: Servizi GISP lotto7 - Authorization HTTP - Basic - END - ################
|
||||||
@@ -11,6 +11,7 @@ import mnp.utility.DateUtils;
|
|||||||
import mnp.utility.Func;
|
import mnp.utility.Func;
|
||||||
import mnp.utility.Resources;
|
import mnp.utility.Resources;
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
@@ -63,15 +64,25 @@ public class WSRestHandler extends GenericHandler {
|
|||||||
post.setEntity(postingString);
|
post.setEntity(postingString);
|
||||||
post.setHeaders(headers);
|
post.setHeaders(headers);
|
||||||
response = client.execute(post);
|
response = client.execute(post);
|
||||||
|
|
||||||
|
//check sulla risposta HTTP di ESO
|
||||||
|
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){ // se 200
|
||||||
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
||||||
String line;
|
String line;
|
||||||
while ((line = rd.readLine()) != null) {
|
while ((line = rd.readLine()) != null) {
|
||||||
jsonString.append(line).append('\n');
|
jsonString.append(line).append('\n');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else { //Altrimenti ci aspettiamo solo status code: 401 (Richiesta non autorizzata) o 503 (Non espletata)
|
||||||
|
log.write("9999","ERRORE REST POST response: " + response.getStatusLine().getStatusCode());
|
||||||
|
throw new Exception("HTTP Status Code: " + response.getStatusLine().getStatusCode() +" Reason Phrase: " + response.getStatusLine().getReasonPhrase());
|
||||||
|
}
|
||||||
|
|
||||||
client.close();
|
client.close();
|
||||||
response.close();
|
response.close();
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.write("2512","ERRORE POST response");
|
log.write("9999","ERRORE REST POST response: " + ex.getMessage());
|
||||||
throw ex;
|
throw ex;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
@@ -328,11 +339,26 @@ public class WSRestHandler extends GenericHandler {
|
|||||||
logWrite("9999", "retrieveESORestPost: INIZIO CHIAMATA SERVIZIO REST");
|
logWrite("9999", "retrieveESORestPost: INIZIO CHIAMATA SERVIZIO REST");
|
||||||
String risposta = "";
|
String risposta = "";
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if("1".equals(Resources.getESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED())) {
|
||||||
|
logWrite("9999", "retrieveESO: RETRIEVE ESO MOCK RESPONSE");
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(Resources.getESO_RETRIEVE_REST_POST_MOCK_RESPONSE()));
|
||||||
|
try {
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
risposta = line;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Header[] headers = setHeaderRetrieveESO("retriveESO");
|
Header[] headers = setHeaderRetrieveESO("retriveESO");
|
||||||
String url = Resources.getESO_RETRIEVE_REST_POST_URL();
|
String url = Resources.getESO_RETRIEVE_REST_POST_URL();
|
||||||
risposta = restPost(url,headers,requestSdpJson,log);
|
risposta = restPost(url, headers, requestSdpJson, log);
|
||||||
logWrite("9999", "retrieveESORestPost: url chiamato: "+url);
|
logWrite("9999", "retrieveESORestPost: url chiamato: " + url);
|
||||||
logWrite("9999", "retrieveESORestPost: FINE CHIAMATA SERVIZIO REST");
|
logWrite("9999", "retrieveESORestPost: FINE CHIAMATA SERVIZIO REST");
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logWrite("9999", "retrieveESORestPost: ECCEZIONE NELLA CHIAMATA REST:" + " Message: " +ex.getMessage() +" Cause: "+ex.getCause());
|
logWrite("9999", "retrieveESORestPost: ECCEZIONE NELLA CHIAMATA REST:" + " Message: " +ex.getMessage() +" Cause: "+ex.getCause());
|
||||||
throw ex;
|
throw ex;
|
||||||
|
|||||||
@@ -2521,4 +2521,15 @@ public class Resources {
|
|||||||
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64"));
|
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getESO_RETRIEVE_REST_POST_MOCK_RESPONSE() {
|
||||||
|
init();
|
||||||
|
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_MOCK_RESPONSE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED() {
|
||||||
|
init();
|
||||||
|
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user