I am trying to implement a custom logger with Synapse handler, I can differentiate API and service but how can I get the API name from synapse handler code? Service name is __SynapseService
for all APIs.
public static boolean isProxyService(MessageContext messageContext,
AxisService axisService) {
if (axisService != null) {
Parameter val = axisService.getParameter("serviceType");
if (val != null && val.getValue().toString().equalsIgnoreCase("Proxy")) {
if (logger.isDebugEnabled()) {
logger.debug("Parameter Value Service Type: "
+ val.getValue().toString());
}
return true;
}
}
return false;
}
public static boolean isAPI(MessageContext messageContext,
AxisService axisService) {
if(!isProxyService(messageContext, axisService) && axisService.getAxisServiceGroup().getServiceGroupName().equals(SynapseConstants.SYNAPSE_SERVICE_NAME)){
return true;
}
return false;
}
public static String getServiceName(MessageContext messageContext, AxisService axisService) {
org.apache.axis2.context.MessageContext msgContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext();
return msgContext.getServiceContext().getName();
}