FileDocCategorySizeDatePackage
SOAPMonitorHandler.javaAPI DocApache Axis 1.42906Sat Apr 22 18:57:28 BST 2006org.apache.axis.handlers

SOAPMonitorHandler

public class SOAPMonitorHandler extends BasicHandler
This handler is used to route SOAP messages to the SOAP monitor service.
author
Brian Price (pricebe@us.ibm.com)

Fields Summary
private static long
next_message_id
Constructors Summary
public SOAPMonitorHandler()
Constructor


      
    
    super();
  
Methods Summary
private java.lang.LongassignMessageId(org.apache.axis.MessageContext messageContext)
Assign a new message id

    Long id = null;
    synchronized(SOAPMonitorConstants.SOAP_MONITOR_ID) {
      id = new Long(next_message_id);
      next_message_id++;
    }
    messageContext.setProperty(SOAPMonitorConstants.SOAP_MONITOR_ID, id);
    return id;
  
private java.lang.LonggetMessageId(org.apache.axis.MessageContext messageContext)
Get the already assigned message id

    Long id = null;
    id = (Long) messageContext.getProperty(SOAPMonitorConstants.SOAP_MONITOR_ID);
    return id;
  
public voidinvoke(org.apache.axis.MessageContext messageContext)
Process and SOAP message

    String  target = messageContext.getTargetService();
    // Check for null target
    if (target == null) {
        target = "";
    }
    // Get id, type and content
    Long    id;
    Integer type;
    Message message;
    if (!messageContext.getPastPivot()) {
      id = assignMessageId(messageContext);
      type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
      message = messageContext.getRequestMessage();
    } else {
      id = getMessageId(messageContext);
      type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
      message = messageContext.getResponseMessage();
    }
    // Get the SOAP portion of the message
    String  soap = null;
    if (message != null) {
      soap = ((SOAPPart)message.getSOAPPart()).getAsString();
    }
    // If we have an id and a SOAP portion, then send the
    // message to the SOAP monitor service
    if ((id != null) && (soap != null)) {
      SOAPMonitorService.publishMessage(id,type,target,soap);
    }