<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Dinesh's Web Log</title>
	
	<link>http://nethu.org</link>
	<description>dumped thoughts</description>
	<lastBuildDate>Fri, 06 Mar 2009 04:00:44 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<creativeCommons:license>http://creativecommons.org/licenses/by/2.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Nethu" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Axis2/C with pthreads</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/pqoCtKnfpSo/</link>
		<comments>http://nethu.org/2009/03/05/axis2c-with-pthreads/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 04:00:44 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[axis2c]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[pthread]]></category>
		<category><![CDATA[svc_client]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=127</guid>
		<description><![CDATA[After writing Axis2/C with cbthead post , I was so curious to test same code with pthreads. As a result I came up with this modified echo sample which uses same svc client and environment among all threads. One thing to note is with cbthread, program worked well with 100,000 threads whereas with pthreads, it [...]]]></description>
			<content:encoded><![CDATA[<p>After writing <a title="Axis2/C with cbthread" href="http://nethu.org/2009/03/01/axis2c-with-cbthread/" target="_blank">Axis2/C with cbthead</a> post , I was so curious to test same code with pthreads. As a result I came up with this modified echo sample which uses same svc client and environment among all threads. One thing to note is with cbthread, program worked well with 100,000 threads whereas with pthreads, it went out of memory around 370 threads.  However pthreads is more portable, well tested and widespread thread library therefore it is more likely to use Axis2/C with pthreads. echo.c and Makefile can be obtained from here <a href="http://www.cs.utk.edu/~dpremala/pthread/">[1]</a>.</p>
<p>1. <a href="http://www.cs.utk.edu/~dpremala/pthread/">http://www.cs.utk.edu/~dpremala/pthread/</a></p>
<p><b>echo.c</b></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the &quot;License&quot;); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339933;">#include &lt;axiom.h&gt;</span>
<span style="color: #339933;">#include &lt;axis2_util.h&gt;</span>
<span style="color: #339933;">#include &lt;axiom_soap.h&gt;</span>
<span style="color: #339933;">#include &lt;axis2_client.h&gt;</span>
<span style="color: #339933;">#include &lt;pthread.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define NTHREADS 10</span>
&nbsp;
axiom_node_t <span style="color: #339933;">*</span>
build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> _ginfo<span style="color: #009900;">&#123;</span>
    pthread_mutex_t <span style="color: #339933;">*</span>lock<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>ginfo_t<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> _svcinfo <span style="color: #009900;">&#123;</span>
    pthread_t pid<span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env<span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>svc_info_t<span style="color: #339933;">;</span>
&nbsp;
svc_info_t <span style="color: #339933;">**</span>pthreads<span style="color: #339933;">;</span>
ginfo_t <span style="color: #339933;">*</span>ginfo<span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span> svc_client_send_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span> svc_client_finish_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span>
main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">**</span>argv<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axis2_char_t <span style="color: #339933;">*</span>address <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_endpoint_ref_t <span style="color: #339933;">*</span>endpoint_ref <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_options_t <span style="color: #339933;">*</span>options <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axis2_char_t <span style="color: #339933;">*</span>client_home <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set up the environment */</span>
    env <span style="color: #339933;">=</span> axutil_env_create_all<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;echo.log&quot;</span><span style="color: #339933;">,</span> AXIS2_LOG_LEVEL_TRACE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set end point reference of echo service */</span>
    address <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;http://localhost:9090/axis2/services/echo&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>axutil_strcmp<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;-h&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Usage : %s [endpoint_url]<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
                   argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;use -h for help<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            address <span style="color: #339933;">=</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Using endpoint : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Create EPR with given address */</span>
    endpoint_ref <span style="color: #339933;">=</span> axis2_endpoint_ref_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Setup options */</span>
    options <span style="color: #339933;">=</span> axis2_options_create<span style="color: #009900;">&#40;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axis2_options_set_to<span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> endpoint_ref<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axis2_options_set_action<span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span>
                             <span style="color: #ff0000;">&quot;http://ws.apache.org/axis2/c/samples/echoString&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set up deploy folder. It is from the deploy folder, the configuration is picked up
     * using the axis2.xml file.
     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
     * be different from this folder on your system. For example, you may have a different folder 
     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
     * modules that the client uses
     */</span>
    client_home <span style="color: #339933;">=</span> AXIS2_GETENV<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;AXIS2C_HOME&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>client_home <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>strcmp<span style="color: #009900;">&#40;</span>client_home<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        client_home <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;../..&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Create service client */</span>
    svc_client <span style="color: #339933;">=</span> axis2_svc_client_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> client_home<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>svc_client<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span>
            <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Error creating service client, Please check AXIS2C_HOME again<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        AXIS2_LOG_ERROR<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>log<span style="color: #339933;">,</span> AXIS2_LOG_SI<span style="color: #339933;">,</span>
                        <span style="color: #ff0000;">&quot;Stub invoke FAILED: Error code:&quot;</span> <span style="color: #ff0000;">&quot; %d :: %s&quot;</span><span style="color: #339933;">,</span>
                        env<span style="color: #339933;">-&gt;</span>error<span style="color: #339933;">-&gt;</span>error_number<span style="color: #339933;">,</span>
                        AXIS2_ERROR_GET_MESSAGE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set service client options */</span>
    axis2_svc_client_set_options<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Engage addressing module */</span>
    axis2_svc_client_engage_module<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> AXIS2_MODULE_ADDRESSING<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    pthreads <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">**</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> NTHREADS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ginfo <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ginfo_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>ginfo_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>ginfo<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;no enough memory<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        exit <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    ginfo<span style="color: #339933;">-&gt;</span>lock <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>pthread_mutex_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>pthread_mutex_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>ginfo<span style="color: #339933;">-&gt;</span>lock<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;no enough memory<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        exit <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    pthread_mutex_init <span style="color: #009900;">&#40;</span>ginfo<span style="color: #339933;">-&gt;</span>lock<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NTHREADS<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>svc_info_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;no enough memory<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            exit <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>env <span style="color: #339933;">=</span> env<span style="color: #339933;">;</span>
        pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>svc_client <span style="color: #339933;">=</span> svc_client<span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>pthread_create <span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #009900;">&#40;</span>pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>pid<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>svc_client_send_request<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            perror <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pthread creation&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            exit <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NTHREADS<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        pthread_join <span style="color: #009900;">&#40;</span>pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>pid<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    svc_client_finish_request <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>pthreads<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* build SOAP request message content using OM */</span>
axiom_node_t <span style="color: #339933;">*</span>
build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span> env<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    axiom_node_t <span style="color: #339933;">*</span>echo_om_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_element_t <span style="color: #339933;">*</span>echo_om_ele <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>text_om_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_element_t <span style="color: #339933;">*</span>text_om_ele <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_namespace_t <span style="color: #339933;">*</span>ns1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_char_t <span style="color: #339933;">*</span>om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
&nbsp;
    ns1 <span style="color: #339933;">=</span>
        axiom_namespace_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;http://ws.apache.org/axis2/services/echo&quot;</span><span style="color: #339933;">,</span>
                               <span style="color: #ff0000;">&quot;ns1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    echo_om_ele <span style="color: #339933;">=</span>
        axiom_element_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;echoString&quot;</span><span style="color: #339933;">,</span> ns1<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>echo_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    text_om_ele <span style="color: #339933;">=</span>
        axiom_element_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> echo_om_node<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;text&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>text_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axiom_element_set_text<span style="color: #009900;">&#40;</span>text_om_ele<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Hello World!&quot;</span><span style="color: #339933;">,</span> text_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    om_str <span style="color: #339933;">=</span> axiom_node_to_string<span style="color: #009900;">&#40;</span>echo_om_node<span style="color: #339933;">,</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>om_str<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Sending OM : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        AXIS2_FREE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>allocator<span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> echo_om_node<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span>
svc_client_send_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    svc_info_t <span style="color: #339933;">*</span>svcinfo<span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env<span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client<span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>payload <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>ret_node<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    svcinfo <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>v<span style="color: #339933;">;</span>
&nbsp;
    pthread_mutex_lock <span style="color: #009900;">&#40;</span>ginfo<span style="color: #339933;">-&gt;</span>lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    env <span style="color: #339933;">=</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #339933;">;</span>
    svc_client <span style="color: #339933;">=</span> svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Build the SOAP request message payload using OM API. */</span>
    payload <span style="color: #339933;">=</span> build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Send request */</span>
    ret_node <span style="color: #339933;">=</span> axis2_svc_client_send_receive<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> payload<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ret_node<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axis2_char_t <span style="color: #339933;">*</span>om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
        om_str <span style="color: #339933;">=</span> axiom_node_to_string<span style="color: #009900;">&#40;</span>ret_node<span style="color: #339933;">,</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>om_str<span style="color: #009900;">&#41;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Received OM : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>echo client invoke SUCCESSFUL!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        AXIS2_FREE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>allocator<span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ret_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        AXIS2_LOG_ERROR<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>log<span style="color: #339933;">,</span> AXIS2_LOG_SI<span style="color: #339933;">,</span>
                        <span style="color: #ff0000;">&quot;Stub invoke FAILED: Error code:&quot;</span> <span style="color: #ff0000;">&quot; %d :: %s&quot;</span><span style="color: #339933;">,</span>
                        env<span style="color: #339933;">-&gt;</span>error<span style="color: #339933;">-&gt;</span>error_number<span style="color: #339933;">,</span>
                        AXIS2_ERROR_GET_MESSAGE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;echo client invoke FAILED!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    pthread_mutex_unlock <span style="color: #009900;">&#40;</span>ginfo<span style="color: #339933;">-&gt;</span>lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span> 
svc_client_finish_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
    svc_info_t <span style="color: #339933;">*</span>svcinfo<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    svcinfo <span style="color: #339933;">=</span> pthreads<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axis2_svc_client_free<span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #339933;">,</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        svcinfo<span style="color: #339933;">-&gt;</span>svc_client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axutil_env_free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>axutil_env_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        svcinfo<span style="color: #339933;">-&gt;</span>env <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NTHREADS<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        free <span style="color: #009900;">&#40;</span>pthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    free <span style="color: #009900;">&#40;</span>pthreads<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    pthread_mutex_destroy <span style="color: #009900;">&#40;</span>ginfo<span style="color: #339933;">-&gt;</span>lock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    free <span style="color: #009900;">&#40;</span>ginfo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;All threads finished <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/apache' rel='tag' target='_self'>apache</a>, <a class='technorati-link' href='http://technorati.com/tag/axis2c' rel='tag' target='_self'>axis2c</a>, <a class='technorati-link' href='http://technorati.com/tag/pthread' rel='tag' target='_self'>pthread</a>, <a class='technorati-link' href='http://technorati.com/tag/svc_client' rel='tag' target='_self'>svc_client</a>, <a class='technorati-link' href='http://technorati.com/tag/thread' rel='tag' target='_self'>thread</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2009/03/05/axis2c-with-pthreads/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://nethu.org/2009/03/05/axis2c-with-pthreads/</feedburner:origLink></item>
		<item>
		<title>Axis2/C with cbthread</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/EIeq5UKB5mo/</link>
		<comments>http://nethu.org/2009/03/01/axis2c-with-cbthread/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 22:46:13 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[axis2c]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[axis2]]></category>
		<category><![CDATA[cbthread]]></category>
		<category><![CDATA[pthead]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=98</guid>
		<description><![CDATA[Many users asked questions about using Axis2/C in multi threaded environment. Here Axis2/C client side used with cbthread library. cbthread library is a small lightweight non-preemptive thread library which was developed by Dr. Plank. Good thing about  cbthread library is , it doesn&#8217;t use much memory to keep information of threads. Unlike pthread, one can [...]]]></description>
			<content:encoded><![CDATA[<p>Many users asked questions about using <a title="Axis2/C" href="http://ws.apache.org/axis2/c" target="_blank">Axis2/C</a> in multi threaded environment. Here Axis2/C client side used with<a title="cbthread" href="http://www.cs.utk.edu/~plank/plank/cbthread/" target="_blank"> cbthread</a> library. cbthread library is a small lightweight non-preemptive thread library which was developed by <a title="Dr. Plank" href="http://www.cs.utk.edu/~plank" target="_blank">Dr. Plank</a>. Good thing about  cbthread library is , it doesn&#8217;t use much memory to keep information of threads. Unlike pthread, one can run thousands of threads without running out of memory. This example was tested with 100,000 of threads successfully and all requests were sent using same svc_client.Here <a title="cbthread" href="http://www.cs.utk.edu/~plank/plank/cbthread/" target="_blank">[1]</a> are some materials to to learn about cbthread</p>
<p><strong><span style="text-decoration: underline;">echo.c client side</span></strong></p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the &quot;License&quot;); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */</span>
&nbsp;
<span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;axiom.h&gt;</span>
<span style="color: #339933;">#include &lt;axis2_util.h&gt;</span>
<span style="color: #339933;">#include &lt;axiom_soap.h&gt;</span>
<span style="color: #339933;">#include &lt;axis2_client.h&gt;</span>
<span style="color: #339933;">#include &lt;cbthread.h&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Number of theads */</span>
<span style="color: #339933;">#define NTHREADS 10</span>
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> _svcinfo <span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env<span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>svc_info_t<span style="color: #339933;">;</span>
&nbsp;
svc_info_t <span style="color: #339933;">**</span>cthreads<span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span> svc_client_send_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span> svc_client_finish_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
axiom_node_t <span style="color: #339933;">*</span>
build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span>
main<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">**</span>argv<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axis2_char_t <span style="color: #339933;">*</span>address <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_endpoint_ref_t <span style="color: #339933;">*</span>endpoint_ref <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_options_t <span style="color: #339933;">*</span>options <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axis2_char_t <span style="color: #339933;">*</span>client_home <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set up the environment */</span>
    env <span style="color: #339933;">=</span> axutil_env_create_all<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;echo.log&quot;</span><span style="color: #339933;">,</span> AXIS2_LOG_LEVEL_TRACE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set end point reference of echo service */</span>
    address <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;http://localhost:9090/axis2/services/echo&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>axutil_strcmp<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;-h&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Usage : %s [endpoint_url]<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
                   argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;use -h for help<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            address <span style="color: #339933;">=</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Using endpoint : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Create EPR with given address */</span>
    endpoint_ref <span style="color: #339933;">=</span> axis2_endpoint_ref_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> address<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Setup options */</span>
    options <span style="color: #339933;">=</span> axis2_options_create<span style="color: #009900;">&#40;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axis2_options_set_to<span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> endpoint_ref<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axis2_options_set_action<span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span>
                             <span style="color: #ff0000;">&quot;http://ws.apache.org/axis2/c/samples/echoString&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set up deploy folder. It is from the deploy folder, the configuration is picked up
     * using the axis2.xml file.
     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can
     * be different from this folder on your system. For example, you may have a different folder
     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the
     * modules that the client uses
     */</span>
    client_home <span style="color: #339933;">=</span> AXIS2_GETENV<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;AXIS2C_HOME&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>client_home <span style="color: #339933;">||</span> <span style="color: #339933;">!</span>strcmp<span style="color: #009900;">&#40;</span>client_home<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        client_home <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;../..&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Create service client */</span>
    svc_client <span style="color: #339933;">=</span> axis2_svc_client_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> client_home<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>svc_client<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span>
            <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Error creating service client, Please check AXIS2C_HOME again<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        AXIS2_LOG_ERROR<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>log<span style="color: #339933;">,</span> AXIS2_LOG_SI<span style="color: #339933;">,</span>
                        <span style="color: #ff0000;">&quot;Stub invoke FAILED: Error code:&quot;</span> <span style="color: #ff0000;">&quot; %d :: %s&quot;</span><span style="color: #339933;">,</span>
                        env<span style="color: #339933;">-&gt;;</span>error<span style="color: #339933;">-&gt;;</span>error_number<span style="color: #339933;">,</span>
                        AXIS2_ERROR_GET_MESSAGE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Set service client options */</span>
    axis2_svc_client_set_options<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Engage addressing module */</span>
    axis2_svc_client_engage_module<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> AXIS2_MODULE_ADDRESSING<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    cthreads <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">**</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> NTHREADS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NTHREADS<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> malloc <span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span>svc_info_t<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            fprintf <span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;no enough memory<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            exit <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>env <span style="color: #339933;">=</span> env<span style="color: #339933;">;</span>
        cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span>svc_client <span style="color: #339933;">=</span> svc_client<span style="color: #339933;">;</span>
        cbthread_fork <span style="color: #009900;">&#40;</span>svc_client_send_request<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    cbthread_joinall<span style="color: #009900;">&#40;</span>svc_client_finish_request<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* build SOAP request message content using OM */</span>
axiom_node_t <span style="color: #339933;">*</span>
build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span> env<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    axiom_node_t <span style="color: #339933;">*</span>echo_om_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_element_t <span style="color: #339933;">*</span>echo_om_ele <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>text_om_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_element_t <span style="color: #339933;">*</span>text_om_ele <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_namespace_t <span style="color: #339933;">*</span>ns1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axis2_char_t <span style="color: #339933;">*</span>om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
&nbsp;
    ns1 <span style="color: #339933;">=</span>
        axiom_namespace_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;http://ws.apache.org/axis2/services/echo&quot;</span><span style="color: #339933;">,</span>
                               <span style="color: #ff0000;">&quot;ns1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    echo_om_ele <span style="color: #339933;">=</span>
        axiom_element_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;echoString&quot;</span><span style="color: #339933;">,</span> ns1<span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>echo_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    text_om_ele <span style="color: #339933;">=</span>
        axiom_element_create<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">,</span> echo_om_node<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;text&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span>text_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    axiom_element_set_text<span style="color: #009900;">&#40;</span>text_om_ele<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Hello World!&quot;</span><span style="color: #339933;">,</span> text_om_node<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    om_str <span style="color: #339933;">=</span> axiom_node_to_string<span style="color: #009900;">&#40;</span>echo_om_node<span style="color: #339933;">,</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>om_str<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Sending OM : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        AXIS2_FREE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>allocator<span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> echo_om_node<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span>
svc_client_send_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    svc_info_t <span style="color: #339933;">*</span>svcinfo<span style="color: #339933;">;</span>
    <span style="color: #993333;">const</span> axutil_env_t <span style="color: #339933;">*</span>env<span style="color: #339933;">;</span>
    axis2_svc_client_t <span style="color: #339933;">*</span>svc_client<span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>payload <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    axiom_node_t <span style="color: #339933;">*</span>ret_node<span style="color: #339933;">;</span>
&nbsp;
    svcinfo <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>svc_info_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span>v<span style="color: #339933;">;</span>
    env <span style="color: #339933;">=</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #339933;">;</span>
    svc_client <span style="color: #339933;">=</span> svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Build the SOAP request message payload using OM API. */</span>
    payload <span style="color: #339933;">=</span> build_om_payload_for_echo_svc<span style="color: #009900;">&#40;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* Send request */</span>
    ret_node <span style="color: #339933;">=</span> axis2_svc_client_send_receive<span style="color: #009900;">&#40;</span>svc_client<span style="color: #339933;">,</span> env<span style="color: #339933;">,</span> payload<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ret_node<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axis2_char_t <span style="color: #339933;">*</span>om_str <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
        om_str <span style="color: #339933;">=</span> axiom_node_to_string<span style="color: #009900;">&#40;</span>ret_node<span style="color: #339933;">,</span> env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>om_str<span style="color: #009900;">&#41;</span>
            <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Received OM : %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>echo client invoke SUCCESSFUL!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        AXIS2_FREE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>allocator<span style="color: #339933;">,</span> om_str<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ret_node <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        AXIS2_LOG_ERROR<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>log<span style="color: #339933;">,</span> AXIS2_LOG_SI<span style="color: #339933;">,</span>
                        <span style="color: #ff0000;">&quot;Stub invoke FAILED: Error code:&quot;</span> <span style="color: #ff0000;">&quot; %d :: %s&quot;</span><span style="color: #339933;">,</span>
                        env<span style="color: #339933;">-&gt;</span>error<span style="color: #339933;">-&gt;</span>error_number<span style="color: #339933;">,</span>
                        AXIS2_ERROR_GET_MESSAGE<span style="color: #009900;">&#40;</span>env<span style="color: #339933;">-&gt;</span>error<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;echo client invoke FAILED!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">static</span> <span style="color: #993333;">void</span>
svc_client_finish_request <span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span> <span style="color: #339933;">*</span>v<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
    svc_info_t <span style="color: #339933;">*</span>svcinfo<span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    svcinfo <span style="color: #339933;">=</span> cthreads<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axis2_svc_client_free<span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>svc_client<span style="color: #339933;">,</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        svcinfo<span style="color: #339933;">-&gt;</span>svc_client <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        axutil_env_free<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>axutil_env_t <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> svcinfo<span style="color: #339933;">-&gt;</span>env<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        svcinfo<span style="color: #339933;">-&gt;</span>env <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> NTHREADS<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        free <span style="color: #009900;">&#40;</span>cthreads<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    free <span style="color: #009900;">&#40;</span>cthreads<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;All threads finished <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Makefile</strong></p>

<div class="wp_syntax"><div class="code"><pre class="make" style="font-family:monospace;">CC <span style="color: #004400;">=</span> gcc
CFLAGS <span style="color: #004400;">=</span> <span style="color: #004400;">-</span>O3 <span style="color: #004400;">-</span>Wall
LIB <span style="color: #004400;">=</span> <span style="color: #004400;">-</span>L<span style="color: #004400;">/</span>home<span style="color: #004400;">/</span>dinesh<span style="color: #004400;">/</span>lib <span style="color: #004400;">-</span>lcbthread <span style="color: #004400;">-</span>lm <span style="color: #004400;">-</span>L <span style="color: #004400;">/</span>home<span style="color: #004400;">/</span>dinesh<span style="color: #004400;">/</span>axis2c<span style="color: #004400;">/</span>deploy<span style="color: #004400;">/</span>lib <span style="color: #004400;">-</span>laxis2_engine <span style="color: #004400;">-</span>laxutil <span style="color: #004400;">-</span>laxis2_axiom
<span style="color: #666622; font-weight: bold;">INCLUDE</span> <span style="color: #004400;">=</span> <span style="color: #004400;">-</span>I<span style="color: #004400;">.</span> <span style="color: #004400;">-</span>I<span style="color: #004400;">/</span>home<span style="color: #004400;">/</span>dinesh<span style="color: #004400;">/</span>axis2c<span style="color: #004400;">/</span>deploy<span style="color: #004400;">/</span><span style="color: #666622; font-weight: bold;">include</span><span style="color: #004400;">/</span>axis2<span style="color: #004400;">-</span>1<span style="color: #004400;">.</span>5<span style="color: #004400;">.</span>0<span style="color: #004400;">/</span> <span style="color: #004400;">-</span>I<span style="color: #004400;">/</span>home<span style="color: #004400;">/</span>dinesh<span style="color: #004400;">/</span><span style="color: #666622; font-weight: bold;">include</span>
EXECUTABLES <span style="color: #004400;">=</span> echo
all <span style="color: #004400;">:</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">EXECUTABLES</span><span style="color: #004400;">&#41;</span> 
&nbsp;
echo<span style="color: #004400;">:</span> echo<span style="color: #004400;">.</span>c
        <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CC</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">CFLAGS</span><span style="color: #004400;">&#41;</span>  <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">INCLUDE</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">-</span>o echo echo<span style="color: #004400;">.</span>c <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">LIB</span><span style="color: #004400;">&#41;</span>
clean<span style="color: #004400;">:</span>
        rm <span style="color: #004400;">-</span>f <span style="color: #004400;">$</span><span style="color: #004400;">&#40;</span><span style="color: #000088;">EXECUTABLES</span><span style="color: #004400;">&#41;</span> <span style="color: #004400;">*</span>~ \<span style="color: #339900; font-style: italic;">#*</span></pre></div></div>

<p>You can download echo.c and Makefile from here [2].<br />
1.  <a title="http://www.cs.utk.edu/~plank/plank/cbthread/" href="http://www.cs.utk.edu/~plank/plank/cbthread/" target="_blank"> http://www.cs.utk.edu/~plank/plank/cbthread</a>/<br />
2.  <a href="http://www.cs.utk.edu/~dpremala/cbthread/">http://www.cs.utk.edu/~dpremala/cbthread/</a></p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/apache' rel='tag' target='_self'>apache</a>, <a class='technorati-link' href='http://technorati.com/tag/axis2' rel='tag' target='_self'>axis2</a>, <a class='technorati-link' href='http://technorati.com/tag/axis2c' rel='tag' target='_self'>axis2c</a>, <a class='technorati-link' href='http://technorati.com/tag/cbthread' rel='tag' target='_self'>cbthread</a>, <a class='technorati-link' href='http://technorati.com/tag/pthead' rel='tag' target='_self'>pthead</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2009/03/01/axis2c-with-cbthread/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://nethu.org/2009/03/01/axis2c-with-cbthread/</feedburner:origLink></item>
		<item>
		<title>Drawings on a text file ?</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/APjn4EWTkoI/</link>
		<comments>http://nethu.org/2009/02/22/drawings-on-a-text-file/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 20:17:36 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=95</guid>
		<description><![CDATA[If you ever need to draw a table, diagram on a text file this screen cast might be useful. It gives a nice example of drawing linked list structure on a  text file.




]]></description>
			<content:encoded><![CDATA[<p>If you ever need to draw a table, diagram on a text file <a title="screen cast" href="http://tinyurl.com/2sj7ts" target="_blank">this screen</a> cast might be useful. It gives a nice example of drawing linked list structure on a  text file.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2009/02/22/drawings-on-a-text-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2009/02/22/drawings-on-a-text-file/</feedburner:origLink></item>
		<item>
		<title>Install R, BioConductor in Debian</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/1DviPsYxy1c/</link>
		<comments>http://nethu.org/2008/12/18/install-r-bioconductor-in-debian/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 03:02:13 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[BioC]]></category>
		<category><![CDATA[Bioconductor]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=94</guid>
		<description><![CDATA[R is a free and open source package which use for statistical analysis. In this post main focus is going towards installing and configuring the BioConductor, which is also a free and open source project (a package in R) widely use for analyzing genome data. Tried to install and configure BioConductor in debian after a demonstration  of research group mates. Even though installing R was pretty much straight forward, BioConductor needed some effort.]]></description>
			<content:encoded><![CDATA[<p><a title="R" href="http://www.r-project.org/" target="_blank">R</a> is a free and open source package which use for statistical analysis. In this post main focus is going towards installing and configuring the <a title="BioC" href="http://www.bioconductor.org/" target="_blank">BioConductor</a>, which is also a free and open source project (a package in R) widely use for analyzing genome data. Tried to install and configure BioConductor in debian after a demonstration  of research group mates. Even though installing R was pretty much straight forward, BioConductor needed some effort.</p>
<p><strong>Installing R</strong></p>
<p># apt-get install r-base  r-recommended r-base-dev</p>
<p><strong>Installing BioConductor</strong></p>
<p>#R<br />
R version 2.7.1 (2008-06-23)<br />
Copyright (C) 2008 The R Foundation for Statistical Computing<br />
ISBN 3-900051-07-0</p>
<p>R is free software and comes with ABSOLUTELY NO WARRANTY.<br />
You are welcome to redistribute it under certain conditions.<br />
Type &#8216;license()&#8217; or &#8216;licence()&#8217; for distribution details.</p>
<p>Natural language support but running in an English locale</p>
<p>R is a collaborative project with many contributors.<br />
Type &#8216;contributors()&#8217; for more information and<br />
&#8216;citation()&#8217; on how to cite R or R packages in publications.</p>
<p>Type &#8216;demo()&#8217; for some demos, &#8216;help()&#8217; for on-line help, or<br />
&#8216;help.start()&#8217; for an HTML browser interface to help.<br />
Type &#8216;q()&#8217; to quit R</p>
<p>&gt;source(&#8221;http://bioconductor.org/biocLite.R&#8221;)</p>
<p>&gt;biocLite()</p>
<p>It downloaded several packages on the fly and instaledl into R. For analytical purposes we use package called &#8216;affy&#8217; however it did not install in my first attempt. After further investigation noticed that compilation of affy package gave an warning on my machine.Normally I enable -Werror flag therefore compilation aborted. Then exited from R environment and disabled -Werror flag.<br />
read_pgf.c: In function ‘pgf_count_probeset_types’:<br />
read_pgf.c:1265: warning: assignment from incompatible pointer type<br />
gcc -std=gnu99 -shared  -o affyio.so fread_functions.o read_abatch.o read_bpmap.o read_cdffile2.o read_cdf_xda.o read_celfile_generic.o read_clf.o read_generic.o read_pgf.o -lpthread -lz  -lpthread  -L/usr/lib/R/lib -lR<br />
** R<br />
** preparing package for lazy loading<br />
** help</p>
<p>#export CFLAGS=&#8221;"</p>
<p>#R</p>
<p>&gt;source(&#8221;http://bioconductor.org/biocLite.R&#8221;)</p>
<p>&gt;biocLite(&#8221;affy&#8221;)</p>
<p>&gt; library(affy)<br />
Loading required package: Biobase<br />
Loading required package: tools</p>
<p>Welcome to Bioconductor</p>
<p>Vignettes contain introductory material. To view, type<br />
&#8216;openVignette()&#8217;. To cite Bioconductor, see<br />
&#8216;citation(&#8221;Biobase&#8221;)&#8217; and for packages &#8216;citation(pkgname)&#8217;.</p>
<p>Loading required package: affyio<br />
Loading required package: preprocessCore</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/BioC' rel='tag' target='_self'>BioC</a>, <a class='technorati-link' href='http://technorati.com/tag/Bioconductor' rel='tag' target='_self'>Bioconductor</a>, <a class='technorati-link' href='http://technorati.com/tag/Debian' rel='tag' target='_self'>Debian</a>, <a class='technorati-link' href='http://technorati.com/tag/R' rel='tag' target='_self'>R</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/12/18/install-r-bioconductor-in-debian/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/12/18/install-r-bioconductor-in-debian/</feedburner:origLink></item>
		<item>
		<title>Install Sinhala In Debian</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/RjP2X1z9Wkg/</link>
		<comments>http://nethu.org/2008/12/06/install-sinhala-in-debian/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 21:40:10 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Sinhala]]></category>
		<category><![CDATA[XFCE]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=86</guid>
		<description><![CDATA[Some of my friends started tweet and sending emails in Sinhala. Problem I had was, I couldn't read them since I dind't install Sinhala in my laptop (Which runs Debian lenny of course). I found some really helpful websites which helped me to install Sinhala.]]></description>
			<content:encoded><![CDATA[<p>Some of my friends started tweet and sending emails in <a href="http://en.wikipedia.org/wiki/Sinhala_language" target="_blank">Sinhala</a>. Problem I had was, I couldn&#8217;t read them since I dind&#8217;t install Sinhala in my laptop (Which runs Debian lenny of course). I found some really helpful websites which helped me to install Sinhala.</p>
<p>To install Sinhala, following line added to the /etc/apt/source.list <a title="siyabus" href="http://www.siyabas.lk/sinhala_how_to_install.html#lin  " target="_blank">[1]</a></p>
<pre>deb <a href="http://sinhala.sourceforge.net/debian/i386/lenny/">http://sinhala.sourceforge.net/debian/i386/lenny/</a> ./</pre>
<p>Then ran apt-update and installed packages <a href="http://www.nongnu.org/sinhala/doc/howto/sinhala-howto.html#SEC.ENABLING-SINHALA-LONG-2" target="_blank">[2]</a>.</p>
<pre class="SCREEN">#apt-get update</pre>
<pre class="SCREEN">#apt-get install ttf-sinhala-lklug scim scim-gtk2-immodule im-switch scim-m17n m17n-db m17n-contrib</pre>
<p>Interestingly, In order to make an effect on these changes session should be logged out. Sinhala will be enabled from next session.</p>
<p>Even though, This online tool <a href="http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/t2.html" target="_blank">[3]</a> is easy to use, it is kind of burden to go there every time to type<br />
some Sinhala. <a href="http://wso2.com/about/engineers/deependra/" target="_blank">Deep</a> and <a href="http://mohanjith.com/" target="_blank">Mohanjith</a> suggested that to try out SCIM.</p>
<p><strong>Enable <a href="http://en.wikipedia.org/wiki/SCIM" target="_blank">SCIM</a> in <a href="http://en.wikipedia.org/wiki/XFCE" target="_blank">XFCE</a> <a href="http://wiki.xfce.org/howto/scim" target="_blank">[4]</a></strong></p>
<p>Following lines added to ~/.Xsession file</p>
<pre>LANG=en_US.UTF-8
export LANG
XMODIFIERS="@im=<span class="search_hit">SCIM</span>"
export XMODIFIERS
GTK_IM_MODULE="<span class="search_hit">scim</span>"
export GTK_IM_MODULE
<span class="search_hit">scim</span> -d&amp;

start<span class="search_hit">xfce</span>4

After logged out and logged in again, SCIM was enabled.</pre>
<div id="attachment_87" class="wp-caption alignnone" style="width: 310px"><a href="http://nethu.org/wp-content/uploads/2008/12/scim.png"><img class="size-medium wp-image-87" title="scim" src="http://nethu.org/wp-content/uploads/2008/12/scim-300x187.png" alt="Sinhala Input" width="300" height="187" /></a><p class="wp-caption-text">Sinhala Input</p></div>
<pre><span style="color: #000000;">

</span></pre>
<div id="attachment_91" class="wp-caption alignnone" style="width: 310px"><a href="http://www.nongnu.org/sinhala/doc/keymaps/sinhala-keyboard_1.html" target="_blank"><img class="size-medium wp-image-91" title="sinhala_wijesekara" src="http://nethu.org/wp-content/uploads/2008/12/wije-300x241.png" alt="Sinhala Wijesekara Keyboard Layout" width="300" height="241" /></a><p class="wp-caption-text">Sinhala Wijesekara Keyboard Layout</p></div>
<pre><span style="color: #000000;">
<pre class="SCREEN">Enjoy ! ජය !</pre>
<p></span></pre>
<p><strong>Referances</strong></p>
<p>1. http://www.siyabas.lk/sinhala_how_to_install.html#lin</p>
<p>2. http://www.nongnu.org/sinhala/doc/howto/sinhala-howto.html#SEC.ENABLING-SINHALA-LONG-2</p>
<p>3. http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/t2.html</p>
<p>4. http://wiki.xfce.org/howto/scim</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Debian' rel='tag' target='_self'>Debian</a>, <a class='technorati-link' href='http://technorati.com/tag/Sinhala' rel='tag' target='_self'>Sinhala</a>, <a class='technorati-link' href='http://technorati.com/tag/XFCE' rel='tag' target='_self'>XFCE</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/12/06/install-sinhala-in-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/12/06/install-sinhala-in-debian/</feedburner:origLink></item>
		<item>
		<title>Axis2/C Vs gSoap</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/sZ7XtSuoSNc/</link>
		<comments>http://nethu.org/2008/10/05/axis2c-vs-gsoap/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 17:43:22 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[WSO2 WSF/C]]></category>
		<category><![CDATA[axis2c]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[wsfc]]></category>
		<category><![CDATA[gSoap]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=81</guid>
		<description><![CDATA[One of the Axis2/C key contributor Damitha Kumarage compares Axis2/C feature list against gSoap. This comparison spread over the areas of services, clients, WS-* support , MTOM , REST and many more. gSoap and Axis2/C are the main stacks in open source webservices stacks that are implemented in C, moreover this feature list comparison would [...]]]></description>
			<content:encoded><![CDATA[<p>One of the <a title="Axis2/C" href="http://ws.apache.org/axis2/c/" target="_blank">Axis2/C</a> key contributor <a title="Damitha" href="http://damithakumarage.wordpress.com/" target="_blank">Damitha Kumarage</a> compares Axis2/C feature list against <a title="gSoap" href="http://sourceforge.net/projects/gsoap2" target="_blank">gSoap</a>. <a title="Axis2/C vs gSoap" href="http://wso2.org/library/articles/feature-comparrision-wsf-c-gsoap" target="_blank">This comparison</a> spread over the areas of services, clients, WS-* support , MTOM , REST and many more. gSoap and Axis2/C are the main stacks in open source webservices stacks that are implemented in C, moreover this feature list comparison would be helpful for selecting one webservices framework. Since Damitha is Axis2/C contributor, this comparison might be little biased towards the Axis2/C; however, this <a title="Axis2/C vs gSoap" href="http://wso2.org/library/articles/feature-comparrision-wsf-c-gsoap" target="_blank">article</a> provides a good ground to compare these two stacks.</p>
<p><strong>References</strong></p>
<p>[1] &#8220;Feature Comparison of WSF/C and gSoap&#8221;</p>
<p>October 2008, <a title="Axis2/C vs gSoap" href="http://wso2.org/library/articles/feature-comparrision-wsf-c-gsoap" target="_blank">http://wso2.org/library/articles/feature-comparrision-wsf-c-gsoap</a></p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/axis2c' rel='tag' target='_self'>axis2c</a>, <a class='technorati-link' href='http://technorati.com/tag/gSoap' rel='tag' target='_self'>gSoap</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/10/05/axis2c-vs-gsoap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/10/05/axis2c-vs-gsoap/</feedburner:origLink></item>
		<item>
		<title>Installing Matlab on Debian (lenny)</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/Qs9EJGnGZCE/</link>
		<comments>http://nethu.org/2008/09/27/installing-matlab-on-debian-lenny/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 16:56:08 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://nethu.org/?p=54</guid>
		<description><![CDATA[One of big news for UT about matlab is , University of Tennessee now has a system-wide license agreement with The MathWorks that makes MATLAB, Simulink and 54 other products available for free to all University of Tennessee faculty, staff, and students. Matlab download procedure with academic license can be obtained from OIT website. Downloading and installing involves following four steps.]]></description>
			<content:encoded><![CDATA[<p>This blog post mainly target for <a title="UT" href="http://utk.edu" target="_blank">UT</a> students who need to install matlab on linux. However there are some possible problems that any one could come across while installing matlab. and fixes for those problems discussed in this post.</p>
<p>One of big news for UT about matlab is , <a title="Matlab Rolleout" href="http://oit.utk.edu/matlab/" target="_blank">University of Tennessee now has a system-wide license agreement with The MathWorks that makes MATLAB, Simulink and 54 other products available for free to all University of Tennessee faculty, staff, and students.</a> Matlab download procedure with academic license can be obtained from <a title="OIT" href="http://web.dii.utk.edu/softwaredistribution/" target="_blank">OIT</a> website. Downloading and installing involves following four steps.</p>
<ol>
<li>Create a Mathworks Account.</li>
<li>Associate your MathWorks account with the TAH license using the appropriate Activation Key.</li>
<li>Download MATLAB products from MathWorks.com and install MATLAB software.</li>
<li>Activate the MATLAB software.</li>
</ol>
<p>Even though installing on windows is quite easy, need some work around for installing on linux, specifically Debian Testing x86 distribution. Here x86 is emphasized because installing on x86_64 didn&#8217;t work for me.</p>
<p>After creating mathworks account, can be logged into mathworks website and cab be downloaded R2008a release. In order to download, system should have java installed  because mathworks has a download agent which uses javaws.</p>
<ul>
<li>Select suitable distribution</li>
</ul>
<p><a href="http://nethu.org/wp-content/uploads/2008/09/downloadscreen.png"><img class="size-medium wp-image-60 alignnone" title="downloadscreen" src="http://nethu.org/wp-content/uploads/2008/09/downloadscreen-300x187.png" alt="" width="210" height="131" /></a></p>
<ul>
<li>Download Agent</li>
</ul>
<div class="mceTemp">
<dl id="attachment_57" class="wp-caption alignnone" style="width: 220px;">
<dt class="wp-caption-dt"><a href="http://nethu.org/wp-content/uploads/2008/09/downloadprompt.png"><img class="size-medium wp-image-57" title="downloadprompt" src="http://nethu.org/wp-content/uploads/2008/09/downloadprompt-300x187.png" alt="Download Prompt" width="210" height="131" /></a></dt>
</dl>
</div>
<ul>
<li>Point to Javaws</li>
</ul>
<p><a href="http://nethu.org/wp-content/uploads/2008/09/javaws.png"><img class="alignnone size-medium wp-image-62" title="javaws" src="http://nethu.org/wp-content/uploads/2008/09/javaws-300x187.png" alt="" width="210" height="131" /></a></p>
<ul>
<li>Download with Javaws</li>
</ul>
<p><a href="http://nethu.org/wp-content/uploads/2008/09/downloadagent.png"><img class="alignnone size-medium wp-image-61" title="downloadagent" src="http://nethu.org/wp-content/uploads/2008/09/downloadagent-300x187.png" alt="" width="210" height="131" /></a></p>
<ul>
<li>Starts Download</li>
</ul>
<p><a href="http://nethu.org/wp-content/uploads/2008/09/downlaodmat.png"><img class="alignnone size-medium wp-image-59" title="downlaodmat" src="http://nethu.org/wp-content/uploads/2008/09/downlaodmat-300x187.png" alt="" width="210" height="131" /></a></p>
<p>as it shown, matlab and it&#8217;s 54 modules are downloaded into /tmp/mathworks_downloads directory.</p>
<p><strong>Installation.</strong></p>
<p>To begin installation, as a super user</p>
<p># cd /tmp/mathworks_downloas</p>
<p># tar -xf boot.ftp</p>
<p>#./install</p>
<p>Extracting ftp files . . . [please wait]<br />
Extracting matlab.common<br />
Extracting matlab.glnx86<br />
&#8230;.</p>
<p><a href="http://nethu.org/wp-content/uploads/2008/09/start.png"><img class="alignnone size-medium wp-image-69" title="start" src="http://nethu.org/wp-content/uploads/2008/09/start-300x187.png" alt="" width="210" height="131" /></a></p>
<p><span id="more-54"></span></p>
<p>It is possible to get some error messages while executing &#8220;install&#8221; script.</p>
<ul>
<li>libXp.so not found</li>
</ul>
<p>installing libxp-dev and libxp6 would fix the problem.</p>
<p># apt-get install libxp-dev libxp6</p>
<ul>
<li>libmwins.so not found</li>
</ul>
<p>There is a libmwins.so library in  /tmp/mathworks_downloads/update/bin/glnx86/ directory, need to add that library into library path.</p>
<ul>
<li>/cdrom/update/&#8230; missing or cannot find.</li>
</ul>
<p>No clue about this error message. Simple workaround would be copying update directory into /cdrom directory.</p>
<p>#cp -rf update /cdrom</p>
<p><!--more--></p>
<p><strong>References</strong></p>
<p>[1]. Standard UNIX<sup>®</sup> Installation and Activation Procedures</p>
<p>September 2008, <a title="mathworks" href="http://www.mathworks.com/access/helpdesk/help/base/install/install.html" target="_blank">http://www.mathworks.com/access/helpdesk/help/base/install/install.html</a></p>
<p>[2]. MATLAB/Simulink Installation Instructions for Students  Microsoft Windows, Apple Macintosh and Linux/Unix, The Statistical Consulting Center</p>
<p>[3].  UT Knoxville Office of Information Technology, Matlab</p>
<p>September 2008, <a title="OIT" href="http://oit.utk.edu/matlab/" target="_blank">http://oit.utk.edu/matlab/</a></p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/linux' rel='tag' target='_self'>linux</a>, <a class='technorati-link' href='http://technorati.com/tag/matlab' rel='tag' target='_self'>matlab</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/09/27/installing-matlab-on-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/09/27/installing-matlab-on-debian-lenny/</feedburner:origLink></item>
		<item>
		<title>Apache Axis2/C 1.4.0 Released.</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/WCWeZu45Jl4/</link>
		<comments>http://nethu.org/2008/05/15/apache-axis2c-140-released/#comments</comments>
		<pubDate>Fri, 16 May 2008 06:16:55 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[axis2c]]></category>
		<category><![CDATA[Apache Axis2/C]]></category>
		<category><![CDATA[guththila]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[Webservices]]></category>

		<guid isPermaLink="false">http://nethu.org/2008/05/15/apache-axis2c-140-released/</guid>
		<description><![CDATA[On 6th May 2008, Apache Axis2/C Team announced the release of Apache Axis2/C 1.4.0 . In this release ,  Guththila parser was used as the default parser. In mailing list we discussed this matter for some time and this is the first time we released with Guththila as the default parser.



Technorati Tags: Apache Axis2/C, [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">On 6th May 2008, <a href="http://ws.apache.org/axis2/c/" title="Apache Axis2/C" target="_blank">Apache Axis2/C</a> Team announced the release of Apache Axis2/C 1.4.0 . In this release ,  <a href="http://nethu.org/2008/03/30/guththila-axis2c-default-xml-parser/" title="Guththila as the default parser" target="_blank">Guththila</a> parser was used as the default parser. In mailing list we discussed this matter for some time and this is the first time we released with Guththila as the default parser.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Apache+Axis2%2FC' rel='tag' target='_self'>Apache Axis2/C</a>, <a class='technorati-link' href='http://technorati.com/tag/guththila' rel='tag' target='_self'>guththila</a>, <a class='technorati-link' href='http://technorati.com/tag/soap' rel='tag' target='_self'>soap</a>, <a class='technorati-link' href='http://technorati.com/tag/Webservices' rel='tag' target='_self'>Webservices</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/05/15/apache-axis2c-140-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/05/15/apache-axis2c-140-released/</feedburner:origLink></item>
		<item>
		<title>University of Moratuwa on TOP of the GSoc list.</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/1EFBXWVsn4A/</link>
		<comments>http://nethu.org/2008/05/15/university-of-moratuwa-on-top-of-the-gsoc-list/#comments</comments>
		<pubDate>Fri, 16 May 2008 06:07:39 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[Gsoc]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[University of Moratuwa]]></category>

		<guid isPermaLink="false">http://nethu.org/2008/05/15/university-of-moratuwa-on-top-of-the-gsoc-list/</guid>
		<description><![CDATA[Though this a bit old news, It is my pleasure to see University of Moratuwa on top of the Gsoc list. That was appeared in Google open source blog last week. My good friend Thilna has said almost everything I need to say in his blog post. Three cheers for Mora !!!



Technorati Tags: Gsoc, open [...]]]></description>
			<content:encoded><![CDATA[<p>Though this a bit old news, It is my pleasure to see <a href="http://www.mrt.ac.lk" title="University of Moratuwa" target="_blank">University of Moratuwa</a> on top of the Gsoc list. That was appeared in<a href="http://google-opensource.blogspot.com/2008/05/this-weeks-top-10s-universities-for.html" title="TOP 10 Gsoc Universities" target="_blank"> Google open source blog </a>last week. My good friend <a href="http://thilinag.blogspot.com" title="Thilina Gunarathne" target="_blank">Thilna</a> has said almost everything I need to say in his <a href="http://thilinag.blogspot.com/2008/05/university-of-moratuwa-on-top-of-gsoc.html" title="University of Moratuwa : On top of GSOC" target="_blank">blog post</a>. Three cheers for Mora !!!</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Gsoc' rel='tag' target='_self'>Gsoc</a>, <a class='technorati-link' href='http://technorati.com/tag/open+source' rel='tag' target='_self'>open source</a>, <a class='technorati-link' href='http://technorati.com/tag/University+of+Moratuwa' rel='tag' target='_self'>University of Moratuwa</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/05/15/university-of-moratuwa-on-top-of-the-gsoc-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/05/15/university-of-moratuwa-on-top-of-the-gsoc-list/</feedburner:origLink></item>
		<item>
		<title>Quite an achievement!</title>
		<link>http://feedproxy.google.com/~r/Nethu/~3/bJC60lKvq2A/</link>
		<comments>http://nethu.org/2008/05/06/quite-an-achievement/#comments</comments>
		<pubDate>Tue, 06 May 2008 18:22:26 +0000</pubDate>
		<dc:creator>dinesh</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[google page ranking]]></category>
		<category><![CDATA[page views]]></category>

		<guid isPermaLink="false">http://nethu.org/2008/05/06/quite-an-achievement/</guid>
		<description><![CDATA[After started blogging on this blog from 4th January 2008, today I noticed that this blog got: 5 in Google page ranking. I started this blog , in a way as an experiment on achieving good page ranking. Though total page views are little more than 1500, ranking is quite an achievement for me.



Technorati Tags: [...]]]></description>
			<content:encoded><![CDATA[<p>After started blogging on this blog from 4th January 2008, today I noticed that this blog got: 5 in Google page ranking. I started this blog , in a way as an experiment on achieving good page ranking. Though total page views are little more than 1500, ranking is quite an achievement for me.</p>

<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/blog' rel='tag' target='_self'>blog</a>, <a class='technorati-link' href='http://technorati.com/tag/google+page+ranking' rel='tag' target='_self'>google page ranking</a>, <a class='technorati-link' href='http://technorati.com/tag/page+views' rel='tag' target='_self'>page views</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://nethu.org/2008/05/06/quite-an-achievement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://nethu.org/2008/05/06/quite-an-achievement/</feedburner:origLink></item>
	</channel>
</rss>
