bug#22868

dev: Fabio
qua:

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@108025 d1611594-4594-4d17-8e1d-87c2c4800839
master
fabio 2021-07-24 15:25:01 +00:00
parent e9a6f30e85
commit 7b094b21af
1 changed files with 17 additions and 12 deletions

View File

@ -43,9 +43,7 @@ public class IntegracaoSapRest {
} }
return getRetornoJSON(response); return getRetornoJSON(response);
} catch (IOException e) { } catch (RuntimeException e) {
throw new RuntimeException("Erro na conversão do JSON na integração SAP", e);
} catch (JSONException e) {
throw new RuntimeException("Erro na conversão do JSON na integração SAP", e); throw new RuntimeException("Erro na conversão do JSON na integração SAP", e);
} catch (Exception e) { } catch (Exception e) {
log.error("Erro no envio/retorno da requisicao para integração SAP", e); log.error("Erro no envio/retorno da requisicao para integração SAP", e);
@ -54,16 +52,23 @@ public class IntegracaoSapRest {
return null; return null;
} }
private JSONObject getRetornoJSON(HttpResponse response) throws IOException, JSONException { private JSONObject getRetornoJSON(HttpResponse response){
String rest = "";
try {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
if (entity != null) { if (entity != null) {
String rest = EntityUtils.toString(entity); rest = EntityUtils.toString(entity);
JSONObject result = new JSONObject(rest); JSONObject result = new JSONObject(rest);
JSONObject boleto = result.getJSONObject("MT_Boleto_RES"); JSONObject boleto = result.getJSONObject("MT_Boleto_RES");
return boleto.getJSONArray("ReturnERP").getJSONObject(0); return boleto.getJSONArray("ReturnERP").getJSONObject(0);
} }
return null; return null;
}catch(Exception e) {
log.error("Erro no JSON integração SAP: "+rest);
e.printStackTrace();
throw new RuntimeException(e);
}
} }
private String fechamtoToJson( FechamentoCntCorrenteVO fcc){ private String fechamtoToJson( FechamentoCntCorrenteVO fcc){