FileDocCategorySizeDatePackage
MessageTraceImpl.javaAPI DocGlassfish v2 API5100Fri May 04 22:36:16 BST 2007com.sun.enterprise.webservice.monitoring

MessageTraceImpl

public class MessageTraceImpl extends Object implements MessageTrace
An invocation trace contains the timestamp os a particular message invocation, the stringified SOAP request and response or the SOAP Faults if the invocation resulted in one.

NOT THREAD SAFE: mutable instance variables

author
Jerome Dochez

Fields Summary
private Endpoint
source
private String
soapMessage
private TransportInfo
transportInfo
private int
hashcode
Constructors Summary
public MessageTraceImpl()
Creates a new instance of InvocationTrace

    
    
           
      
        
    
Methods Summary
public EndpointgetEndpoint()
Return the endpoint where this message originated from

        return source;
    
public java.lang.StringgetMessage(boolean includeHeaders)
Return the SOAPMessage as a string including the SOAPHeaders or not

param
include the soap headers.
return
the soap message


        if (soapMessage!=null) {
            if (includeHeaders) {
                return soapMessage;
            }
        
            StringBuffer sb = new StringBuffer();
            Pattern p = Pattern.compile("<env:Body>.*</env:Body>");
            Matcher m = p.matcher(soapMessage);
            if (m.find()) {
                return soapMessage.substring(m.start(),m.end());
            } else {
                return soapMessage;
            }
        }
        return null;
    
public java.lang.StringgetMessageID()

        return String.valueOf(hashcode);
    
public TransportInfogetTransportInfo()

        return transportInfo;
    
public voidsetEndpoint(Endpoint source)

        this.source = source;
    
public voidsetMessageContext(com.sun.xml.rpc.spi.runtime.SOAPMessageContext soapMessageCtx)

        
        hashcode = soapMessageCtx.hashCode();
        
        ByteArrayOutputStream baos = new ByteArrayOutputStream();        
        try {
            soapMessageCtx.getMessage().writeTo(baos);       
        } catch(Exception e) {
            WebServiceEngineImpl.sLogger.log(Level.WARNING, "Cannot log SOAP Message " + e.getMessage());
        }    

        soapMessage = baos.toString();          
    
public voidsetMessageContext(com.sun.enterprise.webservice.SOAPMessageContext soapMessageCtx)

        
        hashcode = soapMessageCtx.hashCode();
        
        ByteArrayOutputStream baos = new ByteArrayOutputStream();        
        try {
            soapMessageCtx.getMessage().writeTo(baos);       
        } catch(Exception e) {
            WebServiceEngineImpl.sLogger.log(Level.WARNING, "Cannot log SOAP Message " + e.getMessage());
        }    

        soapMessage = baos.toString();          
    
public voidsetTransportInfo(TransportInfo info)

        transportInfo = info;