From 9e95dbf6f244b815266c6b11e1504008162b1eed Mon Sep 17 00:00:00 2001 From: Alireza Date: Sun, 1 Dec 2024 17:13:48 +0330 Subject: [PATCH 1/2] [feature] adding service call endpoint n log handler. --- .../java/com/tosan/client/soap/handler/LogHandler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java b/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java index 00df9c7..ef3d7b7 100644 --- a/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java +++ b/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java @@ -25,6 +25,7 @@ public class LogHandler implements SOAPHandler { private static final Logger logger = LoggerFactory.getLogger(LogHandler.class); private static final ObjectMapper mapper = new ObjectMapper(); + public static final String ENDPOINT_KEY = "jakarta.xml.ws.service.endpoint.address"; private Set securedParameterNames; ThreadLocal startTimeMillis = new ThreadLocal<>(); @@ -34,6 +35,7 @@ public class LogHandler implements SOAPHandler { .setSerializationInclusion(JsonInclude.Include.NON_NULL) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } + public LogHandler() { } @@ -49,10 +51,11 @@ public boolean handleMessage(SOAPMessageContext messageContext) { try { msg.writeTo(logStream); if (request) { - logParams.put("soap-request", getBody(logStream)); + logParams.put("endPoint", messageContext.get(ENDPOINT_KEY).toString()); + logParams.put("soapRequest", getBody(logStream)); startTimeMillis.set(System.currentTimeMillis()); } else { - logParams.put("soap-response", getBody(logStream)); + logParams.put("soapResponse", getBody(logStream)); logParams.put("duration", getDurationLogMessage()); } logger.info(mapper.writeValueAsString(logParams)); From d3222cb7affe72870bd156e9b6e2e5cffe5029e9 Mon Sep 17 00:00:00 2001 From: Alireza Date: Mon, 2 Dec 2024 12:32:14 +0330 Subject: [PATCH 2/2] [feature] adding service call endpoint n log handler. --- .../src/main/java/com/tosan/client/soap/handler/LogHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java b/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java index ef3d7b7..c92f969 100644 --- a/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java +++ b/tosan-soap-client/src/main/java/com/tosan/client/soap/handler/LogHandler.java @@ -25,7 +25,7 @@ public class LogHandler implements SOAPHandler { private static final Logger logger = LoggerFactory.getLogger(LogHandler.class); private static final ObjectMapper mapper = new ObjectMapper(); - public static final String ENDPOINT_KEY = "jakarta.xml.ws.service.endpoint.address"; + private static final String ENDPOINT_KEY = "jakarta.xml.ws.service.endpoint.address"; private Set securedParameterNames; ThreadLocal startTimeMillis = new ThreadLocal<>();