axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r392198 - in /webservices/axis2/trunk/c/samples: ./ server/ server/sg_math/
Date Fri, 07 Apr 2006 06:24:14 GMT
Author: samisa
Date: Thu Apr  6 23:24:10 2006
New Revision: 392198

URL: http://svn.apache.org/viewcvs?rev=392198&view=rev
Log:
Added service group sample

Added:
    webservices/axis2/trunk/c/samples/server/sg_math/
    webservices/axis2/trunk/c/samples/server/sg_math/Makefile.am
    webservices/axis2/trunk/c/samples/server/sg_math/add.c
    webservices/axis2/trunk/c/samples/server/sg_math/add.h
    webservices/axis2/trunk/c/samples/server/sg_math/add_skeleton.c
    webservices/axis2/trunk/c/samples/server/sg_math/div.c
    webservices/axis2/trunk/c/samples/server/sg_math/div.h
    webservices/axis2/trunk/c/samples/server/sg_math/div_skeleton.c
    webservices/axis2/trunk/c/samples/server/sg_math/mul.c
    webservices/axis2/trunk/c/samples/server/sg_math/mul.h
    webservices/axis2/trunk/c/samples/server/sg_math/mul_skeleton.c
    webservices/axis2/trunk/c/samples/server/sg_math/services.xml
    webservices/axis2/trunk/c/samples/server/sg_math/sub.c
    webservices/axis2/trunk/c/samples/server/sg_math/sub.h
    webservices/axis2/trunk/c/samples/server/sg_math/sub_skeleton.c
Modified:
    webservices/axis2/trunk/c/samples/configure.ac
    webservices/axis2/trunk/c/samples/server/Makefile.am

Modified: webservices/axis2/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/configure.ac?rev=392198&r1=392197&r2=392198&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/configure.ac (original)
+++ webservices/axis2/trunk/c/samples/configure.ac Thu Apr  6 23:24:10 2006
@@ -66,6 +66,7 @@
     server/echo/Makefile \
     server/math/Makefile \
     server/notify/Makefile \
+    server/sg_math/Makefile \
     client/Makefile \
     client/echo/Makefile \
     client/math/Makefile \

Modified: webservices/axis2/trunk/c/samples/server/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/Makefile.am?rev=392198&r1=392197&r2=392198&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/server/Makefile.am (original)
+++ webservices/axis2/trunk/c/samples/server/Makefile.am Thu Apr  6 23:24:10 2006
@@ -1,5 +1,5 @@
 samplesdir=$(prefix)/samples/server
-SUBDIRS = echo math notify
+SUBDIRS = echo math notify sg_math
 EXTRA_DIST = axis2.xml
 samples_DATA= axis2.log  axis2.xml  Makefile.am Makefile.in
 

Added: webservices/axis2/trunk/c/samples/server/sg_math/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/Makefile.am?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/Makefile.am Thu Apr  6 23:24:10 2006
@@ -0,0 +1,18 @@
+prglibdir=$(prefix)/services/sg_math
+samplesdir=$(prefix)/samples/server/sg_math
+prglib_LTLIBRARIES = libadd.la libsub.la libmul.la libdiv.la
+samples_DATA=services.xml \
+                add.h add.c add_skeleton.c \
+                sub.h sub.c sub_skeleton.c \
+                mul.h mul.c mul_skeleton.c \
+                div.h div.c div_skeleton.c \
+                Makefile.am Makefile.in
+prglib_DATA=services.xml
+EXTRA_DIST = services.xml
+noinst_HEADERS = add.h sub.h mul.h div.h
+libadd_la_SOURCES = add.c add_skeleton.c
+libsub_la_SOURCES = sub.c sub_skeleton.c
+libmul_la_SOURCES = mul.c mul_skeleton.c
+libdiv_la_SOURCES = div.c div_skeleton.c
+INCLUDES = -I$(AXIS2C_HOME)/include \
+            -I$(AXIS2C_HOME)/platforms

Added: webservices/axis2/trunk/c/samples/server/sg_math/add.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/add.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/add.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/add.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "add.h"
+#include <stdio.h>
+
+axis2_om_node_t *
+axis2_add_add (axis2_env_t **env, axis2_om_node_t *node)
+{
+    axis2_om_node_t *param1_node = NULL;
+    axis2_om_node_t *param1_text_node = NULL;
+    axis2_char_t *param1_str = NULL;
+    long int param1 = 0;
+    axis2_om_node_t *param2_node = NULL;
+    axis2_om_node_t *param2_text_node = NULL;
+    axis2_char_t *param2_str = NULL;
+    long int param2 = 0;
+
+    if (!node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("Math client request ERROR: input parameter NULL\n");
+        return NULL;
+    }
+
+    param1_node = AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
+    if (!param1_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param1_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param1_node, env);
+    if (!param1_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param1_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param1_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param1_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    param2_node = AXIS2_OM_NODE_GET_NEXT_SIBLING(param1_node, env);
+    if (!param2_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param2_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param2_node, env);
+    if (!param2_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param2_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param2_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param2_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    if (param1_str && param2_str)
+    {
+        long int result = 0;
+        axis2_char_t result_str[255];
+
+        axis2_om_element_t *ele1 = NULL;
+        axis2_om_node_t *node1 = NULL, *node2 = NULL;
+        axis2_om_namespace_t *ns1 = NULL;
+        axis2_om_text_t *text1 = NULL;
+        
+        param1 = strtol(param1_str, NULL, 10);
+        param2 = strtol(param2_str, NULL, 10);
+        result = param1 + param2;
+        sprintf(result_str, "%ld", result);
+
+        
+
+        ns1 = axis2_om_namespace_create (env,
+                                   "http://axis2/test/namespace1",
+                                   "ns1");
+        ele1 = axis2_om_element_create (env, NULL, "result", ns1, &node1);
+        text1 = axis2_om_text_create (env, node1, result_str, &node2);
+
+        return node1;
+    }
+    
+    AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST, AXIS2_FAILURE);
+    printf("Math service ERROR: invalid parameters\n");
+    return NULL;
+}
+
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/add.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/add.h?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/add.h (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/add.h Thu Apr  6 23:24:10 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#ifndef ADD_H
+#define ADD_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axis2_om_text.h>
+#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+
+axis2_om_node_t *axis2_add_add(axis2_env_t **env, axis2_om_node_t *node);
+
+#endif /* ADD_H*/

Added: webservices/axis2/trunk/c/samples/server/sg_math/add_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/add_skeleton.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/add_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/add_skeleton.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "axis2_svc_skeleton.h"
+#include "add.h"
+#include <axis2_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+add_free(axis2_svc_skeleton_t *svc_skeleton,
+          axis2_env_t **env);
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL 
+add_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node);
+
+int AXIS2_CALL add_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env);
+
+
+AXIS2_DECLARE(axis2_svc_skeleton_t *)
+axis2_add_create(axis2_env_t **env)
+{
+    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));
+
+    svc_skeleton->func_array = NULL;
+
+    svc_skeleton->ops->free = add_free;
+    svc_skeleton->ops->init = add_init;
+    svc_skeleton->ops->invoke = add_invoke;
+    /*svc_skeleton->ops->on_fault = add_on_fault;*/
+
+    return svc_skeleton;
+}
+
+int AXIS2_CALL
+add_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "add");
+
+    /* Any initialization stuff of add goes here */
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+add_free(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env)
+{
+    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; 
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL
+add_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node)
+{
+    /* Depending on the function name invoke the
+     *  corresponding add method
+     */
+    if (node)
+    {
+        if (AXIS2_OM_NODE_GET_NODE_TYPE(node, env) == AXIS2_OM_ELEMENT)
+        {
+            axis2_om_element_t *element = NULL;
+            element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+            if (element)
+            {
+                axis2_char_t *op_name = AXIS2_OM_ELEMENT_GET_LOCALNAME(element, env);
+                if (op_name)
+                {
+                    if ( AXIS2_STRCMP(op_name, "add") == 0 )
+                        return axis2_add_add(env, node);
+                }
+            }
+        }
+    }
+    
+    printf("Math service ERROR: invalid OM parameters in request\n");
+    
+    /** TODO: return a SOAP fault here */
+    return node;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int axis2_get_instance(struct axis2_svc_skeleton **inst,
+                        axis2_env_t **env)
+{
+	*inst = axis2_add_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;
+}
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/div.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/div.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/div.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/div.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "div.h"
+#include <stdio.h>
+
+axis2_om_node_t *
+axis2_div_div (axis2_env_t **env, axis2_om_node_t *node)
+{
+    axis2_om_node_t *param1_node = NULL;
+    axis2_om_node_t *param1_text_node = NULL;
+    axis2_char_t *param1_str = NULL;
+    long int param1 = 0;
+    axis2_om_node_t *param2_node = NULL;
+    axis2_om_node_t *param2_text_node = NULL;
+    axis2_char_t *param2_str = NULL;
+    long int param2 = 0;
+
+    if (!node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("Math client request ERROR: input parameter NULL\n");
+        return NULL;
+    }
+
+    param1_node = AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
+    if (!param1_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param1_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param1_node, env);
+    if (!param1_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param1_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param1_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param1_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    param2_node = AXIS2_OM_NODE_GET_NEXT_SIBLING(param1_node, env);
+    if (!param2_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param2_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param2_node, env);
+    if (!param2_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param2_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param2_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param2_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    if (param1_str && param2_str)
+    {
+        long int result = 0;
+        axis2_char_t result_str[255];
+
+        axis2_om_element_t *ele1 = NULL;
+        axis2_om_node_t *node1 = NULL, *node2 = NULL;
+        axis2_om_namespace_t *ns1 = NULL;
+        axis2_om_text_t *text1 = NULL;
+        
+        param1 = strtol(param1_str, NULL, 10);
+        param2 = strtol(param2_str, NULL, 10);
+        if (param2 == 0)
+            return NULL;
+        result = param1 / param2;
+        sprintf(result_str, "%ld", result);
+
+        
+
+        ns1 = axis2_om_namespace_create (env,
+                                   "http://axis2/test/namespace1",
+                                   "ns1");
+        ele1 = axis2_om_element_create (env, NULL, "result", ns1, &node1);
+        text1 = axis2_om_text_create (env, node1, result_str, &node2);
+
+        return node1;
+    }
+    
+    AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST, AXIS2_FAILURE);
+    printf("Math service ERROR: invalid parameters\n");
+    return NULL;
+}

Added: webservices/axis2/trunk/c/samples/server/sg_math/div.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/div.h?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/div.h (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/div.h Thu Apr  6 23:24:10 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#ifndef DIV_H
+#define DIV_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axis2_om_text.h>
+#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+
+axis2_om_node_t *axis2_div_div(axis2_env_t **env, axis2_om_node_t *node);
+
+#endif /* DIV_H*/

Added: webservices/axis2/trunk/c/samples/server/sg_math/div_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/div_skeleton.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/div_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/div_skeleton.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "axis2_svc_skeleton.h"
+#include "div.h"
+#include <axis2_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+div_free(axis2_svc_skeleton_t *svc_skeleton,
+          axis2_env_t **env);
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL 
+div_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node);
+
+int AXIS2_CALL div_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env);
+
+
+AXIS2_DECLARE(axis2_svc_skeleton_t *)
+axis2_div_create(axis2_env_t **env)
+{
+    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));
+
+    svc_skeleton->func_array = NULL;
+
+    svc_skeleton->ops->free = div_free;
+    svc_skeleton->ops->init = div_init;
+    svc_skeleton->ops->invoke = div_invoke;
+    /*svc_skeleton->ops->on_fault = div_on_fault;*/
+
+    return svc_skeleton;
+}
+
+int AXIS2_CALL
+div_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "div");
+
+    /* Any initialization stuff of div goes here */
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+div_free(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env)
+{
+    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; 
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL
+div_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node)
+{
+    /* Depending on the function name invoke the
+     *  corresponding div method
+     */
+    if (node)
+    {
+        if (AXIS2_OM_NODE_GET_NODE_TYPE(node, env) == AXIS2_OM_ELEMENT)
+        {
+            axis2_om_element_t *element = NULL;
+            element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+            if (element)
+            {
+                axis2_char_t *op_name = AXIS2_OM_ELEMENT_GET_LOCALNAME(element, env);
+                if (op_name)
+                {
+                    if ( AXIS2_STRCMP(op_name, "div") == 0 )
+                        return axis2_div_div(env, node);
+                }
+            }
+        }
+    }
+    
+    printf("Math service ERROR: invalid OM parameters in request\n");
+    
+    /** TODO: return a SOAP fault here */
+    return node;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int axis2_get_instance(struct axis2_svc_skeleton **inst,
+                        axis2_env_t **env)
+{
+	*inst = axis2_div_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;
+}
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/mul.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/mul.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/mul.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/mul.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "mul.h"
+#include <stdio.h>
+
+axis2_om_node_t *
+axis2_mul_mul (axis2_env_t **env, axis2_om_node_t *node)
+{
+    axis2_om_node_t *param1_node = NULL;
+    axis2_om_node_t *param1_text_node = NULL;
+    axis2_char_t *param1_str = NULL;
+    long int param1 = 0;
+    axis2_om_node_t *param2_node = NULL;
+    axis2_om_node_t *param2_text_node = NULL;
+    axis2_char_t *param2_str = NULL;
+    long int param2 = 0;
+
+    if (!node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("Math client request ERROR: input parameter NULL\n");
+        return NULL;
+    }
+
+    param1_node = AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
+    if (!param1_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param1_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param1_node, env);
+    if (!param1_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param1_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param1_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param1_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    param2_node = AXIS2_OM_NODE_GET_NEXT_SIBLING(param1_node, env);
+    if (!param2_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param2_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param2_node, env);
+    if (!param2_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param2_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param2_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param2_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    if (param1_str && param2_str)
+    {
+        long int result = 0;
+        axis2_char_t result_str[255];
+
+        axis2_om_element_t *ele1 = NULL;
+        axis2_om_node_t *node1 = NULL, *node2 = NULL;
+        axis2_om_namespace_t *ns1 = NULL;
+        axis2_om_text_t *text1 = NULL;
+        
+        param1 = strtol(param1_str, NULL, 10);
+        param2 = strtol(param2_str, NULL, 10);
+        result = param1 * param2;
+        sprintf(result_str, "%ld", result);
+
+        
+
+        ns1 = axis2_om_namespace_create (env,
+                                   "http://axis2/test/namespace1",
+                                   "ns1");
+        ele1 = axis2_om_element_create (env, NULL, "result", ns1, &node1);
+        text1 = axis2_om_text_create (env, node1, result_str, &node2);
+
+        return node1;
+    }
+    
+    AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST, AXIS2_FAILURE);
+    printf("Math service ERROR: invalid parameters\n");
+    return NULL;
+}
+
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/mul.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/mul.h?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/mul.h (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/mul.h Thu Apr  6 23:24:10 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#ifndef MUL_H
+#define MUL_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axis2_om_text.h>
+#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+
+axis2_om_node_t *axis2_mul_mul(axis2_env_t **env, axis2_om_node_t *node);
+
+#endif /* MUL_H*/

Added: webservices/axis2/trunk/c/samples/server/sg_math/mul_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/mul_skeleton.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/mul_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/mul_skeleton.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "axis2_svc_skeleton.h"
+#include "mul.h"
+#include <axis2_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+mul_free(axis2_svc_skeleton_t *svc_skeleton,
+          axis2_env_t **env);
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL 
+mul_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node);
+
+int AXIS2_CALL mul_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env);
+
+
+AXIS2_DECLARE(axis2_svc_skeleton_t *)
+axis2_mul_create(axis2_env_t **env)
+{
+    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));
+
+    svc_skeleton->func_array = NULL;
+
+    svc_skeleton->ops->free = mul_free;
+    svc_skeleton->ops->init = mul_init;
+    svc_skeleton->ops->invoke = mul_invoke;
+    /*svc_skeleton->ops->on_fault = mul_on_fault;*/
+
+    return svc_skeleton;
+}
+
+int AXIS2_CALL
+mul_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "mul");
+
+    /* Any initialization stuff of mul goes here */
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+mul_free(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env)
+{
+    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; 
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL
+mul_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node)
+{
+    /* Depending on the function name invoke the
+     *  corresponding mul method
+     */
+    if (node)
+    {
+        if (AXIS2_OM_NODE_GET_NODE_TYPE(node, env) == AXIS2_OM_ELEMENT)
+        {
+            axis2_om_element_t *element = NULL;
+            element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+            if (element)
+            {
+                axis2_char_t *op_name = AXIS2_OM_ELEMENT_GET_LOCALNAME(element, env);
+                if (op_name)
+                {
+                    if ( AXIS2_STRCMP(op_name, "mul") == 0 )
+                        return axis2_mul_mul(env, node);
+                }
+            }
+        }
+    }
+    
+    printf("Math service ERROR: invalid OM parameters in request\n");
+    
+    /** TODO: return a SOAP fault here */
+    return node;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int axis2_get_instance(struct axis2_svc_skeleton **inst,
+                        axis2_env_t **env)
+{
+	*inst = axis2_mul_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;
+}
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/services.xml?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/services.xml (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/services.xml Thu Apr  6 23:24:10 2006
@@ -0,0 +1,30 @@
+<serviceGroup name="sg_math">
+    <service name="add">
+        <parameter name="ServiceClass" locked="xsd:false">add</parameter>
+        <description>
+            This is add service, that belongs to the math service group.
+        </description>
+        <operation name="add"/>
+    </service>
+    <service name="sub">
+        <parameter name="ServiceClass" locked="xsd:false">sub</parameter>
+        <description>
+            This is sub service, that belongs to the math service group.
+        </description>
+        <operation name="sub"/>
+    </service>
+    <service name="mul">
+        <parameter name="ServiceClass" locked="xsd:false">mul</parameter>
+        <description>
+            This is mul service, that belongs to the math service group.
+        </description>
+       <operation name="mul"/>
+    </service>
+     <service name="div">
+        <parameter name="ServiceClass" locked="xsd:false">div</parameter>
+        <description>
+            This is div service, that belongs to the math service group.
+        </description>
+       <operation name="div"/>
+    </service>
+</serviceGroup>

Added: webservices/axis2/trunk/c/samples/server/sg_math/sub.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/sub.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/sub.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/sub.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "sub.h"
+#include <stdio.h>
+
+axis2_om_node_t *
+axis2_sub_sub (axis2_env_t **env, axis2_om_node_t *node)
+{
+    axis2_om_node_t *param1_node = NULL;
+    axis2_om_node_t *param1_text_node = NULL;
+    axis2_char_t *param1_str = NULL;
+    long int param1 = 0;
+    axis2_om_node_t *param2_node = NULL;
+    axis2_om_node_t *param2_text_node = NULL;
+    axis2_char_t *param2_str = NULL;
+    long int param2 = 0;
+
+    if (!node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("Math client request ERROR: input parameter NULL\n");
+        return NULL;
+    }
+
+    param1_node = AXIS2_OM_NODE_GET_FIRST_CHILD(node, env);
+    if (!param1_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param1_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param1_node, env);
+    if (!param1_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param1_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param1_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param1_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    param2_node = AXIS2_OM_NODE_GET_NEXT_SIBLING(param1_node, env);
+    if (!param2_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service  ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    param2_text_node = AXIS2_OM_NODE_GET_FIRST_CHILD(param2_node, env);
+    if (!param2_text_node)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+    
+    if (AXIS2_OM_NODE_GET_NODE_TYPE(param2_text_node, env) == AXIS2_OM_TEXT)
+    {
+        axis2_om_text_t *text = (axis2_om_text_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(param2_text_node, env);
+        if( text && AXIS2_OM_TEXT_GET_VALUE(text ,env))
+        {
+            param2_str = AXIS2_OM_TEXT_GET_VALUE(text,env);
+        }
+    }
+    else
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+        printf("Math service ERROR: invalid XML in request\n");
+        return NULL;
+    }
+	
+    if (param1_str && param2_str)
+    {
+        long int result = 0;
+        axis2_char_t result_str[255];
+
+        axis2_om_element_t *ele1 = NULL;
+        axis2_om_node_t *node1 = NULL, *node2 = NULL;
+        axis2_om_namespace_t *ns1 = NULL;
+        axis2_om_text_t *text1 = NULL;
+        
+        param1 = strtol(param1_str, NULL, 10);
+        param2 = strtol(param2_str, NULL, 10);
+        result = param1 - param2;
+        sprintf(result_str, "%ld", result);
+
+        
+
+        ns1 = axis2_om_namespace_create (env,
+                                   "http://axis2/test/namespace1",
+                                   "ns1");
+        ele1 = axis2_om_element_create (env, NULL, "result", ns1, &node1);
+        text1 = axis2_om_text_create (env, node1, result_str, &node2);
+
+        return node1;
+    }
+    
+    AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST, AXIS2_FAILURE);
+    printf("Math service ERROR: invalid parameters\n");
+    return NULL;
+}
+
+

Added: webservices/axis2/trunk/c/samples/server/sg_math/sub.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/sub.h?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/sub.h (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/sub.h Thu Apr  6 23:24:10 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#ifndef SUB_H
+#define SUB_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axis2_om_text.h>
+#include <axis2_om_node.h>
+#include <axis2_om_element.h>
+
+axis2_om_node_t *axis2_sub_sub(axis2_env_t **env, axis2_om_node_t *node);
+
+#endif /* SUB_H*/

Added: webservices/axis2/trunk/c/samples/server/sg_math/sub_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/sg_math/sub_skeleton.c?rev=392198&view=auto
==============================================================================
--- webservices/axis2/trunk/c/samples/server/sg_math/sub_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/sg_math/sub_skeleton.c Thu Apr  6 23:24:10 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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 "AS IS" 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.
+ */
+#include "axis2_svc_skeleton.h"
+#include "sub.h"
+#include <axis2_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL
+sub_free(axis2_svc_skeleton_t *svc_skeleton,
+          axis2_env_t **env);
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL 
+sub_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node);
+
+int AXIS2_CALL sub_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env);
+
+
+AXIS2_DECLARE(axis2_svc_skeleton_t *)
+axis2_sub_create(axis2_env_t **env)
+{
+    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));
+
+    svc_skeleton->func_array = NULL;
+
+    svc_skeleton->ops->free = sub_free;
+    svc_skeleton->ops->init = sub_init;
+    svc_skeleton->ops->invoke = sub_invoke;
+    /*svc_skeleton->ops->on_fault = sub_on_fault;*/
+
+    return svc_skeleton;
+}
+
+int AXIS2_CALL
+sub_init(axis2_svc_skeleton_t *svc_skeleton,
+                        axis2_env_t **env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "sub");
+
+    /* Any initialization stuff of sub goes here */
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+sub_free(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env)
+{
+    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; 
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axis2_om_node_t* AXIS2_CALL
+sub_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            axis2_env_t **env,
+            axis2_om_node_t *node)
+{
+    /* Depending on the function name invoke the
+     *  corresponding sub method
+     */
+    if (node)
+    {
+        if (AXIS2_OM_NODE_GET_NODE_TYPE(node, env) == AXIS2_OM_ELEMENT)
+        {
+            axis2_om_element_t *element = NULL;
+            element = (axis2_om_element_t *)AXIS2_OM_NODE_GET_DATA_ELEMENT(node, env);
+            if (element)
+            {
+                axis2_char_t *op_name = AXIS2_OM_ELEMENT_GET_LOCALNAME(element, env);
+                if (op_name)
+                {
+                    if ( AXIS2_STRCMP(op_name, "sub") == 0 )
+                        return axis2_sub_sub(env, node);
+                }
+            }
+        }
+    }
+    
+    printf("Math service ERROR: invalid OM parameters in request\n");
+    
+    /** TODO: return a SOAP fault here */
+    return node;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+
+AXIS2_EXPORT int axis2_get_instance(struct axis2_svc_skeleton **inst,
+                        axis2_env_t **env)
+{
+	*inst = axis2_sub_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;
+}
+



Mime
View raw message