FileDocCategorySizeDatePackage
MessageContext.javaAPI DocApache Axis 1.445667Sat Apr 22 18:57:28 BST 2006org.apache.axis

MessageContext

public class MessageContext extends Object implements javax.xml.rpc.handler.soap.SOAPMessageContext
A MessageContext is the Axis implementation of the javax SOAPMessageContext class, and is core to message processing in handlers and other parts of the system. This class also contains constants for accessing some well-known properties. Using a hierarchical namespace is strongly suggested in order to lower the chance for conflicts. (These constants should be viewed as an explicit list of well known and widely used context keys, there's nothing wrong with directly using the key strings. This is the reason for the hierarchical constant namespace. Actually I think we might just list the keys in the docs and provide no such constants since they create yet another namespace, but we'd have no compile-time checks then. Whaddya think? - todo by Jacek)
author
Doug Davis (dug@us.ibm.com)
author
Jacek Kopecky (jacek@idoox.com)

Fields Summary
protected static Log
log
The Log used for logging all messages.
private Message
requestMessage
The request message. If we're on the client, this is the outgoing message heading to the server. If we're on the server, this is the incoming message we've received from the client.
private Message
responseMessage
The response message. If we're on the server, this is the outgoing message heading back to the client. If we're on the client, this is the incoming message we've received from the server.
private String
targetService
That unique key/name that the next router/dispatch handler should use to determine what to do next.
private String
transportName
The name of the Transport which this message was received on (or is headed to, for the client).
private ClassLoader
classLoader
The default ClassLoader that this service should use.
private AxisEngine
axisEngine
The AxisEngine which this context is involved with.
private org.apache.axis.session.Session
session
A Session associated with this request.
private boolean
maintainSession
Should we track session state, or not? default is not. Could potentially refactor this so that maintainSession iff session != null...
private boolean
havePassedPivot
Are we doing request stuff, or response stuff? True if processing response (I think).
private int
timeout
Maximum amount of time to wait on a request, in milliseconds.
private boolean
highFidelity
An indication of whether we require "high fidelity" recording of deserialized messages for this interaction. Defaults to true for now, and can be set to false, usually at service-dispatch time.
private org.apache.axis.utils.LockableHashtable
bag
Storage for an arbitrary bag of properties associated with this MessageContext.
private String
username
private String
password
private String
encodingStyle
private boolean
useSOAPAction
private String
SOAPActionURI
private String[]
roles
SOAP Actor roles.
private org.apache.axis.soap.SOAPConstants
soapConstants
Our SOAP namespaces and such.
private org.apache.axis.schema.SchemaVersion
schemaVersion
Schema version information - defaults to 2001.
private org.apache.axis.description.OperationDesc
currentOperation
Our current operation.
protected static String
systemTempDir
Temporary directory to store attachments.
private org.apache.axis.encoding.TypeMappingRegistry
mappingRegistry
Mappings of QNames to serializers/deserializers (and therfore to Java types).
private org.apache.axis.handlers.soap.SOAPService
serviceHandler
ServiceHandler is the handler that is the "service". This handler can (and probably will actually be a chain that contains the service specific request/response/pivot point handlers
public static final String
ENGINE_HANDLER
Contains an instance of Handler, which is the ServiceContext and the entrypoint of this service. (if it has been so configured - will our deployment tool do this by default? - todo by Jacek)
public static final String
TRANS_URL
This String is the URL that the message came to.
public static final String
QUIT_REQUESTED
Has a quit been requested? Hackish... but useful... -- RobJ
public static final String
AUTHUSER
Place to store an AuthenticatedUser.
public static final String
CALL
If on the client - this is the Call object.
public static final String
IS_MSG
Are we doing Msg vs RPC? - For Java Binding.
public static final String
ATTACHMENTS_DIR
The directory where in coming attachments are created.
public static final String
ACCEPTMISSINGPARAMS
A boolean param, to control whether we accept missing parameters as nulls or refuse to acknowledge them.
public static final String
WSDLGEN_INTFNAMESPACE
The value of the property is used by service WSDL generation (aka ?WSDL) For the service's interface namespace if not set TRANS_URL property is used.
public static final String
WSDLGEN_SERV_LOC_URL
The value of the property is used by service WSDL generation (aka ?WSDL). For the service's location if not set TRANS_URL property is used. (helps provide support through proxies.
public static final String
HTTP_TRANSPORT_VERSION
The value of the property is used by service WSDL generation (aka ?WSDL). Set this property to request a certain level of HTTP. The values MUST use org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_10 for HTTP 1.0 The values MUST use org.apache.axis.transport.http.HTTPConstants.HEADER_PROTOCOL_11 for HTTP 1.1
public static final String
SECURITY_PROVIDER
The security provider.
Constructors Summary
public MessageContext(AxisEngine engine)
Create a message context.

param
engine the controlling axis engine. Null is actually accepted here, though passing a null engine in is strongly discouraged as many of the methods assume that it is in fact defined.

                            
     
        try {
            //get the temp dir from the engine
            systemTempDir=AxisProperties.getProperty(AxisEngine.ENV_ATTACHMENT_DIR);
        } catch(Throwable t) {
            systemTempDir= null;
        }

        if(systemTempDir== null) {
            try {
                //or create and delete a file in the temp dir to make
                //sure we have write access to it.
                File tf= File.createTempFile("Axis", ".tmp");
                File dir= tf.getParentFile();
                if (tf.exists()) {
                    tf.delete();
                }
                if (dir != null) {
                  systemTempDir= dir.getCanonicalPath();
                }
            } catch(Throwable t) {
                log.debug("Unable to find a temp dir with write access");
                systemTempDir= null;
            }
        }
    
        this.axisEngine = engine;

        if(null != engine){
            java.util.Hashtable opts= engine.getOptions();
            String attachmentsdir= null;
            if(null!=opts) {
                attachmentsdir= (String) opts.get(AxisEngine.PROP_ATTACHMENT_DIR);
            }
            if(null == attachmentsdir) {
                attachmentsdir= systemTempDir;
            }
            if(attachmentsdir != null){
                setProperty(ATTACHMENTS_DIR, attachmentsdir);
            }

            // If SOAP 1.2 has been specified as the default for the engine,
            // switch the constants over.
            String defaultSOAPVersion = (String)engine.getOption(
                                                 AxisEngine.PROP_SOAP_VERSION);
            if (defaultSOAPVersion != null && "1.2".equals(defaultSOAPVersion)) {
                setSOAPConstants(SOAPConstants.SOAP12_CONSTANTS);
            }

            String singleSOAPVersion = (String)engine.getOption(
                                        AxisEngine.PROP_SOAP_ALLOWED_VERSION);
            if (singleSOAPVersion != null) {
                if ("1.2".equals(singleSOAPVersion)) {
                    setProperty(Constants.MC_SINGLE_SOAP_VERSION,
                                SOAPConstants.SOAP12_CONSTANTS);
                } else if ("1.1".equals(singleSOAPVersion)) {
                    setProperty(Constants.MC_SINGLE_SOAP_VERSION,
                                SOAPConstants.SOAP11_CONSTANTS);
                }
            }
        }
    
Methods Summary
public booleancontainsProperty(java.lang.String name)
Returns true if the MessageContext contains a property with the specified name.

param
name Name of the property whose presense is to be tested
return
Returns true if the MessageContext contains the property; otherwise false

        Object propertyValue = getProperty(name);
        return (propertyValue != null);
    
public synchronized voiddispose()
if a message (or subclass) has any disposal needs, this method is where it goes. Subclasses *must* call super.dispose(), and be prepared to be called from the finalizer as well as earlier

        log.debug("disposing of message context");
        if(requestMessage!=null) {
            requestMessage.dispose();
            requestMessage=null;
        }
        if(responseMessage!=null) {
            responseMessage.dispose();
            responseMessage=null;
        }
    
protected voidfinalize()
during finalization, the dispose() method is called.

see
#dispose()

        dispose();
    
public java.util.IteratorgetAllPropertyNames()
Returns an Iterator view of the names of the properties in this MessageContext and any parents of the LockableHashtable

return
Iterator for the property names

        return bag.getAllKeys().iterator();
    
public AxisEnginegetAxisEngine()
Get the axis engine. This will be null if the message was created outside an engine

return
the current axis engine

        return axisEngine;
    
public java.lang.ClassLoadergetClassLoader()
Get the classloader, implicitly binding to the thread context classloader if an override has not been supplied.

return
the class loader

        if ( classLoader == null ) {
            classLoader = Thread.currentThread().getContextClassLoader();
        }
        return( classLoader );
    
public static org.apache.axis.MessageContextgetCurrentContext()
Get the active message context.

return
the current active message context

       return AxisEngine.getCurrentMessageContext();
    
public MessagegetCurrentMessage()
Return the current (i.e. request before the pivot, response after) message.

return
the current Message

        return (havePassedPivot ? responseMessage : requestMessage);
    
public java.lang.StringgetEncodingStyle()
Returns the encoding style as a URI that should be used for the SOAP message.

return
String URI of the encoding style to use

        return encodingStyle;
    
public booleangetMaintainSession()
Discover if we are maintaining session state.

return
true if we are maintaining state, false otherwise

        return maintainSession;
    
public javax.xml.soap.SOAPMessagegetMessage()
Gets the SOAPMessage from this message context.

return
the SOAPMessage, null if no request SOAPMessage is present in this SOAPMessageContext

        return getCurrentMessage();
    
public org.apache.axis.description.OperationDescgetOperation()
The current operation.

return
the current operation; may be null


                   
       
    
        return currentOperation;
    
public org.apache.axis.description.OperationDescgetOperationByQName(javax.xml.namespace.QName qname)
get the first possible operation that could match a body containing an element of the given QName. Sets the currentOperation field in the process; if that field is already set then its value is returned instead

param
qname name of the message body
return
an operation or null
throws
AxisFault

        if (currentOperation == null) {
            OperationDesc [] possibleOperations = getPossibleOperationsByQName(qname);
            if (possibleOperations != null && possibleOperations.length > 0) {
                currentOperation = possibleOperations[0];
            }
        }

        return currentOperation;
    
public org.apache.axis.constants.StylegetOperationStyle()
Get the operation style. This is either the style of the current operation or if that is not set, the style of the service handler, or if that is not set, Style.RPC.

return
the Style of this message

        if (currentOperation != null) {
            return currentOperation.getStyle();
        }

        if (serviceHandler != null) {
            return serviceHandler.getStyle();
        }

        return Style.RPC;
    
public org.apache.axis.constants.UsegetOperationUse()
Get the operation use.

return
the operation Use

        if (currentOperation != null) {
            return currentOperation.getUse();
        }

        if (serviceHandler != null) {
            return serviceHandler.getUse();
        }

        return Use.ENCODED;
    
public java.lang.StringgetPassword()
Get the password.

return
the current password String

        return password;
    
public booleangetPastPivot()
Determine when we've passed the pivot.

return
true if we have, false otherwise

        return havePassedPivot;
    
public org.apache.axis.description.OperationDesc[]getPossibleOperationsByQName(javax.xml.namespace.QName qname)
Returns a list of operation descriptors that could may possibly match a body containing an element of the given QName. For non-DOCUMENT, the list of operation descriptors that match the name is returned. For DOCUMENT, all the operations that have qname as a parameter are returned

param
qname of the first element in the body
return
list of operation descriptions
throws
AxisFault if the operation names could not be looked up

        if (currentOperation != null) {
            return new OperationDesc [] { currentOperation };
        }

        OperationDesc [] possibleOperations = null;

        if (serviceHandler == null) {
            try {
                if (log.isDebugEnabled()) {
                    log.debug(Messages.getMessage("dispatching00",
                                                   qname.getNamespaceURI()));
                }

                // Try looking this QName up in our mapping table...
                setService(axisEngine.getConfig().
                           getServiceByNamespaceURI(qname.getNamespaceURI()));
            } catch (ConfigurationException e) {
                // Didn't find one...
            }

        }

        if (serviceHandler != null) {
            ServiceDesc desc = serviceHandler.getInitializedServiceDesc(this);

            if (desc != null) {
                if (desc.getStyle() != Style.DOCUMENT) {
                    possibleOperations = desc.getOperationsByQName(qname);
                } else {
                    // DOCUMENT Style
                    // Get all of the operations that have qname as
                    // a possible parameter QName
                    ArrayList allOperations = desc.getOperations();
                    ArrayList foundOperations = new ArrayList();
                    for (int i=0; i < allOperations.size(); i++ ) {
                        OperationDesc tryOp =
                            (OperationDesc) allOperations.get(i);
                        if (tryOp.getParamByQName(qname) != null) {
                            foundOperations.add(tryOp);
                        }
                    }
                    if (foundOperations.size() > 0) {
                        possibleOperations = (OperationDesc[])
                            JavaUtils.convert(foundOperations,
                                              OperationDesc[].class);
                    }
                }
            }
        }
        return possibleOperations;
    
public java.lang.ObjectgetProperty(java.lang.String name)
Returns the value associated with the named property - or null if not defined/set.

param
name the property name
return
Object value of the property - or null

        if (name != null) {
            if (name.equals(Call.USERNAME_PROPERTY)) {
                return getUsername();
            }
            else if (name.equals(Call.PASSWORD_PROPERTY)) {
                return getPassword();
            }
            else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
                return getMaintainSession() ? Boolean.TRUE : Boolean.FALSE;
            }
            else if (name.equals(Call.OPERATION_STYLE_PROPERTY)) {
                return (getOperationStyle() == null) ? null : getOperationStyle().getName();
            }
            else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
                return useSOAPAction() ? Boolean.TRUE : Boolean.FALSE;
            }
            else if (name.equals(Call.SOAPACTION_URI_PROPERTY)) {
                return getSOAPActionURI();
            }
            else if (name.equals(Call.ENCODINGSTYLE_URI_PROPERTY)) {
                return getEncodingStyle();
            }
            else if (bag == null) {
                return null;
            }
            else {
                return bag.get(name);
            }
        }
        else {
            return null;
        }
    
public java.util.IteratorgetPropertyNames()
Returns an Iterator view of the names of the properties in this MessageContext.

return
an Iterator over all property names

        // fixme: this is potentially unsafe for the caller - changing the
        //  properties will kill the iterator. Consider iterating over a copy:
        // return new HashSet(bag.keySet()).iterator();
        return bag.keySet().iterator();
    
public MessagegetRequestMessage()
Get the request message.

return
the request message (may be null).

        return requestMessage ;
    
public MessagegetResponseMessage()
Get the response message.

return
the response message (may be null).

 return responseMessage ; 
public java.lang.String[]getRoles()
Gets the SOAP actor roles associated with an execution of the HandlerChain and its contained Handler instances.

Not (yet) implemented method in the SOAPMessageContext interface.

Note: SOAP actor roles apply to the SOAP node and are managed using HandlerChain.setRoles() and HandlerChain.getRoles(). Handler instances in the HandlerChain use this information about the SOAP actor roles to process the SOAP header blocks. Note that the SOAP actor roles are invariant during the processing of SOAP message through the HandlerChain.

return
an array of URIs for SOAP actor roles
see
javax.xml.rpc.handler.HandlerChain#setRoles(java.lang.String[]) HandlerChain.setRoles(java.lang.String[])
see
javax.xml.rpc.handler.HandlerChain#getRoles() HandlerChain.getRoles()

        //TODO: Flesh this out.
        return roles;
    
public java.lang.StringgetSOAPActionURI()
Get the soapAction URI.

return
the URI of this soap action

        return SOAPActionURI;
    
public org.apache.axis.soap.SOAPConstantsgetSOAPConstants()
Get the SOAPConstants used by this message context.

return
the soap constants

        return soapConstants;
    
public org.apache.axis.schema.SchemaVersiongetSchemaVersion()
Get the XML schema version information.

return
the SchemaVersion in use

        return schemaVersion;
    
public org.apache.axis.handlers.soap.SOAPServicegetService()
Get the SOAPService used to handle services in this context.

return
the service handler

        return  serviceHandler;
    
public org.apache.axis.session.SessiongetSession()
Get the current session.

return
the Session this message context is within

        return session;
    
public java.lang.StringgetStrProp(java.lang.String propName)
Get a String property by name.

param
propName the name of the property to fetch
return
the value of the named property
throws
ClassCastException if the property named does not have a String value


    /*
     * IMPORTANT.
     * If adding any new constants to this class. Make them final. The
     * ones above are left non-final for compatibility reasons.
     */

                                                        
        
        return (String) getProperty(propName);
    
public java.lang.StringgetTargetService()
Get the name of the targed service for this message.

return
the target service

        return targetService;
    
public intgetTimeout()
Get timeout from our MessageContext.

return
value the maximum amount of time, in milliseconds

        return timeout;
    
public java.lang.StringgetTransportName()
The name of the transport for this context.

return
the transport name

        return transportName;
    
public org.apache.axis.encoding.TypeMappinggetTypeMapping()
Return the type mapping currently in scope for our encoding style.

return
the type mapping

        return (TypeMapping)getTypeMappingRegistry().
                getTypeMapping(encodingStyle);
    
public org.apache.axis.encoding.TypeMappingRegistrygetTypeMappingRegistry()
Get the currently in-scope type mapping registry. By default, will return a reference to the AxisEngine's TMR until someone sets our local one (usually as a result of setting the serviceHandler).

return
the type mapping registry to use for this request.

        if (mappingRegistry == null) {
            return axisEngine.getTypeMappingRegistry();
        }

        return mappingRegistry;
    
public java.lang.StringgetUsername()
Get the user name.

return
the user name as a String

        return username;
    
public booleanisClient()
Let us know whether this is the client or the server.

return
true if we are a client

        return (axisEngine instanceof AxisClient);
    
public booleanisEncoded()
Indicates if the opration is encoded.

return
true if it is encoded, false otherwise

        return (getOperationUse() == Use.ENCODED);
        //return soapConstants.getEncodingURI().equals(encodingStyle);
    
public booleanisHighFidelity()
Read the high fidelity property.

Some behavior may be apropreate for high fidelity contexts that is not relevant for low fidelity ones or vica-versa.

return
true if the context is high fidelity, false otherwise

        return highFidelity;
    
public booleanisPropertyTrue(java.lang.String propName)
Tests to see if the named property is set in the 'bag', returning false if it is not present at all. This is equivalent to isPropertyTrue(propName, false).

param
propName the name of the property to check
return
true or false, depending on the value of the property

        return isPropertyTrue(propName, false);
    
public booleanisPropertyTrue(java.lang.String propName, boolean defaultVal)
Test if a property is set to something we consider to be true in the 'bag'.
  • If not there then defaultVal is returned.
  • If there, then...
    • if its a Boolean, we'll return booleanValue()
    • if its an Integer, we'll return false if its 0 else true
    • if its a String we'll return false if its "false"" or "0" else true
    • All other types return true

param
propName the name of the property to check
param
defaultVal the default value
return
true or false, depending on the value of the property

        return JavaUtils.isTrue(getProperty(propName), defaultVal);
    
public voidremoveProperty(java.lang.String propName)

        if (bag != null) {
            bag.remove(propName);
        }
    
public voidreset()
Return this context to a clean state.

        if (bag != null) {
            bag.clear();
        }
        serviceHandler = null;
        havePassedPivot = false;
        currentOperation = null;
    
public voidsetClassLoader(java.lang.ClassLoader cl)
Set a new classloader. Setting to null will result in getClassLoader() binding back to the thread context class loader.

param
cl the new ClassLoader or null

        classLoader = cl ;
    
public voidsetCurrentMessage(Message curMsg)
Set the current message. This will set the request before the pivot, and the response afterwards, as guaged by the passedPivod property.

param
curMsg the Message to assign

        if ( curMsg != null )
            curMsg.setMessageContext(this);

        if (havePassedPivot) {
            responseMessage = curMsg;
        } else {
            requestMessage = curMsg;
        }
    
public voidsetEncodingStyle(java.lang.String namespaceURI)
Sets the encoding style to the URI passed in.

param
namespaceURI URI of the encoding to use.

        if (namespaceURI == null) {
            namespaceURI = Constants.URI_LITERAL_ENC;
        }
        else if (Constants.isSOAP_ENC(namespaceURI)) {
            namespaceURI = soapConstants.getEncodingURI();
        }

        encodingStyle = namespaceURI;
    
public voidsetHighFidelity(boolean highFidelity)
Set the high fidelity propert.

Users of the context may be changing what they do based upon this flag.

param
highFidelity the new value of the highFidelity property

        this.highFidelity = highFidelity;
    
public voidsetMaintainSession(boolean yesno)
Set whether we are maintaining session state.

param
yesno flag to set to true to maintain sessions

        maintainSession = yesno;
    
public voidsetMessage(javax.xml.soap.SOAPMessage message)
Sets the SOAPMessage for this message context. This is equivalent to casting message to Message and then passing it on to setCurrentMessage().

param
message the SOAPMessage this context is for

        setCurrentMessage((Message)message);
    
public voidsetOperation(org.apache.axis.description.OperationDesc operation)
Set the current operation.

param
operation the Operation this context is executing

        currentOperation = operation;
    
public voidsetPassword(java.lang.String password)
Set the password.

param
password a String containing the new password

        this.password = password;
    
public voidsetPastPivot(boolean pastPivot)
Indicate when we've passed the pivot.

param
pastPivot true if we are past the pivot point, false otherwise

        havePassedPivot = pastPivot;
    
public voidsetProperty(java.lang.String name, java.lang.Object value)
Allows you to set a named property to the passed in value. There are a few known properties (like username, password, etc) that are variables in Call. The rest of the properties are stored in a Hashtable. These common properties should be accessed via the accessors for speed/type safety, but they may still be obtained via this method. It's up to one of the Handlers (or the Axis engine itself) to go looking for one of them.

param
name Name of the property
param
value Value of the property

        if (name == null || value == null) {
            return;
            // Is this right?  Shouldn't we throw an exception like:
            // throw new IllegalArgumentException(msg);
        }
        else if (name.equals(Call.USERNAME_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[] {
                        name, "java.lang.String", value.getClass().getName()}));
            }
            setUsername((String) value);
        }
        else if (name.equals(Call.PASSWORD_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[] {
                        name, "java.lang.String", value.getClass().getName()}));
            }
            setPassword((String) value);
        }
        else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
            if (!(value instanceof Boolean)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[]
                        {name,
                        "java.lang.Boolean",
                        value.getClass().getName()}));
            }
            setMaintainSession(((Boolean) value).booleanValue());
        }
        else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
            if (!(value instanceof Boolean)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[]
                        {name,
                        "java.lang.Boolean",
                        value.getClass().getName()}));
            }
            setUseSOAPAction(((Boolean) value).booleanValue());
        }
        else if (name.equals(Call.SOAPACTION_URI_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[]
                        {name,
                        "java.lang.String",
                        value.getClass().getName()}));
            }
            setSOAPActionURI((String) value);
        }
        else if (name.equals(Call.ENCODINGSTYLE_URI_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new IllegalArgumentException(
                        Messages.getMessage("badProp00", new String[]
                        {name,
                        "java.lang.String",
                        value.getClass().getName()}));
            }
            setEncodingStyle((String) value);
        }
        else {
            bag.put(name, value);
        }
    
public voidsetPropertyParent(java.util.Hashtable parent)
Set the Hashtable that contains the default values for our properties.

param
parent

        bag.setParent(parent);
    
public voidsetRequestMessage(Message reqMsg)
Set the request message, and make sure that message is associated with this MessageContext.

param
reqMsg the new request Message.

        requestMessage = reqMsg ;
        if (requestMessage != null) {
            requestMessage.setMessageContext(this);
        }
    
public voidsetResponseMessage(Message respMsg)
Set the response message, and make sure that message is associated with this MessageContext.

param
respMsg the new response Message.

        responseMessage = respMsg;
        if (responseMessage != null) {
            responseMessage.setMessageContext(this);

            //if we have received attachments of a particular type
            // than that should be the default type to send.
            Message reqMsg = getRequestMessage();
            if (null != reqMsg) {
                Attachments reqAttch = reqMsg.getAttachmentsImpl();
                Attachments respAttch = respMsg.getAttachmentsImpl();
                if (null != reqAttch && null != respAttch) {
                    if (respAttch.getSendType() == Attachments.SEND_TYPE_NOTSET)
                        //only if not explicity set.
                        respAttch.setSendType(reqAttch.getSendType());
                }
            }
        }
    
public voidsetRoles(java.lang.String[] roles)
Set the SOAP actor roles associated with an executioni of CodeHandlerChain and its contained Handler instances.

param
roles an array of String instances, each representing the URI for a SOAP actor role

        this.roles = roles;
    
public voidsetSOAPActionURI(java.lang.String SOAPActionURI)
Set the soapAction URI.

param
SOAPActionURI a String giving the new soap action URI
throws
IllegalArgumentException if the URI is not liked

        this.SOAPActionURI = SOAPActionURI;
    
public voidsetSOAPConstants(org.apache.axis.soap.SOAPConstants soapConstants)
Set the SOAPConstants used by this message context. This may also affect the encoding style.

param
soapConstants the new soap constants to use

        // when changing SOAP versions, remember to keep the encodingURI
        // in synch.
        if (this.soapConstants.getEncodingURI().equals(encodingStyle)) {
            encodingStyle = soapConstants.getEncodingURI();
        }

        this.soapConstants = soapConstants;
    
public voidsetSchemaVersion(org.apache.axis.schema.SchemaVersion schemaVersion)
Set the XML schema version this message context will use.

param
schemaVersion the new SchemaVersion

        this.schemaVersion = schemaVersion;
    
public voidsetService(org.apache.axis.handlers.soap.SOAPService sh)
Set the SOAPService used to handle services in this context. This method configures a wide range of MessageContext properties to suit the handler.

param
sh the new service handler
throws
AxisFault if the service could not be set

        log.debug("MessageContext: setServiceHandler("+sh+")");
        serviceHandler = sh;
        if (sh != null) {
            if(!sh.isRunning()) {
                throw new AxisFault(Messages.getMessage("disabled00"));
            }
            targetService = sh.getName();
            SOAPService service = sh;
            TypeMappingRegistry tmr = service.getTypeMappingRegistry();
            setTypeMappingRegistry(tmr);

            // styles are not "soap version aware" so compensate...
            setEncodingStyle(service.getUse().getEncoding());

            // This MessageContext should now defer properties it can't find
            // to the Service's options.
            bag.setParent(sh.getOptions());

            // Note that we need (or don't need) high-fidelity SAX recording
            // of deserialized messages according to the setting on the
            // new service.
            highFidelity = service.needsHighFidelityRecording();

            service.getInitializedServiceDesc(this);
        }
    
public voidsetSession(org.apache.axis.session.Session session)
Set the current session.

param
session the new Session

        this.session = session;
    
public voidsetTargetService(java.lang.String tServ)
Set the target service for this message.

This looks up the named service in the registry, and has the side effect of setting our TypeMappingRegistry to the service's.

param
tServ the name of the target service
throws
AxisFault if anything goes wrong in resolving or setting the service

        log.debug("MessageContext: setTargetService(" + tServ+")");

        if (tServ == null) {
            setService(null);
        }
        else {
            try {
                setService(getAxisEngine().getService(tServ));
            } catch (AxisFault fault) {
                // If we're on the client, don't throw this fault...
                if (!isClient()) {
                    throw fault;
                }
            }
        }
        targetService = tServ;
    
public voidsetTimeout(int value)
Set timeout in our MessageContext.

param
value the maximum amount of time, in milliseconds

        timeout = value;
    
public voidsetTransportName(java.lang.String transportName)
Set the transport name for this context.

param
transportName the name of the transport

        this.transportName = transportName;
    
public voidsetTypeMappingRegistry(org.apache.axis.encoding.TypeMappingRegistry reg)
Replace the engine's type mapping registry with a local one. This will have no effect on any type mappings obtained before this call.

param
reg the new TypeMappingRegistry


                                      
        
        mappingRegistry = reg;
    
public voidsetUseSOAPAction(boolean useSOAPAction)
Enable or dissable the use of soap action information. When enabled, the message context will attempt to use the soap action URI information during binding of soap messages to service methods. When dissabled, it will make no such attempt.

param
useSOAPAction true if soap action URI information should be used, false otherwise

        this.useSOAPAction = useSOAPAction;
    
public voidsetUsername(java.lang.String username)
Set the username.

param
username the new user name

        this.username = username;
    
public booleanuseSOAPAction()
Indicates wether the soap action URI is being used or not.

return
true if it is, false otherwise

        return useSOAPAction;