\section{Handler\-Base Class Reference}
\label{classHandlerBase}\index{HandlerBase@{HandlerBase}}
interface for the Handlers. This is the base class for: -{\bf Handler} {\rm (p.\,\pageref{classHandler})} -{\bf Wrapper\-Class\-Handler} {\rm (p.\,\pageref{classWrapperClassHandler})} In the Axis Architecture there are different types of Handlers : -NORMAL\_\-HANDLER : A {\bf Handler} {\rm (p.\,\pageref{classHandler})} which is used to process SOAP Headers. -WEBSERVICE\_\-HANDLER : A web service is also considered as a {\bf Handler} {\rm (p.\,\pageref{classHandler})}. -CHAIN\_\-HANDLER : {\bf Handler} {\rm (p.\,\pageref{classHandler})} Chains are also derived from {\bf Handler} {\rm (p.\,\pageref{classHandler})}. Each of these handlers will inherit from this Handler\-Base which serves as the base point for all the different types of Handlers. 


{\tt \#include $<$Basic\-Handler.h$>$}

Inheritance diagram for Handler\-Base::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classHandlerBase}
\end{center}
\end{figure}
\subsection*{Public Methods}
\begin{CompactItemize}
\item 
{\bf Handler\-Base} ()
\item 
virtual {\bf $\sim$Handler\-Base} ()
\item 
virtual int AXISCALL {\bf invoke} (void $\ast$p\-Msg)=0
\item 
virtual void AXISCALL {\bf on\-Fault} (void $\ast$m\-Msg)=0
\item 
virtual int AXISCALL {\bf init} ()=0
\item 
virtual int AXISCALL {\bf fini} ()=0
\item 
virtual int AXISCALL {\bf get\-Type} ()=0
\end{CompactItemize}


\subsection{Detailed Description}
interface for the Handlers. This is the base class for: -{\bf Handler} {\rm (p.\,\pageref{classHandler})} -{\bf Wrapper\-Class\-Handler} {\rm (p.\,\pageref{classWrapperClassHandler})} In the Axis Architecture there are different types of Handlers : -NORMAL\_\-HANDLER : A {\bf Handler} {\rm (p.\,\pageref{classHandler})} which is used to process SOAP Headers. -WEBSERVICE\_\-HANDLER : A web service is also considered as a {\bf Handler} {\rm (p.\,\pageref{classHandler})}. -CHAIN\_\-HANDLER : {\bf Handler} {\rm (p.\,\pageref{classHandler})} Chains are also derived from {\bf Handler} {\rm (p.\,\pageref{classHandler})}. Each of these handlers will inherit from this Handler\-Base which serves as the base point for all the different types of Handlers.

\begin{Desc}
\item[Author: ]\par
Susantha Kumara ({\tt skumara@virtusa.com}) , Roshan Weerasuriya ({\tt roshan@opensource.lk}, {\tt roshanw@jkcsworld.com}) \end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{HandlerBase@{Handler\-Base}!HandlerBase@{HandlerBase}}
\index{HandlerBase@{HandlerBase}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Handler\-Base::Handler\-Base ()\hspace{0.3cm}{\tt  [inline]}}\label{classHandlerBase_a0}


Constructor. \index{HandlerBase@{Handler\-Base}!~HandlerBase@{$\sim$HandlerBase}}
\index{~HandlerBase@{$\sim$HandlerBase}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Handler\-Base::$\sim$Handler\-Base ()\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classHandlerBase_a1}


Destructor. 

\subsection{Member Function Documentation}
\index{HandlerBase@{Handler\-Base}!fini@{fini}}
\index{fini@{fini}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int AXISCALL Handler\-Base::fini ()\hspace{0.3cm}{\tt  [pure virtual]}}\label{classHandlerBase_a5}


The finalization tasks which needs to be performed within a {\bf Handler} {\rm (p.\,\pageref{classHandler})} has to be written here. This method will be automatically called by the Axis Engine when it unloads a handler.

\begin{Desc}
\item[Returns: ]\par
AXIS\_\-SUCCESS or AXIS\_\-FAIL to indicate success or fail. \end{Desc}
\index{HandlerBase@{Handler\-Base}!getType@{getType}}
\index{getType@{getType}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int AXISCALL Handler\-Base::get\-Type ()\hspace{0.3cm}{\tt  [pure virtual]}}\label{classHandlerBase_a6}


Gets and returns the type of the handler. The return value could be :\begin{CompactItemize}
\item 
NORMAL\_\-HANDLER\item 
WEBSERVICE\_\-HANDLER\item 
CHAIN\_\-HANDLER\end{CompactItemize}
\begin{Desc}
\item[Returns: ]\par
This returns the following depending on the actual {\bf Handler} {\rm (p.\,\pageref{classHandler})} type:\begin{CompactItemize}
\item 
NORMAL\_\-HANDLER : In case of a normal {\bf Handler} {\rm (p.\,\pageref{classHandler})} which is used to process SOAP Headers.\item 
WEBSERVICE\_\-HANDLER : In case of a Web Service.\item 
CHAIN\_\-HANDLER : In case of a Handler\-Chain \end{CompactItemize}
\end{Desc}


Implemented in {\bf Handler} {\rm (p.\,\pageref{classHandler_a4})}, and {\bf Wrapper\-Class\-Handler} {\rm (p.\,\pageref{classWrapperClassHandler_a3})}.\index{HandlerBase@{Handler\-Base}!init@{init}}
\index{init@{init}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int AXISCALL Handler\-Base::init ()\hspace{0.3cm}{\tt  [pure virtual]}}\label{classHandlerBase_a4}


The initialization tasks which needs to be performed within a {\bf Handler} {\rm (p.\,\pageref{classHandler})} has to be written here. This method will be automatically called by the Axis Engine when it loads a handler.

\begin{Desc}
\item[Returns: ]\par
AXIS\_\-SUCCESS or AXIS\_\-FAIL to indicate success or fail. \end{Desc}
\index{HandlerBase@{Handler\-Base}!invoke@{invoke}}
\index{invoke@{invoke}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int AXISCALL Handler\-Base::invoke (void $\ast$ {\em p\-Msg})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classHandlerBase_a2}


The invoke method is automatically called by the Axis Engine when it needs to execute a {\bf Handler} {\rm (p.\,\pageref{classHandler})}. The main task of the handler which a {\bf Handler} {\rm (p.\,\pageref{classHandler})} writer expects the {\bf Handler} {\rm (p.\,\pageref{classHandler})} to be performed needs to be written within the invoke method of the {\bf Handler} {\rm (p.\,\pageref{classHandler})}.

A example code segment within a invoke method which is written to process a SOAP Header is as following: \small\begin{alltt}
 int ESHHandler::invoke(void *pvIMsg)
 \{
 IMessageData *pIMsg = (IMessageData*) pvIMsg;
    AxisChar* pachTemp;
    if(pIMsg->isPastPivot()) \{
        //this is a response

        {\bf IHandlerSoapSerializer} {\rm (p.\,\pageref{classIHandlerSoapSerializer})}* pISZ;
        pIMsg->getSoapSerializer(&pISZ);

        {\bf IHeaderBlock} {\rm (p.\,\pageref{classIHeaderBlock})}* pIHeaderBlock= pISZ->createHeaderBlock();

        pIHeaderBlock->setLocalName("echoMeStringResponse");
        pIHeaderBlock->setUri("{\tt http://soapinterop.org/echoheader/}");

        pachTemp = "EchoStringHeaderHandlerPr1.id";

        const AxisChar* pachHeaderVal = pIMsg->getProperty(pachTemp);
        printf("in the ESHHandler::Invoke : s\par
",pachHeaderVal);

        BasicNode* pBasicNode = pIHeaderBlock->createChild(CHARACTER_NODE);
        pBasicNode->setValue(pachHeaderVal);

        pIHeaderBlock->addChild(pBasicNode);

 \} else \{
        //this is a request

        IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;
        pIMsg->getSoapDeSerializer(&pIHandlerSoapDeSerializer);

        {\bf IHeaderBlock} {\rm (p.\,\pageref{classIHeaderBlock})}* pIHeaderBlock= pIHandlerSoapDeSerializer->getHeaderBlock("echoMeString", "{\tt http://soapinterop.org/echoheader/}");

        if (pIHeaderBlock != NULL) \{

            const BasicNode* pBasicNode= pIHeaderBlock->getFirstChild();

            const AxisChar* pachHeaderValue;

            if (pBasicNode != NULL)
            \{
                if((pBasicNode->getNodeType()) == CHARACTER_NODE) \{
                    pachHeaderValue= pBasicNode->getValue();
                \} else \{
                    pachHeaderValue = "This was not the expected value Ros";
                \}
            \} else
            \{
                pachHeaderValue = "pBascNode is NULL";
            \}

            AxisChar* pachTmpValue = (AxisChar*) malloc(strlen(pachHeaderValue) + 4);
            strcpy(pachTmpValue, pachHeaderValue);

            pachTemp = "EchoStringHeaderHandlerPr1.id";
            pIMsg->setProperty(pachTemp, pachTmpValue);

            free(pachTmpValue);


        \} else \{
            //do some thing
        \}

    \}

    return AXIS_SUCCESS;
    \}
 \end{alltt}\normalsize 


In case of a Web Service {\bf Handler} {\rm (p.\,\pageref{classHandler})} the invoke method should do what is required by a web service invoke method, which is different from the above shown example.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
p\-Msg}]The Message\-Data object pointer. This Message\-Data object is passed to every handler when serving to a client request. The handler writer can get access to objects such as:\begin{CompactItemize}
\item 
IHandler\-Soap\-De\-Serializer\item 
{\bf IHandler\-Soap\-Serializer} {\rm (p.\,\pageref{classIHandlerSoapSerializer})}\item 
The properties/data/info which are set by other handlers\item 
The properties/data/info which is set by the Client {\bf Stub} {\rm (p.\,\pageref{classStub})} in case the {\bf Handler} {\rm (p.\,\pageref{classHandler})} is a Client side {\bf Handler} {\rm (p.\,\pageref{classHandler})}. etc. \end{CompactItemize}
\end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
AXIS\_\-SUCCESS or AXIS\_\-FAIL to indicate success or fail. \end{Desc}
\index{HandlerBase@{Handler\-Base}!onFault@{onFault}}
\index{onFault@{onFault}!HandlerBase@{Handler\-Base}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void AXISCALL Handler\-Base::on\-Fault (void $\ast$ {\em m\-Msg})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classHandlerBase_a3}


Called when ever a fault is occured within the handler. The tasks which needs to be persormed when ever an error occurs within a {\bf Handler} {\rm (p.\,\pageref{classHandler})} has to be written within this method.\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
m\-Msg}]The Message\-Data object pointer. This Message\-Data object is passed to every handler when serving to a client request. The handler writer can get access to objects such as:\begin{CompactItemize}
\item 
IHandler\-Soap\-De\-Serializer\item 
{\bf IHandler\-Soap\-Serializer} {\rm (p.\,\pageref{classIHandlerSoapSerializer})} etc. \end{CompactItemize}
\end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
AXIS\_\-SUCCESS or AXIS\_\-FAIL to indicate success or fail. \end{Desc}


The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf Basic\-Handler.h}\end{CompactItemize}
