From 26d741993a68c2c1f983e6b9cb14d74a4354d09e Mon Sep 17 00:00:00 2001
From: Simon Spinner <simon.spinner@uni-wuerzburg.de>
Date: Tue, 7 Jun 2016 13:40:13 +0200
Subject: [PATCH] Split up the URL in application and component.

---
 .../WebServiceOutgoingCallInterceptor.java            | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/interceptors/WebServiceOutgoingCallInterceptor.java b/tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/interceptors/WebServiceOutgoingCallInterceptor.java
index 0b405d1..8ac34e2 100644
--- a/tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/interceptors/WebServiceOutgoingCallInterceptor.java
+++ b/tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/interceptors/WebServiceOutgoingCallInterceptor.java
@@ -59,8 +59,15 @@ public class WebServiceOutgoingCallInterceptor extends GenericSOAPHandler {
 			URL url;
 			try {
 				url = new URL((String)msgContext.get("javax.xml.ws.service.endpoint.address"));
-				Method caller = (Method)msgContext.get("java.lang.reflect.Method");
-				ComponentRecord component = MonitoringService.INSTANCE.requireComponent(url.getHost(), "", "", url.getPath());
+				Method caller = (Method)msgContext.get("java.lang.reflect.Method");	
+				String application = "";
+				String componentName = url.getPath().substring(1); // Remove first slash				
+				int idx = url.getPath().lastIndexOf("/");
+				if (idx > 0) {
+					application = componentName.substring(0, idx);
+					componentName = componentName.substring(idx + 1);
+				}
+				ComponentRecord component = MonitoringService.INSTANCE.requireComponent(url.getHost(), application, "", componentName);
 				OperationRecord currentOperation = currentInvocation.requireEndpoint(component, caller.getDeclaringClass().getName(), "http", caller.getName());
 				// TODO: We currently support only one-way messages. Inbound messages are ignored.
 				InvocationRecord outgoingInvocation = currentOperation.startInvocation();
-- 
GitLab