You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Davanum Srinivas (JIRA)" <ji...@apache.org> on 2007/06/07 04:48:27 UTC

[jira] Updated: (AXIS2-2728) Raw SOAP XML Logging

     [ https://issues.apache.org/jira/browse/AXIS2-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas updated AXIS2-2728:
------------------------------------

    Assignee: Deepal Jayasinghe

> Raw SOAP XML Logging
> --------------------
>
>                 Key: AXIS2-2728
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2728
>             Project: Axis 2.0 (Axis2)
>          Issue Type: New Feature
>          Components: modules
>         Environment: All
>            Reporter: Nathan Hook
>            Assignee: Deepal Jayasinghe
>            Priority: Minor
>
> It would be outstanding if there was a way to log the raw SOAP XML for each request and response on a server.
> Currently if a user of Axis2 wants to log the raw SOAP XML they must follow and implement the 'Writing Your Own Axis2 Module' tutorial.  The tutorial is found at: http://ws.apache.org/axis2/1_2/modules.html
> It would be nice if a default module was made to make the logging easier.  However, I could see the need to keep the current module explaining how to do logging if more logging is required.
> Finally it would be nice to also point out that this module works for both requests made to the server and requests made from the server.
> Here is the current handler we're using for our logging.  It isn't great yet, but it is a starting point for different ideas.
> package com.xxx.axis2.handlers;
> import java.util.*;
> import javax.servlet.http.*;
> import org.apache.axis2.*;
> import org.apache.axis2.context.*;
> import org.apache.axis2.handlers.*;
> public class LogHandler extends AbstractHandler
> {
> 	private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LogHandler.class);
> 	
> 	private static ThreadLocal aSessionId = new ThreadLocal();
> 	
> 	private String aName = null;
> 	
> 	public InvocationResponse invoke(MessageContext messageContext) throws AxisFault
> 	{
> 		Map map = messageContext.getProperties();
> 		
> 		HttpServletRequest request = (HttpServletRequest)map.get("transport.http.servletRequest");
> 		
> 		log.debug("Service - start (invoke)");
> 		if(request != null)
> 		{
> 			aSessionId.set(request.getSession().getId());
> 			log.debug("  id: " + aSessionId.get());
> 		}
> 		log.debug("  operation: " + messageContext.getAxisOperation().getKey());
> 		log.debug("  service: " + messageContext.getAxisService().getKey());
> 		log.debug("  direction: " + messageContext.getAxisMessage().getDirection());
> 		if(messageContext.getFrom() != null)
> 		{
> 			log.debug("  remote ip: " + messageContext.getFrom().getAddress());
> 		}
> 		log.debug("  binding name: " + messageContext.getAxisService().getBindingName());
> 		log.debug("    Envelope - start");
> 		log.debug("\n      " + messageContext.getEnvelope());
> 		log.debug("    Envelope - end");
> 		log.debug("Service - end");
> 		
> 		if(messageContext.getAxisMessage().getDirection().equals("out"))
> 		{
> 			aSessionId.remove();
> 		}
> 		
> 		return InvocationResponse.CONTINUE;
> 	}
> 	
> 	public void revoke(MessageContext messageContext)
> 	{
> 		Map map = messageContext.getProperties();
> 		
> 		HttpServletRequest request = (HttpServletRequest)map.get("transport.http.servletRequest");
> 		
> 		log.debug("Service - start (revoke)");
> 		if(request != null)
> 		{
> 			aSessionId.set(request.getSession().getId());
> 			log.debug("  id: " + aSessionId.get());
> 		}
> 		log.debug("  operation: " + messageContext.getAxisOperation().getKey());
> 		log.debug("  service: " + messageContext.getAxisService().getKey());
> 		log.debug("  direction: " + messageContext.getAxisMessage().getDirection());
> 		if(messageContext.getFrom() != null)
> 		{
> 			log.debug("  remote ip: " + messageContext.getFrom().getAddress());
> 		}
> 		log.debug("  binding name: " + messageContext.getAxisService().getBindingName());
> 		log.debug("    Envelope - start");
> 		log.debug("\n      " + messageContext.getEnvelope());
> 		log.debug("    Envelope - end");
> 		log.debug("Service - end");
> 		
> 		if(messageContext.getAxisMessage().getDirection().equals("out"))
> 		{
> 			aSessionId.remove();
> 		}
> 	}
> 	
> 	public void setName(String name)
> 	{
> 		aName = name;
> 	}
> 	
> 	public String getName()
> 	{
> 		return aName;
> 	}
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org