blob: 3e397ef98defb7bbb8267641784834abb128d3ae [file] [log] [blame]
<!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">
<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>Axis C++ Server User's Guide</title>
</head>
<body bgcolor="white" class="composite">
<div id="banner">
<table width="100%" cellpadding="8" cellspacing="0" summary="banner" border="0">
<tbody>
<tr>
<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><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><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>
</tr>
</tbody>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" summary="nav" id="breadcrumbs">
<tbody>
<tr class="status">
<td><a href="http://www.apache.org/">Apache</a> | <a href="http://ws.apache.org/">WS</a><a href=""></a></td><td id="tabs">
<div class="tab">
<span class="selectedTab"><a class="base-selected" href="../index.html">WebServices-Axis</a></span>
</div>
</td>
</tr>
</tbody>
</table>
<table id="main" width="100%" cellpadding="8" cellspacing="0" summary="" border="0">
<tbody>
<tr valign="top">
<td id="leftcol">
<div id="navcolumn">
<div class="menuBar">
<div class="menu">
<span class="menuLabel">Axis</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/index.html">Introduction</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/news.html">News</a>
</div>
<div class="menuItem">
<a href="http://wiki.apache.org/ws/FrontPage/Axis">FAQ/Wiki</a>
</div>
<div class="menu">
<span class="menuLabel">Get Involved</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/overview.html">Overview</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/cvs.html">CVS Repository</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/mail.html">Mailing Lists</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/ref.html">Reference Library</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/bugs.html">Bugs</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/howtobuild.html">HowToBuildSite</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Axis (Java)</span>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/index.html">Documentation</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/install.html">Installation</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/user-guide.html">User's Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/developers-guide.html">Developer's Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/integration-guide.html">Integration Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/architecture-guide.html">Architecture Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/reference.html">Reference Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/reading.html">Reading Guide</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/java/requirements.html">Requirements</a>
</div>
</div>
<div class="menu">
<span class="menuLabel">Axis (C++)</span>
<div class="menuItem">
<a href="../cpp/index.html">Home</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://wiki.apache.org/ws/FrontPage/AxisCPP">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="http://ws.apache.org/axis/releases.html">Releases</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/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/ja/index.html">Japanese</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="http://ws.apache.org/axis/who.html">Who We Are</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/contact.html">Contact</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/legal.html">Legal</a>
</div>
<div class="menuItem">
<a href="http://ws.apache.org/axis/docs.html">Notes/Docs</a>
</div>
</div>
</div>
</div>
</div>
</td><td>
<div id="bodycol">
<div class="app">
<div align="center">
<h1>Axis C++ Server User's Guide</h1>
</div>
<div class="h3">
<div class="h3">
<h3>Contents</h3>
</div>
<ul>
<li>
<a href="#Introduction">Introduction</a>
</li>
<li>
<a href="#Pre-requisites">Pre-requisites</a>
</li>
<li>
<a href="#Generating_and_deploying_services">Generating and deploying services</a>
</li>
<li style="list-style: none">
<ul>
<li>
<a href="#Generating_the_service_skeletons">Generating the service skeletons</a>
</li>
<li>
<a href="#Code_the_service">Code the service</a>
</li>
<li>
<a href="#Build_the_server">Build the service</a>
</li>
<li>
<a href="#Deploy_the_service">Deploy the service</a>
<ul>
<li>
<a href="#Deploying_your_service_manually">manually</a>
</li>
<li>
<a href="#Deploying_your_service_using_the_admin_tool">using the AdminClient</a>
</li>
</ul>
</li>
<li>
<a href="#Checking_the_config">Checking your deployment</a>
</li>
</ul>
</li>
</ul>
<div class="h3">
<h3>Introduction</h3>
</div>
<p>
<a name="Introduction"></a>In order to use web services you need to create client-side stubs that access the service and, if you are also responsible for writing the service you need to create the service skeletons and then complete them. This document explains how to use the Axis CPP tooling (WSDL2Ws) to generate the server code. It then goes on to show how to deploy a generated service to an Apache webserver (and by implication the simple_axis_server).</p>
<div class="h3">
<h3>Pre-requisites</h3>
</div>
<p>
<a name="Pre-requisites"></a>WSDL2Ws is a 100% java tool and requires a version of Java to be on the machine that you create your stubs and skeletons on. The version of Java that is required is &gt;= 1.4<br>WSDL2Ws also has a number of pre-requisite jar files that need to be added to your classpath when you run the tooling<br>
<br>&lt;AxisCPP Install dir&gt;/lib/axis/wsdl2ws.jar: Contains the main WSDL2Ws code.<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/axis.jar: Contains the Axis java code which WSDL2Ws is based on<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/commons-discovery.jar:<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/commons-logging.jar;<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/jaxrpc.jar;<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/saaj.jar;<br>&lt;AxisCPP Install dir&gt;/lib/axisjava/wsdl4j.jar</p>
<div class="h3">
<h3>Generating and deploying services</h3>
</div>
<p>
<a name="Generating_and_deploying_services"></a>
</p>
<div class="h4">
<h4>Generate the service skeletons</h4>
</div>
<p>
<a name="Generating_and_deploying_services"></a> As <a href="clientuser-guide.html">with the client-side</a> we will use the Calculator service to show you how to use the tooling and deploy the generated service to the server runtime</p>
<p>Inside the folder <strong>&lt;Axis installation directory&gt;/wsdls/</strong> you will find Calculator.wsdl file which we will use to generate the server-side skeleton and Wrappers. Here is the command line arguments to generate the skeleton.</p>
<p>
<strong>IMPORTANT:In this sample we generate the skeletons using Calculator.wsdl and the WSDL2Ws tool. But in the folder &lt;Axis Installation directory&gt;/samples/server/calculator you will find already generated files. If you wish to use those without generating new ones you can do so. We recommend that you deploy the sample with the already generated files in the first round and later do the same with code generated from Calculator.wsdl.<br>
</strong>
</p>
<strong>Note:</strong><a href="#Pre-requisites">pre-requisite</a><strong>
<br>
<br>cd &lt;Axis Installation directory&gt;/samples/server/calculator</strong>
<br>
<p>
<br>
<strong>java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws Calculator.wsdl -lc++ -sserver</strong> <strong>Note:</strong> If you give <strong>-o &lt;output directory name&gt;</strong> then the output folder is generated for you and the generated source put there. If you do not specify this option then the source is put in the folder where the tool is run.</p>
<div class="h4">
<h4>Code the Service</h4>
</div>
<p>
<a name="Code_the_service"></a>Now that you have generated your service skeletons you need to fill out the logic that the service will perform. As we've already mentioned, in the case of the calculator example we have given you pre-filled skeletons in the <strong>&lt;Axis Installation directory&gt;</strong>/samples/server/calculator directory to show you how it's done.</p>
<div class="h4">
<h4>Build the service</h4>
</div>
<p>
<a name="Build_the_server"></a>Once you've filled in the skeletons for your service you need to build the service into a library that can be deployed to the Axis server runtime.</p>
<p>
<strong>For example:</strong> To build the service library (example using linux and g++)</p>
<p>
<strong>g++ -shared -I&lt;Axis Installation directory&gt;/include -olibcalculator.so *.cpp</strong>
</p>
<p>libcalculator.so is the name you give to your service library. You can give your own libraries any name you wish. But remember (on linux) to prefix with lib and suffix with .so.</p>
<div class="h4">
<h4>Deploy the service</h4>
</div>
<p>
<a name="Deploy_the_service"></a>You can either deploy the file manually to the server or using a provided administration tool (AdminClient). The first section shows you how to deploy your Web Service manually, without using the AdminClient tool.</p>
<div class="h2">
<h2>Deploying your service manually</h2>
</div>
<p>
<a name="Deploying_your_service_manually"></a>Lets say that the Apache installation folder is &lt;Apache_Folder&gt;.<br>Let's also say that you have <a href="install-guide.html#Configure server axiscpp.conf">set up</a> your Axis configuration file (axiscpp.conf) to use the &lt;Apache_Folder&gt;/Axis/conf/server.wsdd server configuration file<br>
</p>
<ol>
<li>Copy the above <strong>libcalculator.so</strong> to the folder <strong>&lt;Apache_Folder&gt;/Axis/webservices.</strong>
<br>
</li>
<li>Add the following to the server.wsdd at the service level. (Please make sure you add these lines at the service level and no other) The example below uses linux path and library names<br>
<br>
<strong>&lt;service name="Calculator" provider="CPP:RPC" description="Calculator Web Service"&gt; &lt;parameter name="className" value="&lt;Apache_Folder&gt;/Axis/webservices/libcalculator.so"/&gt; &lt;/service&gt;</strong>
<br>
</li>
<li>
<a href="#Checking the config">Check your deployment</a> has succeeded<br>
</li>
<li>That's all there is to it ! You should now be able to <a href="clientuser-guide.html#Running Calculator Client">run the calculator client</a> against this service.</li>
</ol>
<div class="h2">
<h2>Deploying your service using the AdminClient Tool</h2>
</div>
<p>
<a name="Deploying_your_service_using_the_admin_tool"></a>As an alternative to manually deploying the service to the server you can use the <strong>AdminClient</strong> tool supplied with Axis CPP.<br>The wsdl2ws Tool generates the deploy.wsdd and the undeploy.wsdd files which are needed for the AdminClient. Once you have these files, you can deploy the web service (in this case the calculator service) using the AdminClient.<br>
<br>The client takes in the following parameters<br>
<br>
<strong>AdminClient &lt;server machine name &gt; &lt;Port that axis is configured for&gt; &lt;server wsddfile to deploy&gt;</strong>
<br>
<br>
<br>Before running this command make sure that the contents of the wsdd file are correct for your configuration - especially the location of the libraries containing your service.<br>
<br>A typical invocation of the AdminClient looks like this....<br>
<br>
<strong>AdminClient localhost 80 deploy.wsdd</strong>
<br>where <strong>localhost</strong> is the server where the Axis cpp server is hosted and <strong>80</strong> is the port where Axis is configured for.</p>
<div class="h4">
<h4>Checking your deployment configuration</h4>
</div>
<p>
<a name="Checking_the_config"></a>
</p>
<ol>
<li>Ensure that your server is started<br>
</li>
<li>Open a browser and enter the link <strong>http://localhost/axis</strong> .<br> If the service is correctly deployed then it will be displayed in a table of deployed services which contain information such as service name, link to wsdl and a description of the service.</li>
</ol>
<br>
<br>
<div id="pdf" align="right">
<a href="serveruser-guide.pdf"><img alt="PDF" src="../skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div id="footer">
<table summary="footer" cellspacing="0" cellpadding="4" width="100%" border="0">
<tbody>
<tr>
<td colspan="2">
<div align="center">
<div class="copyright">
Copyright &copy; 2000-2005&nbsp;The Apache Software Foundation. All rights reserved.
</div>
</div>
</td>
</tr>
<tr>
<td align="left"></td><td align="right">
<div align="right">
<div class="credit"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>