You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by ro...@apache.org on 2004/12/06 11:50:24 UTC

cvs commit: ws-site/targets/axis/cpp/arch handler.pdf handler.html

roshan      2004/12/06 02:50:23

  Added:       targets/axis/cpp/arch handler.pdf handler.html
  Log:
  Added the handler tutorial to the site.
  
  Revision  Changes    Path
  1.1                  ws-site/targets/axis/cpp/arch/handler.pdf
  
  	<<Binary file>>
  
  
  1.1                  ws-site/targets/axis/cpp/arch/handler.html
  
  Index: handler.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <!--*** This is a generated file.  Do not edit.  ***-->
  <link rel="stylesheet" href="../../skin/tigris.css" type="text/css">
  <link rel="stylesheet" href="../../skin/mysite.css" type="text/css">
  <link rel="stylesheet" href="../../skin/site.css" type="text/css">
  <link media="print" rel="stylesheet" href="../../skin/print.css" type="text/css">
  <title>Handler Tutorial</title>
  </head>
  <body bgcolor="white" class="composite">
  <!--================= start Banner ==================-->
  <div id="banner">
  <table width="100%" cellpadding="8" cellspacing="0" summary="banner" border="0">
  <tbody>
  <tr>
  <!--================= start Group Logo ==================-->
  <td align="left">
  <div class="groupLogo">
  <a href="http://ws.apache.org/"><img border="0" class="logoImage" alt="The Apache WebServices Project" src="../../images/project-logo.jpg"></a>
  </div>
  </td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td align="right">
  <div class="projectLogo">
  <a href="http://ws.apache.org/axis/"><img border="0" class="logoImage" alt="The Apache Axis Project" src="../../images/axis.jpg"></a>
  </div>
  </td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" align="right" class="search">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td bgcolor="#a5b6c6" colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="3"><img height="8" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org" name="sitesearch" type="hidden"><input size="10" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="GO" type="submit">
  <br>
                            Search WS</td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="3"><img height="7" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td class="bottom-left-thick"></td><td bgcolor="#a5b6c6"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td class="bottom-right-thick"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= end Search ==================-->
  </tr>
  </tbody>
  </table>
  </div>
  <!--================= end Banner ==================-->
  <!--================= start Main ==================-->
  <table width="100%" cellpadding="0" cellspacing="0" border="0" summary="nav" id="breadcrumbs">
  <tbody>
  <!--================= start Status ==================-->
  <tr class="status">
  <td>
  <!--================= start BreadCrumb ==================--><a href="http://www.apache.org/">Apache</a> | <a href="http://ws.apache.org/">WS</a><a href=""></a>
  <!--================= end BreadCrumb ==================--></td><td id="tabs">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <span class="selectedTab"><a class="base-selected" href="../../index.html">WebServices-Axis</a></span>
  </div>
  <!--================= end Tabs ==================-->
  </td>
  </tr>
  </tbody>
  </table>
  <!--================= end Status ==================-->
  <table id="main" width="100%" cellpadding="8" cellspacing="0" summary="" border="0">
  <tbody>
  <tr valign="top">
  <!--================= start Menu ==================-->
  <td id="leftcol">
  <div id="navcolumn">
  <div class="menuBar">
  <div class="menu">
  <span class="menuLabel">Axis</span>
   
  <div class="menuItem">
  <a href="../../index.html">Introduction</a>
  </div>
   
  <div class="menuItem">
  <a href="../../news.html">News</a>
  </div>
  
   
  <div class="menuItem">
  <a href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages">FAQ/Wiki</a>
  </div>
   
  <div class="menu">
  <span class="menuLabel">Get Involved</span>
    
  <div class="menuItem">
  <a href="../../overview.html">Overview</a>
  </div>
    
  <div class="menuItem">
  <a href="../../cvs.html">CVS Repository</a>
  </div>
    
  <div class="menuItem">
  <a href="../../mail.html">Mailing Lists</a>
  </div>
    
  <div class="menuItem">
  <a href="../../ref.html">Reference Library</a>
  </div>
    
  <div class="menuItem">
  <a href="../../bugs.html">Bugs</a>
  </div>
    
  <div class="menuItem">
  <a href="../../howtobuild.html">HowToBuildSite</a>
  </div>
   
  </div>
   
  <div class="menu">
  <span class="menuLabel">Axis (Java)</span>
    
  <div class="menuItem">
  <a href="../../java/index.html">Documentation</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/install.html">Installation</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/user-guide.html">User's Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/developers-guide.html">Developer's Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/integration-guide.html">Integration Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/architecture-guide.html">Architecture Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/reference.html">Reference Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/reading.html">Reading Guide</a>
  </div>
    
  <div class="menuItem">
  <a href="../../java/requirements.html">Requirements</a>
  </div>
   
  </div>
   
  <div class="menu">
  <span class="menuLabel">Axis (C++)</span>
    
  <div class="menuItem">
  <a href="../../cpp/index.html">Latest Axis C++ Release!</a>
  </div>
    
  <div class="menuItem">
  <a href="../../cpp/documentation.html">Documentation</a>
  </div>
    
  <div class="menuItem">
  <a href="../../cpp/download.html">Download</a>
  </div>
    
  <div class="menuItem">
  <a href="http://nagoya.apache.org/wiki/apachewiki.cgi?AxisCPPProjectPages">Wiki Pages</a>
  </div>
    
  <div class="menuItem">
  <a href="../../cpp/who.html">Who we are</a>
  </div>
    
  </div>
  
  <div class="menu">
  <span class="menuLabel">Downloads</span>
    
  <div class="menuItem">
  <a href="../../releases.html">Releases</a>
  </div>
    
  <div class="menuItem">
  <a href="../../interim.html">Interim Drops</a>
  </div>
    
  <div class="menuItem">
  <a href="http://cvs.apache.org/viewcvs/ws-axis/">Source Code</a>
  </div>
  
  </div>
  
  <div class="menu">
  <span class="menuLabel">Translation</span>
    
  <div class="menuItem">
  <a href="http://ws.apache.org/axis/jp/">Japanese (Unofficial)</a>
  </div>
  
  </div>
  
  <div class="menu">
  <span class="menuLabel">Related Projects</span>
    
  <div class="menuItem">
  <a href="http://ws.apache.org/wsif/">WSIF</a>
  </div>
    
  <div class="menuItem">
  <a href="http://cvs.apache.org/viewcvs/*checkout*/ws-wsil/java/README.htm">WSIL</a>
  </div>
    
  <div class="menuItem">
  <a href="http://www-124.ibm.com/developerworks/projects/wsdl4j/">WSDL4J</a>
  </div>
    
  <div class="menuItem">
  <a href="http://www.uddi4j.org/">UDDI4J</a>
  </div>
  
  </div>
  
  <div class="menu">
  <span class="menuLabel">Misc</span>
    
  <div class="menuItem">
  <a href="../../site.html">Whole Site</a>
  </div>
    
  <div class="menuItem">
  <a href="../../who.html">Who We Are</a>
  </div>
    
  <div class="menuItem">
  <a href="../../contact.html">Contact</a>
  </div>
    
  <div class="menuItem">
  <a href="../../legal.html">Legal</a>
  </div>
    
  <div class="menuItem">
  <a href="../../docs.html">Notes/Docs</a>
  </div>
  
  </div>
  
  
  </div>
  </div>
  </div>
  </td>
  <!--================= end Menu ==================-->
  <!--================= start Content ==================--><td>
  <div id="bodycol">
  <div class="app">
  <div align="center">
  <h1>Handler Tutorial</h1>
  </div>
  <div class="h3">
  <div class="h3">
  <h3>Handler Tutorial</h3>
  </div>
  <p>
  <a href="#linux">For Linux</a>
  <br>
  <br> 
  <a href="#windows">For Windows</a>
  <br>
  <br>
  </p>
  <br>
  <p>
  <a name="#linux"></a>
  </p>
  <div class="h3">
  <h3>Linux</h3>
  </div>
  <p>
  <a href="#introduction">Introduction to Handlers</a>
  <br>
  <br>
  <a href="#sample">Sample Handlers (building, running)</a>
  <br>
  <br>
  <a href="#creating">Creating your own Handlers</a>
  <br>
  <br>
  <a href="#API">API Notes for Handler writers</a>
  <br>
  <br>
  </p>
  <p></p>
  <p>Handlers are pluggable components in Axis C++. We have included a set of sample handlers for your reference. You could write your own handlers by following the instructions given for the sample Handlers.<br>
  <br> 
  <strong>Note: If you are using Client side Handlers you need to enter the following entry to the [Axis_Folder]/axiscpp.conf configuration file.</strong>
  <br>
  <br>ClientWSDDFilePath:xxx<br>
  <br>Here xxx should be the path to the &ldquo;client.wsdd&rdquo; file.<br>
  </p>
  <p>
  <a name="#sample"></a>
  </p>
  <p>
  <strong>Testing the sample Handlers</strong>
  </p>
  <br>
  <p>We have included the following sample Handlers for your reference.<br>
  <br> 1) echoStringHeaderHandler (A server side handler sample)<br> This sample handler will simply echo (i.e send back) the string which you send in the SOAP Header in the SOAP request.<br>
  <br>2)testHandler (A client side handler sample)<br>
  <br> This sample handler will simply add a SOAP Header to the generated SOAP request.<br>
  <br> Please note that these are very primitive sample handlers and are presented here to give you an idea about writing your own Handlers.<br>
  </p>
  <p>
  <strong>echoStringHeaderHandler</strong>
  <br>
  <br>
  <strong>Building the Sample Handlers in RedHat linux</strong>
  <br>
  <br> 
  <strong>Building echoStringHeaderHandler</strong> (A server side handler sample)<br>
  <br>The build files are available at<br>
  <br>AXISCPP_HOME/samples/server/echoStringHeaderHandler.<br>Change your current directory to this directory and then you could execute the following.<br>
  <br> make<br>
  <br> make install<br>
  <br>The handler so file will be created at $AXISCPP_DEPLOY/lib directory<br>
  <br> 
  <strong>Configuring the Handler</strong>
  <br>
  <br>Now edit the AXISCPP_DEPLOY/etc/server.wsdd to include the handler for a particular service.<br>
  <br>
  </p>
  <p>&lt;service name="Calculator" provider="CPP:RPC" description="Simple Calculator Axis C++ Service "&gt;<br>&lt;requestFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="ESHHandler" type="AXIS_HOME/handlers/custom/echoStringHeaderHandler/libeshhandler.so"&gt;<br>&lt;/handler&gt;<br>&lt;/requestFlow&gt;<br>&lt;responseFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="ESHHandler" type="AXISCPP_DEPLOY/lib/libeshhandler.so"&gt;<br>&lt;/handler&gt;<br>&lt;/responseFlow&gt;<br>&lt;parameter name="allowedMethods" value="add sub mul div "/&gt;<br>&lt;parameter name="className" value="Axis\webservices\Calculator.dll" /&gt;<br>&lt;/service&gt;<br>
  </p>
  <p>
  <strong>Note:</strong> Make sure you specify the correct path of the handler so in the server.wsdd file. Replace the AXISCPP_DEPLOY with the exact relative path which AXISCPP_DEPLOY points to. (eg: type="/usr/local/axiscpp_deploy/etc/libeshhandler.so )<br>
  <br>Now you are almost done to run your server side handler.<br>Restart the Apache server and that's it.<br>
  <br>
  <strong>Running the Handler</strong>
  <br>
  <br>Since this Handler is configured to the Calculator web service in the above step, this Handler will be executed when a client send a SOAP request to the Calculator web service.<br>
  <br> 
  <strong>testHandler</strong>
  <br>
  <br>
  <strong>Building the Sample Handlers in RedHat linux</strong>
  <br>
  <br> 
  <strong>Building testHandler</strong> (A client side handler sample)<br>
  <br>The build files are available at AXISCPP_HOME/samples/client/testHandler. Change your current directory to this direcotory and then you could execute the following.<br>
  <br> make<br>
  <br> make install<br>
  <br>The handler so file will be created at $AXISCPP_DEPLOY/lib/.<br>
  <br> 
  <strong>Configuring the Handler</strong>
  <br>
  <br> Now edit the AXISCPP_DEPLOY/etc/client.wsdd to include the handler for a particular service.</p>
  <p>&lt;service name="Calculator" provider="CPP:RPC" description="Calculator web service"&gt;<br>&lt;requestFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="TestHandler" type="AXISCPP_DEPLOY/lib/libtest_client_handler.so"&gt;<br>&lt;/handler&gt;<br>&lt;/requestFlow&gt;<br>&lt;/service&gt;</p>
  <p>
  <strong>Note:</strong> Make sure you specify the correct path of the handler so in the client.wsdd file. Replace the AXISCPP_DEPLOY with the exact relative path which AXISCPP_DEPLOY points to. (eg: type="/usr/local/axiscpp_deploy/lib/libtest_client_handler.so)<br>
  <br> Now you are almost done to run your client side handler.<br>
  <br>
  <strong>Note:</strong> If you are using Client side Handlers you need to enter the  entry in the AXISCPP_DEPLOY/etc/axiscpp.conf configuration file. (See above)<br>
  <br>
  <strong>Running the Handler</strong>
  <br>
  <br>Since this Handler is configured to the Calculator web service in the above step, this Handler will be executed when you run the calculator web service client. (It is at AXISCPP_DEPLOY/bin/calculator )</p>
  <p>
  <a name="#creating"></a>
  </p>
  <p>
  <strong>Handler Notes:</strong>
  <br>1) You can see the Handler behavior through the TCP Monitor. (TCP Monitor is a Axis Java tool)<br>2) To get an idea of Handlers look at the Handler sample source files.<br> a. echoStringHeaderHandler (AXISCPP_HOME/samples/server/echoStringHeaderHandler)<br> b. testHandler (AXISCPP_HOME/samples/client/testHandler)</p>
  <p>
  <a name="#API"></a>
  </p>
  <br>
  <p>
  <strong>The Handler API and details for Handler writers</strong>
  <br>
  <br> Now you have seen some sample Handlers so that you can explore more on Handlers. The following sections helps you for the same.<br>
  <br> In order to get access to the DeSerializer the handler writer can use the following code block.<br>
  <br>
  </p>
  <p>// -----<br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>.....<br>-------//<br>
  <br>
  </p>
  <p>In order to get access to a incoming HeaderBlock the handler writer can use the following code block.<br>
  <br> // -----<br>.....<br>IHeaderBlock* pIHeaderBlock= pIHandlerSoapDeSerializer-&gt;getHeaderBlock("echoMeString", "http://soapinterop.org/echoheader/");<br>.....<br>-------//</p>
  <p>In order to manipulate the above accessed HeaderBlock the handler writer can use the following code block.<br>
  <br> // -----<br>.....<br>if (pIHeaderBlock != NULL) {<br>
  <br> &nbsp;&nbsp;&nbsp;const BasicNode* pBasicNode= pIHeaderBlock-&gt;getFirstChild();<br>
  <br> &nbsp;&nbsp;&nbsp;const AxisChar* pachHeaderValue;<br>
  <br> &nbsp;&nbsp;&nbsp;if (pBasicNode != NULL)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if((pBasicNode-&gt;getNodeType()) == CHARACTER_NODE) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pachHeaderValue= pBasicNode-&gt;getValue();<br>&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pachHeaderValue = "This was not the expected value Ros";<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;} else<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pachHeaderValue = "pBascNode is NULL";<br>&nbsp;&nbsp;&nbsp; }<br>
  <br> &nbsp;&nbsp;&nbsp;AxisChar* pachTmpValue = (AxisChar*) malloc(strlen(pachHeaderValue) + 4);<br>&nbsp;&nbsp;&nbsp;strcpy(pachTmpValue, pachHeaderValue);<br>
  <br> &nbsp;&nbsp;&nbsp;pachTemp = "EchoStringHeaderHandlerPr1.id";<br>&nbsp;&nbsp;&nbsp;pIMsg-&gt;setProperty(pachTemp, pachTmpValue);<br>
  <br> &nbsp;&nbsp;&nbsp;free(pachTmpValue);<br>
  <br> &nbsp;&nbsp;&nbsp;} else {<br>
  <br>&nbsp;&nbsp;&nbsp;//do some thing<br>&nbsp;&nbsp;&nbsp;//AxisChar* pachTmpValue = "Default values since no reqeust SOAP header";<br>&nbsp;&nbsp;&nbsp;//pachTemp = "EchoStringHeaderHandlerPr1.id";<br>&nbsp;&nbsp;&nbsp; //pIMsg-&gt;setProperty(pachTemp, pachTmpValue);<br>
  <br> &nbsp;&nbsp;&nbsp;//free(pachTmpValue);<br>&nbsp;&nbsp;&nbsp;}<br>
  </p>
  <p>.....<br>-------//<br>
  <br> In order to get access to the incoming SOAP Body the handler writer can use the following code block.<br>
  <br> To get the body as a AxisChar*<br>
  <br> // -----<br>
  <br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>AxisChar* pSoapBody = pIHandlerSoapDeSerializer-&gt;getBodyAsChar();<br>.....<br>-------//<br>
  <br> To get the body as a decoded base64 stream.<br>// -----<br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>xsd__base64Binary bb = pIHandlerSoapDeSerializer-&amp;gtgetBodyAsBase64Binary();<br>.....<br>-------//</p>
  <p>
  <strong>Notes:</strong>
  <br>Have a look at the following classes at the API docs to see all the available functions and their respective descriptions. (You can even look at the relevent .h/.hpp header files for the API comments)<br>IhandlerSoapDeSerializer<br>IHeaderBlock<br>BasicNode<br>
  </p>
  <p>The BasicNode API is similar (not exactly the same, but ..) to the DOM and is written as a tree traversing API.<br>
  <br> With the sample code samples provided above and with the API notes a developer will easily be able to write and play around his/her own Handlers.<br>
  <br> This tutorial will be updated frequently with the new additions and specially with your suggestions.<br>
  <br>
  </p>
  <p>
  <a name="#windows"></a>
  </p>
  <div class="h3">
  <h3>Windows</h3>
  </div>
  <br>
  <br>
  <p>
  <a href="#introd">Introduction to Handlers</a>
  <br>
  <br>
  <a href="#sam">Sample Handlers (building, running)</a>
  <br>
  <br>
  <a href="#create">Creating your own Handlers</a>
  <br>
  <br>
  <a href="#APP">API Notes for Handler writers</a>
  <br>
  <br>
  </p>
  <p></p>
  <p>Handlers are pluggable components in Axis C++. We have included a set of sample handlers for your reference.<br>
  <br>You could write your own handlers by following the instructions given for the sample Handlers.<br>
  <br>
  <strong>Note: If you are using Client side Handlers you need to enter the following entry to the [Axis_Folder]/axiscpp.conf configuration file.</strong>
  <br>
  <br>ClientWSDDFilePath:Axis\conf\client.wsdd<br>
  <br>After entering this entry to your [Axis_Folder]/axiscpp.conf configuration file will look like:<br>
  <br>LogPath:Axis\logs\AxisLog.txt<br>WSDDFilePath:Axis\conf\server.wsdd<br>ClientWSDDFilePath:Axis\conf\client.wsdd<br>
  <br>
  </p>
  <p>
  <a name="#sam"></a>
  </p>
  <p>
  <strong>Testing the sample Handlers</strong>
  <br>
  <br>We have included the following sample Handlers for your reference.<br>
  <br>1) <strong>echoStringHeaderHandler</strong> (A server side handler sample)<br>
  <br>This sample handler will simply echo (i.e send back) the string which you send in the SOAP Header in the SOAP request.<br>
  <br>2)<strong>testHandler</strong> (A client side handler sample)<br>
  <br>This sample handler will simply add a SOAP Header to the generated SOAP request.<br>Please note that these are very primitive sample handlers and are presented here to give you an idea about writing your own Handlers.<br>
  <br>
  <strong>echoStringHeaderHandler</strong>
  <br>
  <br>
  <strong>Building the Sample Handlers in VC</strong>
  <br>
  </p>
  <p>
  <strong>Building echoStringHeaderHandler</strong> (A server side handler sample)<br>
  <br>The VC dsw file (ServerHandlers.dsw) is available at Axis_Extract/vc/samples/server/ ServerHandlers.dsw.<br>Open this file and build the project echoStringHeaderHandler. Once the build is successful you will find the DLL (echoStringHeaderHandler.dll) at Axis_Extract/bin.<br> If you see this DLL at the above location you are done with the first step.<br>
  <br>
  <strong>Configuring the Handler</strong>
  <br>
  <br>Now edit the [Axis_Folder]/conf/server.wsdd to include the handler for a particular service.<br>
  </p>
  <p>&lt;service name="Calculator" provider="CPP:RPC" description="Simple Calculator Axis C++ Service "&gt;<br>&lt;requestFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="ESHHandler" type="[Axis_Extract]/bin/echoStringHeaderHandler.dll"&gt;<br>&lt;/handler&gt;<br>&lt;/requestFlow&gt;<br>&lt;responseFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="ESHHandler" type="[Axis_Extract]/bin/echoStringHeaderHandler.dll"&gt;<br>&lt;/handler&gt;<br>&lt;/responseFlow&gt;<br>&lt;parameter name="allowedMethods" value="add sub mul div "/&gt;<br>&lt;parameter name="className" value="Axis\webservices\Calculator.dll" /&gt;<br>&lt;/service&gt;<br>
  <br>
  <strong>Note:</strong> Make sure you specify the correct path of the handler dll in the server.wsdd file.<br>Now you are almost done to run your server side handler.<br>Restart the Apache server.<br>
  <br>
  </p>
  <p>
  <strong>Running the Handler</strong>
  <br>
  <br>Since this Handler is configured to the Calculator web service in the above step, this Handler will be executed when a client send a SOAP request to the Calculator web service.<br>
  <br>
  <strong>testHandler</strong>
  <br>
  <br>
  <strong>Building the Sample Handlers in VC</strong>
  <br>
  <br>
  <strong>Building testHandler</strong> (A client side handler sample)<br>
  <br>The VC dsw file <strong>(ClientHandlers.dsw)</strong> is available at Axis_Extract/vc/samples/client/ClientHandlers.dsw.Open this file and build the project TestHandler.<br>Once the build is successful you will find the DLL testHandler.dll) at Axis_Extract/bin. If you see this DLL at the above location you are done with the first step.<br>
  <br>
  <strong>Configuring the Handler</strong>
  <br>
  <br>Now edit the [Axis_Folder]/conf/client.wsdd to include the handler for a particular service.<br>
  </p>
  <p>&lt;service name="Calculator" provider="CPP:DOCUMENT" description="Calculator web service"&gt;<br>&lt;requestFlow name="CalculatorHandlers"&gt;<br>&lt;handler name="TestHandler" type="[Axis_Extract]/bin/testHandler.dll"&gt;<br>&lt;/handler&gt;<br>&lt;/requestFlow&gt;<br>&lt;/service&gt;</p>
  <p>
  <strong>Note:</strong> Make sure you specify the correct path of the handler dll in the client.wsdd file.<br>Now you are almost done to run your client side handler.<br>
  <br>
  <strong>Note: If you are using Client side Handlers you need to enter the ClientWSDDFilePath entry in the [Axis_Folder]/axiscpp.conf configuration file. (See above)</strong> Running the Handler<br>
  <br>Since this Handler is configured to the Calculator web service in the above step, this Handler will be executed when you run the calculator web service client. (It is at [Axis_Extract]/bin/Calculator.exe)<br>
  <br>
  </p>
  <p>
  <a name="#create"></a>
  </p>
  <p>Handler Notes:<br>
  <br>1) You can see the Handler behavior through the TCP Monitor. (TCP Monitor is a Axis Java tool)<br>
  <br>2) To get an idea of Handlers look at the Handler sample source files.<br>
  <br>a. echoStringHeaderHandler ([Axis_Extract]/samples/server/echoStringHeaderHandler)<br>
  <br>b. testHandler ([Axis_Extract]/samples/client/testHandler)<br>
  <br>
  </p>
  <p></p>
  <p>
  <strong>The Handler API and details for Handler writers</strong>
  <br>
  <br> Now you have seen some sample Handlers so that you can explore more on Handlers. The following sections helps you for the same.<br>
  <br> In order to get access to the DeSerializer the handler writer can use the following code block.<br>
  <br>
  </p>
  <p>// -----<br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>
  <br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>
  <br>.....<br>-------//<br>
  <br> In order to get access to a incoming HeaderBlock the handler writer can use the following code block.<br>
  <br> // -----<br>.....<br>IHeaderBlock* pIHeaderBlock= pIHandlerSoapDeSerializer-&gt;getHeaderBlock("echoMeString", "http://soapinterop.org/echoheader/");<br>.....<br>-------//<br>
  </p>
  <p>In order to manipulate the above accessed HeaderBlock the handler writer can use the following code block.<br>
  <br> // -----<br>.....<br>if (pIHeaderBlock != NULL) {<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;const BasicNode* pBasicNode= pIHeaderBlock-&gt;getFirstChild();<br> &nbsp;&nbsp;&nbsp;&nbsp;const AxisChar* pachHeaderValue;<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;if (pBasicNode != NULL)<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;if((pBasicNode-&gt;getNodeType()) == CHARACTER_NODE) {<br>&nbsp;&nbsp;&nbsp;&nbsp;pachHeaderValue= pBasicNode-&gt;getValue();<br>&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;pachHeaderValue = "This was not the expected value Ros";<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;} else<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;pachHeaderValue = "pBascNode is NULL";<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;AxisChar* pachTmpValue = (AxisChar*) malloc(strlen(pachHeaderValue) + 4);<br>&nbsp;&nbsp;&nbsp;&nbsp;strcpy(pachTmpValue, pachHeaderValue);<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;pachTemp = "EchoStringHeaderHandlerPr1.id";<br>&nbsp;&nbsp;&nbsp;&nbsp;pIMsg-&gt;setProperty(pachTemp, pachTmpValue);<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;free(pachTmpValue);<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;//do some thing<br>&nbsp;&nbsp;&nbsp;&nbsp; //AxisChar* pachTmpValue = "Default values since no reqeust SOAP header";<br>&nbsp;&nbsp;&nbsp;&nbsp;//pachTemp = "EchoStringHeaderHandlerPr1.id";<br>&nbsp;&nbsp;&nbsp;&nbsp;//pIMsg-&gt;setProperty(pachTemp, pachTmpValue);<br> &nbsp;&nbsp;&nbsp;&nbsp; //free(pachTmpValue);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>
  <br> &nbsp;&nbsp;&nbsp;&nbsp;....<br>&nbsp;&nbsp;&nbsp;&nbsp;-------//<br>
  </p>
  <p>In order to get access to the incoming SOAP Body the handler writer can use the following code block.<br>
  <br> To get the body as a AxisChar*<br> // -----<br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>AxisChar* pSoapBody = pIHandlerSoapDeSerializer-&gt;getBodyAsChar();<br>.....<br>-------//<br>
  <br> To get the body as a decoded base64 stream.<br>// -----<br>.....<br>IHandlerSoapDeSerializer* pIHandlerSoapDeSerializer;<br>pIMsg-&gt;getSoapDeSerializer(&amp;pIHandlerSoapDeSerializer);<br>xsd__base64Binary bb = pIHandlerSoapDeSerializer-&gt;getBodyAsBase64Binary();<br>.....<br>-------//</p>
  <p>
  <strong>Note:</strong>
  <br>
  <br> Have a look at the following classes at the API docs to see all the available functions and their respective descriptions. (You can even look at the relavent .h/.hpp header files for the API comments)<br>1.IhandlerSoapDeSerializer<br>2.IHeaderBlock<br>3.BasicNode<br>
  <br> The BasicNode API is similar (not exactly the same, but ..) to the DOM and is written as a tree traversing API.<br>
  <br> With the sample code samples provided above and with the API notes a developer will easily be able to write and play around his/her own Handlers.<br>
  <br> This tutorial will be updated frequently with the new additions and specially with your suggestions.</p>
  <div id="pdf" align="right">
  <a href="handler.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a>
  </div>
  </div>
  </div>
  </div>
  </td>
  <!--================= end Content ==================-->
  </tr>
  </tbody>
  </table>
  <!--================= end Main ==================-->
  <!--================= start Footer ==================-->
  <div id="footer">
  <table summary="footer" cellspacing="0" cellpadding="4" width="100%" border="0">
  <tbody>
  <tr>
  <!--================= start Copyright ==================-->
  <td colspan="2">
  <div align="center">
  <div class="copyright">
                Copyright &copy; 2000-2004&nbsp;The Apache Software Foundation. All rights reserved.
              </div>
  </div>
  </td>
  <!--================= end Copyright ==================-->
  </tr>
  <tr>
  <td align="left">
  <!--================= start Host ==================-->
  <!--================= end Host ==================--></td><td align="right">
  <!--================= start Credits ==================-->
  <div align="right">
  <div class="credit"></div>
  </div>
  <!--================= end Credits ==================-->
  </td>
  </tr>
  </tbody>
  </table>
  </div>
  <!--================= end Footer ==================-->
  </body>
  </html>