You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/03/20 07:03:57 UTC
svn commit: r387145 - in /webservices/axis2/trunk/c/xdocs/M0_5:
userguide2.html userguide3.html
Author: samisa
Date: Sun Mar 19 22:03:55 2006
New Revision: 387145
URL: http://svn.apache.org/viewcvs?rev=387145&view=rev
Log:
More improvements to the user guide with code syntax highliting
Modified:
webservices/axis2/trunk/c/xdocs/M0_5/userguide2.html
webservices/axis2/trunk/c/xdocs/M0_5/userguide3.html
Modified: webservices/axis2/trunk/c/xdocs/M0_5/userguide2.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/xdocs/M0_5/userguide2.html?rev=387145&r1=387144&r2=387145&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xdocs/M0_5/userguide2.html (original)
+++ webservices/axis2/trunk/c/xdocs/M0_5/userguide2.html Sun Mar 19 22:03:55 2006
@@ -140,7 +140,7 @@
<p>Let's see how we can write a client to invoke "echoString" operation of
"echo service" using the simplest blocking invocation. The complete client
-code with some explanation within comments is shown below.</p>
+code with some explanations within comments is shown below.</p>
<p><font color="#008000">#include <axis2_call.h><br>
</font> <font color="#008000">#include <axis2_om_stax_builder.h><br>
Modified: webservices/axis2/trunk/c/xdocs/M0_5/userguide3.html
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/xdocs/M0_5/userguide3.html?rev=387145&r1=387144&r2=387145&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xdocs/M0_5/userguide3.html (original)
+++ webservices/axis2/trunk/c/xdocs/M0_5/userguide3.html Sun Mar 19 22:03:55 2006
@@ -22,11 +22,11 @@
<h3>Conventions used in the document:</h3>
-<p>From here onwards I will refer to the folder where Axis2/C binary is
-installed as AXIS2C_HOME</p>
+<p>From here onwards this document will refer to the folder where Axis2/C
+binary is installed as AXIS2C_HOME</p>
-<p>In this page of the user's guide we will look at how to write and deploy
-Web Services using Axis2. All the user guide samples are located in the
+<p>In this section of user's guide we will look at how to write and deploy a
+Web Services using Axis2/C. All the user guide samples are located in the
<b>"samples"</b> directory of the binary distribution.</p>
<h2><a name="Web_Services_Using_Axis2">Web Services Using Axis2/C</a></h2>
@@ -52,16 +52,15 @@
<h4><a name="How_to_write_the_Web_Service_">How to write the Web
Service?</a></h4>
-Writing a new Web Service with Axis2/C involve four steps. I will use the
-echo service as the example.
+Writing a new Web Service with Axis2/C involve four steps.
<p>(eg . echo service )</p>
<ol>
<li><p style="margin-bottom: 0in;">Write a echo_skeleton.c file which
- implement axis2_svc_skeleton.h header file.</p>
+ implements the API given inaxis2_svc_skeleton.h header file.</p>
</li>
- <li>Write the *_service.c file (in this case echo.c service) which
- implements the actual business logic.</li>
+ <li>Write the service implementation source file file (in this case echo.c
+ service) which implements the actual business logic.</li>
<li>Write a services.xml file to explain the Web Service.</li>
<li>Create a folder with the service name under AXIS2C_HOME/services and
put the compiled service ( .dll or .so file) for the Web Service and
@@ -77,226 +76,426 @@
assigned by a service skeleton.</p>
<p>They are:-</p>
-<pre class="code">/* initialize the service */
-int (AXIS2_CALL * init) (axis2_svc_skeleton_t *svc_skeleton,axis2_env_t **env);
-/*deallocate the memory */
-int (AXIS2_CALL *free)(axis2_svc_skeleton_t *svc_skeli, axis2_env_t **env);
-
-/* invoke the service */
-axis2_om_node_t * (AXIS2_CALL*invoke)(axis2_svc_skeleton_t *svc_skeli,
+<pre class="code"><font color="#808080"><i>/* initialize the service */</i></font>
+int (AXIS2_CALL * init) (axis2_svc_skeleton_t *svc_skeleton,
+ axis2_env_t **env);
+<font color="#808080"><i>/* invoke the service */</i></font>
+axis2_om_node_t * (AXIS2_CALL* invoke)(axis2_svc_skeleton_t *svc_skeli,
axis2_env_t **env, axis2_om_node_t *node);
-/*on a fault, this function is called */
+<font color="#808080"><i>/*on a fault, this function is called */</i></font>
axis2_om_node_t *(AXIS2_CALL* on_fault)(axis2_svc_skeleton_t *svc_skeli,
- axis2_env_t **env, axis2_om_node_t *node);</pre>
+ axis2_env_t **env, axis2_om_node_t *node);
+<font color="#808080"><i>/*deallocate the memory */</i></font>
+int (AXIS2_CALL *free)(axis2_svc_skeleton_t *svc_skeli,
+ axis2_env_t **env);</pre>
<p>Lets implement the above functions for echo service.</p>
-<pre class="code">int AXIS2_CALL echo_init(axis2_svc_skeleton_t *svc_skeleton,axis2_env_t **env)
-{
- svc_skeleton->func_array = axis2_array_list_create(env, 0);
- /* Here, we add the implemented operation names of the service to an
- * array list of functions
- */
- AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array , env, "echoString");
-
- /* Any initialization stuff of echo goes here */
-
- return AXIS2_SUCCESS;
-}
-
-/* invoke implementation */
-axis2_om_node_t* AXIS2_CALL
-echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
- axis2_env_t **env, axis2_om_node_t *node)
-{
- /* invoke the implemented echo service*/
- return axis2_echo_echo(env, node);
-}
-
-int AXIS2_CALL echo_free(axis2_svc_skeleton_t *svc_skeleton, axis2_env_t **env)
-{
- /* free the function array */
- if(svc_skeleton->func_array)
- {
- AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
- svc_skeleton->func_array = NULL;
- }
- /* free the operations struct */
- if(svc_skeleton->ops)
- {
- AXIS2_FREE((*env)->allocator, svc_skeleton->ops);
- svc_skeleton->ops = NULL;
- }
- if(svc_skeleton)
- {
- AXIS2_FREE((*env)->allocator,svc_skeleton);
- svc_skeleton = NULL;
- }
-
- return AXIS2_SUCCESS;
-}
-
-axis2_status_t AXIS2_CALL
-echo_on_fault(axis2_svc_skeleton_t *svc_skeli,
- axis2_env_t **env, axis2_om_node_t *node)
-{
- /*Here we are just setting a simple error message inside a element
- * called 'EchoServiceError'
- */
- axis2_om_node_t *error_node = NULL;
- axis2_om_node_t* text_node = NULL;
- axis2_om_element_t *error_ele = NULL;
- axis2_om_text_t *text = NULL;
- error_ele = axis2_om_element_create(env, node, "EchoServiceError",NULL,
- &error_node);
- AXIS2_OM_ELEMENT_SET_TEXT(error_ele, env, "Echo service failed ",
- &text_node);
- return error_node;
-}</pre>
-<p>Now we can write the create function of the echo_service_skeleton as<br>
-follows.<br>
+<p><font color="#808080"><i>/* Initialize the service */</i></font><br>
+<font color="#800000">int</font> <font color="#000000">AXIS2_CALL</font><br>
+<font color="#000000">echo_init</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">svc_skeleton</font>,<br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>)<br>
+{<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">func_array</font> = <font
+color="#000000">axis2_array_list_create</font>(<font
+color="#000000">env</font>, <font color="#0000FF">0</font>);<br>
+ <font
+color="#808080"><i>/* Add the implemented operation names of the service to <br>
+ * the array list of functions <br>
+ */</i></font><br>
+ <font color="#000000">AXIS2_ARRAY_LIST_ADD</font>(<font
+color="#000000">svc_skeleton</font>-><font
+color="#000000">func_array</font>, <font color="#000000">env</font>, <font
+color="#FF0000">"echoString"</font>);<br>
+ <font
+color="#808080"><i>/* Any initialization stuff of echo service should go here */</i></font><br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">AXIS2_SUCCESS</font>;<br>
+}<br>
+<br>
+<font color="#808080"><i>/*<br>
+ * This method invokes the right service method <br>
+ */</i></font><br>
+<font color="#000000">axis2_om_node_t</font>* <font
+color="#000000">AXIS2_CALL</font><br>
+<font color="#000000">echo_invoke</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">svc_skeleton</font>,<br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>,<br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">node</font>)<br>
+{<br>
+ <font color="#808080"><i>/* Invoke the business logic.<br>
+ * Depending on the function name invoke the correct impl method.<br>
+ * We have only echo in this sample, hence invoke echo method.<br>
+ * To see how to deal with multiple impl methods, have a look at the<br>
+ * math sample.<br>
+ */</i></font><br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">axis2_echo_echo</font>(<font
+color="#000000">env</font>, <font color="#000000">node</font>);<br>
+}<br>
+<br>
+<font color="#808080"><i>/* On fault, handle the fault */</i></font><br>
+<font color="#000000">axis2_om_node_t</font>* <font
+color="#000000">AXIS2_CALL</font><br>
+<font color="#000000">echo_on_fault</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">svc_skeli</font>, <br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>, <font
+color="#000000">axis2_om_node_t</font> *<font color="#000000">node</font>)<br>
+{<br>
+ <font
+color="#808080"><i>/* Here we are just setting a simple error message inside an element <br>
+ * called 'EchoServiceError' <br>
+ */</i></font><br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">error_node</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_node_t</font>* <font
+color="#000000">text_node</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_element_t</font> *<font
+color="#000000">error_ele</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">error_ele</font> = <font
+color="#000000">axis2_om_element_create</font>(<font
+color="#000000">env</font>, <font color="#000000">node</font>, <font
+color="#FF0000">"EchoServiceError"</font>, <font
+color="#000000">NULL</font>, <br>
+ &<font color="#000000">error_node</font>);<br>
+ <font color="#000000">AXIS2_OM_ELEMENT_SET_TEXT</font>(<font
+color="#000000">error_ele</font>, <font color="#000000">env</font>, <font
+color="#FF0000">"Echo service failed "</font>, <br>
+ <font color="#000000">text_node</font>);<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">error_node</font>;<br>
+}<br>
+<br>
+<font color="#808080"><i>/* Free the resources used */</i></font><br>
+<font color="#800000">int</font> <font color="#000000">AXIS2_CALL</font><br>
+<font color="#000000">echo_free</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">svc_skeleton</font>,<br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>)<br>
+{<br>
+ <font color="#808080"><i>/* Free the function array */</i></font><br>
+ <font color="#000000"><b>if</b></font>(<font
+color="#000000">svc_skeleton</font>-><font
+color="#000000">func_array</font>)<br>
+ {<br>
+ <font color="#000000">AXIS2_ARRAY_LIST_FREE</font>(<font
+color="#000000">svc_skeleton</font>-><font
+color="#000000">func_array</font>, <font color="#000000">env</font>);<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">func_array</font> = <font color="#000000">NULL</font>;<br>
+ }<br>
+ <br>
+ <font color="#808080"><i>/* Free the function array */</i></font><br>
+ <font color="#000000"><b>if</b></font>(<font
+color="#000000">svc_skeleton</font>-><font color="#000000">ops</font>)<br>
+ {<br>
+ <font color="#000000">AXIS2_FREE</font>((*<font
+color="#000000">env</font>)-><font color="#000000">allocator</font>, <font
+color="#000000">svc_skeleton</font>-><font color="#000000">ops</font>);<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font> = <font color="#000000">NULL</font>;<br>
+ }<br>
+ <br>
+ <font color="#808080"><i>/* Free the service skeleton */</i></font><br>
+ <font color="#000000"><b>if</b></font>(<font
+color="#000000">svc_skeleton</font>)<br>
+ {<br>
+ <font color="#000000">AXIS2_FREE</font>((*<font
+color="#000000">env</font>)-><font color="#000000">allocator</font>, <font
+color="#000000">svc_skeleton</font>);<br>
+ <font color="#000000">svc_skeleton</font> = <font
+color="#000000">NULL</font>;<br>
+ }<br>
+<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">AXIS2_SUCCESS</font>; <br>
+}<br>
</p>
-<pre class="code">axis2_svc_skeleton_t *axis2_echo_create(axis2_env_t **env)
-{
- /* Here we are just allocating memory for the structures and setting
- * the function pointers
- */
- axis2_svc_skeleton_t *svc_skeleton = NULL;
- svc_skeleton = AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_svc_skeleton_t));
- svc_skeleton->ops = AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_svc_skeleton_ops_t));
- /** assign function pointers */
- svc_skeleton->ops->free = echo_free;
- svc_skeleton->ops->free_void_arg = echo_free_void_arg;
- svc_skeleton->ops->init = echo_init;
- svc_skeleton->ops->invoke = echo_invoke;
- svc_skeleton->ops->on_fault = echo_on_fault;
- return svc_skeleton;
-}</pre>
+<pre class="code"></pre>
+
+<p>Now we can write the create function of the echo_service_skeleton as<br>
+follows.</p>
+
+<p><font color="#808080"><i>/*Create function */<br>
+</i></font> <font color="#000000">axis2_svc_skeleton_t</font> *<br>
+<font color="#000000">axis2_echo_create</font>(<font
+color="#000000">axis2_env_t</font> **<font color="#000000">env</font>)<br>
+{<br>
+ <font color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">svc_skeleton</font> = <font color="#000000">NULL</font>;<br>
+ <font
+color="#808080"><i>/* Allocate memory for the structs */</i></font><br>
+ <font color="#000000">svc_skeleton</font> = <font
+color="#000000">AXIS2_MALLOC</font>((*<font
+color="#000000">env</font>)-><font color="#000000">allocator</font>, <br>
+ <font color="#000000"><b>sizeof</b></font>(<font
+color="#000000">axis2_svc_skeleton_t</font>));<br>
+<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font> = <font color="#000000">AXIS2_MALLOC</font>(<br>
+ (*<font color="#000000">env</font>)-><font
+color="#000000">allocator</font>, <font
+color="#000000"><b>sizeof</b></font>(<font
+color="#000000">axis2_svc_skeleton_ops_t</font>));<br>
+<br>
+ <font color="#808080"><i>/* Assign function pointers */</i></font><br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font>-><font color="#000000">free</font> = <font
+color="#000000">echo_free</font>;<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font>-><font color="#000000">init</font> = <font
+color="#000000">echo_init</font>;<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font>-><font color="#000000">invoke</font> = <font
+color="#000000">echo_invoke</font>;<br>
+ <font color="#000000">svc_skeleton</font>-><font
+color="#000000">ops</font>-><font color="#000000">on_fault</font> = <font
+color="#000000">echo_on_fault</font>;<br>
+<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">svc_skeleton</font>;<br>
+}</p>
+
+<p></p>
<p>In addition to the above functions every service must have the following
-two functions with exactly the same as the functionsignature in
-xxx_skeleton.c file.</p>
+two functions with exactly the same function signature as in xxx_skeleton.c
+file.</p>
+<br>
+
+
+<p><font color="#000000">AXIS2_EXPORT</font> <font
+color="#800000">int</font> <br>
+<font color="#000000">axis2_get_instance</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> **<font
+color="#000000">inst</font>,<br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>)<br>
+{<br>
+ *<font color="#000000">inst</font> = <font
+color="#000000">axis2_echo_create</font>(<font
+color="#000000">env</font>);<br>
+ <font color="#000000"><b>if</b></font>(!(*<font
+color="#000000">inst</font>))<br>
+ {<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">AXIS2_FAILURE</font>;<br>
+ }<br>
+<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">AXIS2_SUCCESS</font>;<br>
+}<br>
<br>
+<font color="#000000">AXIS2_EXPORT</font> <font
+color="#800000">int</font> <br>
+<font color="#000000">axis2_remove_instance</font>(<font
+color="#000000">axis2_svc_skeleton_t</font> *<font
+color="#000000">inst</font>,<br>
+ <font color="#000000">axis2_env_t</font> **<font
+color="#000000">env</font>)<br>
+{<br>
+ <font color="#000000">axis2_status_t</font> <font
+color="#000000">status</font> = <font
+color="#000000">AXIS2_FAILURE</font>;<br>
+ <font color="#000000"><b>if</b></font> (<font
+color="#000000">inst</font>)<br>
+ {<br>
+ <font color="#000000">status</font> = <font
+color="#000000">AXIS2_SVC_SKELETON_FREE</font>(<font
+color="#000000">inst</font>, <font color="#000000">env</font>);<br>
+ }<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">status</font>;<br>
+}<br>
+</p>
-<pre>AXIS2_EXPORT int axis2_get_instance(axis2_svc_skeleton_t **inst,
- axis2_env_t **env)
-{
- *inst = axis2_echo_create(env);
- if(!(*inst))
- {
- return AXIS2_FAILURE;
- }
- return AXIS2_SUCCESS;
-}
-
-AXIS2_EXPORT int axis2_remove_instance(axis2_svc_skeleton_t *inst,
- axis2_env_t **env)
-{
- axis2_status_t status = AXIS2_FAILURE;
- if (inst)
- {
- status = AXIS2_SVC_SKELETON_FREE(inst, env);
- }
- return status;
-}</pre>
-
-<p>Axis2 engine loads the service dll but it needs to know which method to
-call. Since C does not have refection, we need to have some dll exposed
-functions known to axis2 engine. <b>axis2_get_instance</b> and
-<b>axis2_remove_instance</b> are exactly those two functions that need to be
-exposed from service dll (or any other dll of axis2 engine).
-axis2_get_instance creates a new service instance.</p>
-
-<p>Axis2 engine gets it in a return pointer and cast it to axis2_svc_skeleton
-interface.Then inteface methods can be called by Axis2 Engine. Once it is
-cast to interface, any of the interface method can be used.</p>
+<p>Axis2/C engine can load the service dll, however, it needs to know which
+method to call. Since C does not have reflection, we need to have some dll
+exposed functions known to Axis2/C engine. <b>axis2_get_instance</b> and
+<b>axis2_remove_instance</b> are the two functions that need to be exposed
+from a service dll (or any other dll of Axis2/C engine). Axis2/C engine calls
+axis2_get_instance method, which creates a new service instance, an cast the
+return pointer to axis2_svc_skeleton interface.Then the interface methods can
+be called by Axis2/C engine.</p>
<a name="Step2"></a>
-<h4>Step2 : Now we can write the echo service in a file echo.c<br>
-</h4>
-<pre class="code">axis2_om_node_t* axis2_echo_echo(axis2_env_t **env, axis2_om_node_t *node)
-{
- axis2_om_node_t *text_parent_node = NULL;
- axis2_om_node_t *text_node = NULL;
- axis2_om_node_t *ret_node = NULL;
- AXIS2_ENV_CHECK(env, NULL);
-
- if (!node)
- {
- AXIS2_ERROR_SET((*env)->error,
- AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL,AXIS2_FAILURE);
- printf("Echo client ERROR: input parameter NULL\n");
- return NULL;
- }
- text_parent_node = AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
- if (!text_parent_node)
- {
- AXIS2_ERROR_SET((*env)->error ,
- AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
- AXIS2_FAILURE);
- printf("Echo client ERROR: invalid XML in request\n");
- return NULL;
- }
- text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(text_parent_node, env);
- if (!text_node)
- {
- AXIS2_ERROR_SET((*env)->error,
- AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
- AXIS2_FAILURE);
- printf("Echo client ERROR:invalid XML in request\n");
- return NULL;
- }
-
- if (AXIS2_OM_NODE_GET_NODE_TYPE(text_node, env) == AXIS2_OM_TEXT)
- {
- axis2_om_text_t *text = (axis2_om_text_t *)
- AXIS2_OM_NODE_GET_DATA_ELEMENT(text_node, env);
- if( text && AXIS2_OM_TEXT_GET_VALUE(text , env))
- {
- axis2_char_t *text_str = AXIS2_OM_TEXT_GET_VALUE(text, env);
- printf("Echoing text value %s \n", text_str);
- ret_node = build_om_programatically(env, text_str);
- }
- else
- {
- AXIS2_ERROR_SET((*env)->error,
- AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
- AXIS2_FAILURE);
- printf("Echo client ERROR: invalid XML in request\n");
- return NULL;
- }
- return ret_node;
-}
-
-axis2_om_node_t *build_om_programatically(axis2_env_t **env, axis2_char_t *text)
-{
- axis2_om_node_t *echo_om_node = NULL;
- axis2_om_element_t* echo_om_ele = NULL;
- axis2_om_node_t* text_om_node = NULL;
- axis2_om_element_t * text_om_ele = NULL;
- axis2_om_namespace_t *ns1 = NULL;
- ns1 = axis2_om_namespace_create (env,
- "http://localhost:9090/axis2/services/echo",
- "ns1");
- echo_om_ele = axis2_om_element_create(env, NULL, "echoString", ns1,
- &echo_om_node);
- text_om_ele = axis2_om_element_create(env, echo_om_node, "text", NULL,
- &text_om_node);
- AXIS2_OM_ELEMENT_SET_TEXT(text_om_ele, env, text, text_om_node);
- return echo_om_node;
-}</pre>
-<a name="Step3"></a>
+<h4>Step2 : Now we can write the echo service in a file echo.c</h4>
+<a name="Step3">axis2_om_node_t *<br>
+<font color="#000000">axis2_echo_echo</font> (<font
+color="#000000">axis2_env_t</font> **<font color="#000000">env</font>, <font
+color="#000000">axis2_om_node_t</font> *<font color="#000000">node</font>)<br>
+{<br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">text_parent_node</font> = <font
+color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">text_node</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">ret_node</font> = <font color="#000000">NULL</font>;<br>
+<br>
+ <font color="#000000">AXIS2_ENV_CHECK</font>(<font
+color="#000000">env</font>, <font color="#000000">NULL</font>);<br>
+ <br>
+ <font color="#808080"><i>/* Expected request format is :-<br>
+ * <ns1:echoString xmlns:ns1="http://localhost:9090/axis2/services/echo"><br>
+ * <text>echo5</text><br>
+ * </ns1:echoString><br>
+ */</i></font><br>
+ <font color="#000000"><b>if</b></font> (!<font
+color="#000000">node</font>) <font
+color="#808080"><i>/* 'echoString' node */</i></font><br>
+ {<br>
+ <font color="#000000">AXIS2_ERROR_SET</font>((*<font
+color="#000000">env</font>)-><font color="#000000">error</font>, <font
+color="#000000">AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL</font>, <font
+color="#000000">AXIS2_FAILURE</font>);<br>
+ <font color="#000000">printf</font>(<font
+color="#FF0000">"Echo client ERROR: input parameter NULL\n"</font>);<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">NULL</font>;<br>
+ }<br>
+<br>
+ <font color="#000000">text_parent_node</font> = <font
+color="#000000">AXIS2_OM_NODE_GET_FIRST_CHILD</font>(<font
+color="#000000">node</font>, <font color="#000000">env</font>);<br>
+ <font color="#000000"><b>if</b></font> (!<font
+color="#000000">text_parent_node</font>) <font
+color="#808080"><i>/* 'text' node */</i></font><br>
+ {<br>
+ <font color="#000000">AXIS2_ERROR_SET</font>((*<font
+color="#000000">env</font>)-><font color="#000000">error</font>, <font
+color="#000000">AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST</font>, <font
+color="#000000">AXIS2_FAILURE</font>);<br>
+ <font color="#000000">printf</font>(<font
+color="#FF0000">"Echo client ERROR: invalid XML in request\n"</font>);<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">NULL</font>;<br>
+ }<br>
+ <br>
+ <font color="#000000">text_node</font> = <font
+color="#000000">AXIS2_OM_NODE_GET_FIRST_CHILD</font>(<font
+color="#000000">text_parent_node</font>, <font
+color="#000000">env</font>);<br>
+ <font color="#000000"><b>if</b></font> (!<font
+color="#000000">text_node</font>) <font
+color="#808080"><i>/* actual text to echo */</i></font><br>
+ {<br>
+ <font color="#000000">AXIS2_ERROR_SET</font>((*<font
+color="#000000">env</font>)-><font color="#000000">error</font>, <font
+color="#000000">AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST</font>, <font
+color="#000000">AXIS2_FAILURE</font>);<br>
+ <font color="#000000">printf</font>(<font
+color="#FF0000">"Echo client ERROR: invalid XML in request\n"</font>);<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">NULL</font>;<br>
+ }<br>
+ <br>
+ <font color="#000000"><b>if</b></font> (<font
+color="#000000">AXIS2_OM_NODE_GET_NODE_TYPE</font>(<font
+color="#000000">text_node</font>, <font color="#000000">env</font>) == <font
+color="#000000">AXIS2_OM_TEXT</font>)<br>
+ {<br>
+ <font color="#000000">axis2_om_text_t</font> *<font
+color="#000000">text</font> = (<font
+color="#000000">axis2_om_text_t</font> *)<font
+color="#000000">AXIS2_OM_NODE_GET_DATA_ELEMENT</font>(<font
+color="#000000">text_node</font>, <font color="#000000">env</font>);<br>
+ <font color="#000000"><b>if</b></font>( <font
+color="#000000">text</font> && <font
+color="#000000">AXIS2_OM_TEXT_GET_VALUE</font>(<font
+color="#000000">text</font> , <font color="#000000">env</font>))<br>
+ {<br>
+ <font color="#000000">axis2_char_t</font> *<font
+color="#000000">text_str</font> = <font
+color="#000000">AXIS2_OM_TEXT_GET_VALUE</font>(<font
+color="#000000">text</font>, <font color="#000000">env</font>);<br>
+ <font color="#000000">printf</font>(<font
+color="#FF0000">"Echoing text value %s \n"</font>, <font
+color="#000000">text_str</font>);<br>
+ <font color="#000000">ret_node</font> = <font
+color="#000000">build_om_programatically</font>(<font
+color="#000000">env</font>, <font color="#000000">text_str</font>);<br>
+ }<br>
+ }<br>
+ <font color="#000000"><b>else</b></font><br>
+ {<br>
+ <font color="#000000">AXIS2_ERROR_SET</font>((*<font
+color="#000000">env</font>)-><font color="#000000">error</font>, <font
+color="#000000">AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST</font>, <font
+color="#000000">AXIS2_FAILURE</font>);<br>
+ <font color="#000000">printf</font>(<font
+color="#FF0000">"Echo client ERROR: invalid XML in request\n"</font>);<br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">NULL</font>;<br>
+ }<br>
+ <br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">ret_node</font>;<br>
+}<br>
+<br>
+<font color="#808080"><i>/* Builds the response content */</i></font><br>
+<font color="#000000">axis2_om_node_t</font> *<br>
+<font color="#000000">build_om_programatically</font>(<font
+color="#000000">axis2_env_t</font> **<font color="#000000">env</font>, <font
+color="#000000">axis2_char_t</font> *<font color="#000000">text</font>)<br>
+{<br>
+ <font color="#000000">axis2_om_node_t</font> *<font
+color="#000000">echo_om_node</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_element_t</font>* <font
+color="#000000">echo_om_ele</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_node_t</font>* <font
+color="#000000">text_om_node</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_element_t</font> * <font
+color="#000000">text_om_ele</font> = <font color="#000000">NULL</font>;<br>
+ <font color="#000000">axis2_om_namespace_t</font> *<font
+color="#000000">ns1</font> = <font color="#000000">NULL</font>;<br>
+ <br>
+ <font color="#000000">ns1</font> = <font
+color="#000000">axis2_om_namespace_create</font> (<font
+color="#000000">env</font>, <font
+color="#FF0000">"http://localhost:9090/axis2/services/echo"</font>, <font
+color="#FF0000">"ns1"</font>);<br>
+<br>
+ <font color="#000000">echo_om_ele</font> = <font
+color="#000000">axis2_om_element_create</font>(<font
+color="#000000">env</font>, <font color="#000000">NULL</font>, <font
+color="#FF0000">"echoString"</font>, <font
+color="#000000">ns1</font>, &<font
+color="#000000">echo_om_node</font>);<br>
+ <br>
+ <font color="#000000">text_om_ele</font> = <font
+color="#000000">axis2_om_element_create</font>(<font
+color="#000000">env</font>, <font color="#000000">echo_om_node</font>, <font
+color="#FF0000">"text"</font>, <font color="#000000">NULL</font>, &<font
+color="#000000">text_om_node</font>);<br>
+<br>
+ <font color="#000000">AXIS2_OM_ELEMENT_SET_TEXT</font>(<font
+color="#000000">text_om_ele</font>, <font color="#000000">env</font>, <font
+color="#000000">text</font>, <font color="#000000">text_om_node</font>);<br>
+ <br>
+ <font color="#000000"><b>return</b></font> <font
+color="#000000">echo_om_node</font>;<br>
+}<br>
+</a>
<h4>Step3 :Write the services.xml file</h4>
-<p>Axis2 uses "services.xml" to keep configurations for a Web Service. Each
-Web Service deployed in Axis2 needs a "services.xml" containing the
+<p>Axis2/C uses "services.xml" to keep configurations for a Web Service. Each
+Web Service deployed in Axis2/C needs a "services.xml" containing the
configurations. Note that services.xml has the same semantics as Axis2 Java's
services.xml file. Only difference is that for class attributes instead of
-giving package qualified class name, we use dll name. Services.xml for
-MyService will be as follows.</p>
+giving package qualified class name, we use dll name. services.xml for echo
+will be as follows.</p>
<pre class="code"><service name="echo">
<parameter name="ServiceClass" locked="xsd:false">echo</parameter>
<description>
@@ -305,24 +504,23 @@
<operation name="echoString">
<parameter name="wsamapping">
- http://127.0.0.1:9090/axis2/services/echo/echoString
+ http://localhost:9090/axis2/services/echo/echoString
</parameter>
</operation>
</service></pre>
-<p><em>The above XML tags can be explained as follows:</em></p>
+<p><em></em></p>
Name of the service will be the name of the Folder with the shared library
-and the services.xml , In this case we will have a folder named echo in which
-we have the echo.dll and services.xml file. because services.xml contains
-only one service element. <br>
-
+and the services.xml , in this example case we will have a folder named echo
+in which we have the echo.dll (or libecho.so on Linux platform) and
+services.xml file.
<p>You can write a services.xml file to include a group of services instead
of a single service. This makes management and deployment of a set of related
services very easy. At runtime you can share information between these
-services within a single interaction using the axis2_svc_grp_ctx
-(ServiceGroupContext ). If you hope to use this functionality, the
-services.xml file should have following format.<br>
+services within a single interaction using the axis2_svc_grp_ctx (Service
+Group Context ). If you hope to use this functionality, the services.xml file
+should have following format.<br>
</p>
<pre class="code"><serviceGroup>
<service name="Service1">
@@ -337,13 +535,14 @@
<p>Note : name of the service is a compulsory attribute</p>
<a name="Step4"></a>
-<h4>Step4 :Create the Web Service Folder in services folder.</h4>
+<h4>Step4 :Create the Web Service Folder in services folder of the
+repository.</h4>
<p>In Axis2/C , it is required to create a folder with the corresponding
service/service group name which will contain the shared library (compiled
service) and the services.xml file which describe the web service. So in this
-case we will have a folder named echo which contain the services,xml file and
-echo dll.</p>
+example case we will have a folder named echo which contain the services,xml
+file and echo dll.</p>
<a name="deploy"></a>
<h3>Deploy the Web Service</h3>