#include <BasicHandler.hpp>
Inheritance diagram for HandlerBase:
Public Member Functions | |
HandlerBase () | |
virtual | ~HandlerBase () |
virtual int AXISCALL | invoke (void *pMsg)=0 |
virtual void AXISCALL | onFault (void *mMsg)=0 |
virtual int AXISCALL | init ()=0 |
virtual int AXISCALL | fini ()=0 |
virtual int AXISCALL | getType ()=0 |
Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
|
Constructor. |
|
Destructor. |
|
The finalization tasks which needs to be performed within a Handler has to be written here. This method will be automatically called by the Axis Engine when it unloads a handler.
|
|
Gets and returns the type of the handler. The return value could be :
Implemented in Handler, and WrapperClassHandler.
|
|
The initialization tasks which needs to be performed within a Handler has to be written here. This method will be automatically called by the Axis Engine when it loads a handler.
|
|
The invoke method is automatically called by the Axis Engine when it needs to execute a Handler. The main task of the handler which a Handler writer expects the Handler to be performed needs to be written within the invoke method of the Handler. A example code segment within a invoke method which is written to process a SOAP Header is as following: int ESHHandler::invoke(void *pvIMsg) { IMessageData *pIMsg = (IMessageData*) pvIMsg; AxisChar* pachTemp; if(pIMsg->isPastPivot()) { //this is a response
IHandlerSoapSerializer* pISZ; pIMsg->getSoapSerializer(&pISZ);
IHeaderBlock* pIHeaderBlock= pISZ->createHeaderBlock();
pIHeaderBlock->setLocalName("echoMeStringResponse"); pIHeaderBlock->setURI("http://soapinterop.org/echoheader/");
pachTemp = "EchoStringHeaderHandlerPr1.id";
const AxisChar* pachHeaderVal = pIMsg->getProperty(pachTemp); printf("in the ESHHandler::Invoke : %s\n",pachHeaderVal);
BasicNode* pBasicNode = pIHeaderBlock->createChild(CHARACTER_NODE); pBasicNode->setValue(pachHeaderVal);
pIHeaderBlock->addChild(pBasicNode);
} else { //this is a request
IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer; pIMsg->getSoapDeSerializer(&pIHandlerSoapDeSerializer);
IHeaderBlock* pIHeaderBlock= pIHandlerSoapDeSerializer->getHeaderBlock("echoMeString", "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; } In case of a Web Service Handler the invoke method should do what is required by a web service invoke method, which is different from the above shown example.
|
|
Called when ever a fault is occured within the handler. The tasks which needs to be persormed when ever an error occurs within a Handler has to be written within this method.
|