You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/12/28 09:40:24 UTC

svn commit: r359442 - in /webservices/axis2/trunk/c/test/server: ./ calculator/ calculator/Makefile.am calculator/calc.c calculator/calc.h calculator/calc_skeleton.c calculator/calc_skeleton.h calculator/calc_svc.c

Author: damitha
Date: Wed Dec 28 00:40:16 2005
New Revision: 359442

URL: http://svn.apache.org/viewcvs?rev=359442&view=rev
Log:
Added a skeleton server sample. This is supposed
not to work just now. Not even compile !!!

Added:
    webservices/axis2/trunk/c/test/server/
    webservices/axis2/trunk/c/test/server/calculator/
    webservices/axis2/trunk/c/test/server/calculator/Makefile.am
    webservices/axis2/trunk/c/test/server/calculator/calc.c
    webservices/axis2/trunk/c/test/server/calculator/calc.h
    webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c
    webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.h
    webservices/axis2/trunk/c/test/server/calculator/calc_svc.c

Added: webservices/axis2/trunk/c/test/server/calculator/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/Makefile.am?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/Makefile.am (added)
+++ webservices/axis2/trunk/c/test/server/calculator/Makefile.am Wed Dec 28 00:40:16 2005
@@ -0,0 +1,8 @@
+lib_LTLIBRARIES = libcalculator.la
+SUBDIRS =
+libcalculator_la_SOURCES = calc.c calc_svc.c calc_skeleton.c
+libcalculator_la_LIBADD  =
+INCLUDES = -I$(topbuild_dir)/include
+
+
+

Added: webservices/axis2/trunk/c/test/server/calculator/calc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc.c?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc.c (added)
+++ webservices/axis2/trunk/c/test/server/calculator/calc.c Wed Dec 28 00:40:16 2005
@@ -0,0 +1,14 @@
+#include "calc.h"
+
+axis2_om_node_t *
+add (axis2_om_node_t *node)
+{
+	return NULL;
+}
+
+axis2_om_node_t *
+multiply (axis2_om_node_t *node)
+{
+	return NULL;
+}
+

Added: webservices/axis2/trunk/c/test/server/calculator/calc.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc.h?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc.h (added)
+++ webservices/axis2/trunk/c/test/server/calculator/calc.h Wed Dec 28 00:40:16 2005
@@ -0,0 +1,11 @@
+#ifndef CALC_H
+#define CALC_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_om_node.h>
+
+axis2_om_node_t *add(axis2_om_node_t *node);
+axis2_om_node_t *multiply(axis2_om_node_t *node);
+
+#endif /* CALC_H*/

Added: webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c (added)
+++ webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c Wed Dec 28 00:40:16 2005
@@ -0,0 +1,99 @@
+#include "axis2_svc_skeleton.h"
+
+typedef struct axis2_svc_skeleton_impl
+{
+    axis2_svc_skeleton_t svc_skeleton;
+    axis2_array_list_t *func_array;
+
+} axis2_svc_skeleton_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(axis2_svc_skeleton) \
+    ((axis2_svc_skeleton_impl_t *) axis2_svc_skeleton)
+
+axis2_svc_skeleton *
+axis2_svc_skeleton_create(axis2_env_t **env)
+{
+    axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
+    skeleton_impl = AXIS2_MALLOC((*env)->allocator, 
+        sizeof(axis2_svc_skeleton_impl_t));
+
+    
+    skeleton_impl->svc_skeleton.ops = AXIS2_MALLOC(
+        (*env)->allocator, sizeof(axis2_skeleton_ops_t));
+
+    skeleton_impl->svc_skeleton.ops->free = calc_free;
+    skeleton_impl->svc_skeleton.ops->invoke = calc_invoke;
+    skeleton_impl->svc_skeleton.ops->on_fault = calc_on_fault;
+    skeleton_impl->svc_skeleton.ops->get_function_liste = calc_get_function_list;
+
+    return (&(skeleton_impl->svc_skeleton));
+}
+
+int axis2_svc_skeleton_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env)
+{
+    axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
+
+    skeleton_impl = AXIS2_INTF_TO_IMPL(svc_skeleton);
+    
+    skeleton_impl->func_array = axis2_array_create(env, 0);
+    AXIS2_ARRAY_ADD(skeleton_impl->func_array, env, "add");
+    AXIS2_ARRAY_ADD(skeleton_impl->func_array, env, "multiply");
+
+    /* Any initialization stuff of calculator goes here */
+    return AXIS2_FAILURE;
+}
+
+int 
+calc_free(axis2_svc_skeleton_t *svc_skeleton)
+{
+    axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
+
+    skeleton_impl = AXIS2_INTF_TO_IMPL(svc_skeleton);
+    
+    if(svc_skeleton->ops)
+    {
+        AXIS2_FREE((*env)->allocator, svc_skeleton->ops);
+        svc_skeleton->ops = NULL;
+    }
+
+    if(skeleton_impl->func_array)
+    {
+        AXIS2_ARRAY_LIST_FREE(skeleton_impl->func_array, env);
+        skeleton_impl->func_array = NULL;
+    }
+    
+    if(skeleton_impl)
+    {
+        AXIS2_FREE((*env)->allocator, skeleton_impl);
+        skeleton_impl = NULL;
+    }
+    
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t *calc_invoke(axis2_svc_skeleton_t *svc_skeleton,
+                                    axis2_env_t **env,
+                                    axis2_om_node_t *node,
+                                    axis2_char_t *function_name)
+{
+    /* Depending on the function name invoke the
+     *  corresponding calculator method
+     */
+    
+    return node;
+}
+
+axis2_om_node_t *calc_on_fault(axis2_svc_skeleton_t *svc_skeleton,
+                       axis2_env_t **env,
+                       axis2_om_node_t *node)
+{
+}
+
+axis2_array_list_t *calc_get_function_list(axis2_svc_skeleton_t *svc_skeleton,
+                                        axis2_env_t **env)
+{
+    return AXIS2_INTF_TO_IMPL(svc_skeleton)->func_array;
+}

Added: webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.h?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.h (added)
+++ webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.h Wed Dec 28 00:40:16 2005
@@ -0,0 +1,18 @@
+#ifndef CALC_SKELETON_H
+#define CALC_SKELETON_H
+
+#include "calc.h"
+
+
+	int AXISCALL invoke(void* pMsg);
+	void AXISCALL onFault(void* pMsg);
+	int AXISCALL init();
+	int AXISCALL fini();
+	AXIS_BINDING_STYLE AXISCALL getBindingStyle(){return RPC_ENCODED;};
+private:/*Methods corresponding to the web service methods*/
+	int EchoAttachment(void* pMsg);
+    int EchoAttachments(void* pMsg);
+
+};
+
+#endif /* CALC_SKELETON_H */

Added: webservices/axis2/trunk/c/test/server/calculator/calc_svc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc_svc.c?rev=359442&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc_svc.c (added)
+++ webservices/axis2/trunk/c/test/server/calculator/calc_svc.c Wed Dec 28 00:40:16 2005
@@ -0,0 +1,32 @@
+/*
+ * This file should be auto-generated by the Axis2 C Web Service Generator
+ * This file contains the two export functions of the Web service Dynamic Library 
+ */
+
+#include "calc_skeleton.h" 
+extern "C" {
+
+int axis2_get_instance(struct axis2_svc_skeleton **inst)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    
+	*inst = axis2_svc_skeleton_create();
+    if(NULL != *inst)
+    {
+        status = *inst->init();
+    }
+
+    return status;
+}
+
+int axis2_remove_instance(axis2_svc_skeleton *inst)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+	if (inst)
+	{
+        status = AXIS2_SVC_SKELETON_FREE(inst);
+    }
+    return status;
+}
+
+}