From 0425aadc78680e53000fd0108b540d6eca048516 Mon Sep 17 00:00:00 2001 From: gmcdonald Date: Sat, 13 Feb 2010 01:32:03 +0000 Subject: Moving axis svn, part of TLP move INFRA-2441 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@909681 13f79535-47bb-0310-9956-ffa450edef68 --- samples/server/math/Makefile.am | 9 + samples/server/math/math.c | 537 ++++++++++++++++++++++++++++++++++++ samples/server/math/math.h | 41 +++ samples/server/math/math.mk | 7 + samples/server/math/math_skeleton.c | 157 +++++++++++ samples/server/math/services.xml | 18 ++ 6 files changed, 769 insertions(+) create mode 100644 samples/server/math/Makefile.am create mode 100644 samples/server/math/math.c create mode 100644 samples/server/math/math.h create mode 100644 samples/server/math/math.mk create mode 100644 samples/server/math/math_skeleton.c create mode 100644 samples/server/math/services.xml (limited to 'samples/server/math') diff --git a/samples/server/math/Makefile.am b/samples/server/math/Makefile.am new file mode 100644 index 0000000..d8e6f82 --- /dev/null +++ b/samples/server/math/Makefile.am @@ -0,0 +1,9 @@ +prglibdir=$(prefix)/services/math +prglib_LTLIBRARIES = libmath.la +prglib_DATA=services.xml +EXTRA_DIST = services.xml math.mk math.h +noinst_HEADERS = math.h +SUBDIRS = +libmath_la_SOURCES = math.c math_skeleton.c +libmath_la_LIBADD = +INCLUDES = @AXIS2INC@ diff --git a/samples/server/math/math.c b/samples/server/math/math.c new file mode 100644 index 0000000..c3236a2 --- /dev/null +++ b/samples/server/math/math.c @@ -0,0 +1,537 @@ + +/* + * 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 "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 "math.h" +#include + +axiom_node_t * +axis2_math_add( + const axutil_env_t * env, + axiom_node_t * node) +{ + axiom_node_t *param1_node = NULL; + axiom_node_t *param1_text_node = NULL; + axis2_char_t *param1_str = NULL; + long int param1 = 0; + axiom_node_t *param2_node = NULL; + axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param1_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param1_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param1_str = (axis2_char_t *) axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param2_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param2_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param2_str = (axis2_char_t *) axiom_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]; + + axiom_element_t *ele1 = NULL; + axiom_node_t *node1 = NULL, + *node2 = NULL; + axiom_namespace_t *ns1 = NULL; + axiom_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 = axiom_namespace_create(env, + "http://axis2/test/namespace1", "ns1"); + ele1 = axiom_element_create(env, NULL, "result", ns1, &node1); + text1 = axiom_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; +} + +axiom_node_t * +axis2_math_sub( + const axutil_env_t * env, + axiom_node_t * node) +{ + axiom_node_t *param1_node = NULL; + axiom_node_t *param1_text_node = NULL; + axis2_char_t *param1_str = NULL; + long int param1 = 0; + axiom_node_t *param2_node = NULL; + axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param1_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param1_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param1_str = (axis2_char_t *) axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param2_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param2_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param2_str = (axis2_char_t *) axiom_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]; + + axiom_element_t *ele1 = NULL; + axiom_node_t *node1 = NULL, + *node2 = NULL; + axiom_namespace_t *ns1 = NULL; + axiom_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 = axiom_namespace_create(env, + "http://axis2/test/namespace1", "ns1"); + ele1 = axiom_element_create(env, NULL, "result", ns1, &node1); + text1 = axiom_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; +} + +axiom_node_t * +axis2_math_mul( + const axutil_env_t * env, + axiom_node_t * node) +{ + axiom_node_t *param1_node = NULL; + axiom_node_t *param1_text_node = NULL; + axis2_char_t *param1_str = NULL; + long int param1 = 0; + axiom_node_t *param2_node = NULL; + axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param1_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param1_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param1_str = (axis2_char_t *) axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param2_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param2_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param2_str = (axis2_char_t *) axiom_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]; + + axiom_element_t *ele1 = NULL; + axiom_node_t *node1 = NULL, + *node2 = NULL; + axiom_namespace_t *ns1 = NULL; + axiom_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 = axiom_namespace_create(env, + "http://axis2/test/namespace1", "ns1"); + ele1 = axiom_element_create(env, NULL, "result", ns1, &node1); + text1 = axiom_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; +} + +axiom_node_t * +axis2_math_div( + const axutil_env_t * env, + axiom_node_t * node) +{ + axiom_node_t *param1_node = NULL; + axiom_node_t *param1_text_node = NULL; + axis2_char_t *param1_str = NULL; + long int param1 = 0; + axiom_node_t *param2_node = NULL; + axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param1_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param1_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param1_str = (axis2_char_t *) axiom_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 = axiom_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 = axiom_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 (axiom_node_get_node_type(param2_text_node, env) == AXIOM_TEXT) + { + axiom_text_t *text = + (axiom_text_t *) axiom_node_get_data_element(param2_text_node, env); + if (text && axiom_text_get_value(text, env)) + { + param2_str = (axis2_char_t *) axiom_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]; + + axiom_element_t *ele1 = NULL; + axiom_node_t *node1 = NULL, + *node2 = NULL; + axiom_namespace_t *ns1 = NULL; + axiom_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 = axiom_namespace_create(env, + "http://axis2/test/namespace1", "ns1"); + ele1 = axiom_element_create(env, NULL, "result", ns1, &node1); + text1 = axiom_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; +} diff --git a/samples/server/math/math.h b/samples/server/math/math.h new file mode 100644 index 0000000..58abfc5 --- /dev/null +++ b/samples/server/math/math.h @@ -0,0 +1,41 @@ + +/* + * 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 "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 MATH_H +#define MATH_H + +#include +#include +#include +#include +#include +#include + +axiom_node_t *axis2_math_add( + const axutil_env_t * env, + axiom_node_t * node); +axiom_node_t *axis2_math_sub( + const axutil_env_t * env, + axiom_node_t * node); +axiom_node_t *axis2_math_mul( + const axutil_env_t * env, + axiom_node_t * node); +axiom_node_t *axis2_math_div( + const axutil_env_t * env, + axiom_node_t * node); + +#endif /* MATH_H */ diff --git a/samples/server/math/math.mk b/samples/server/math/math.mk new file mode 100644 index 0000000..dee9b6d --- /dev/null +++ b/samples/server/math/math.mk @@ -0,0 +1,7 @@ +echo: + @cl.exe /nologo /D "WIN32" /D "AXIS2_DECLARE_EXPORT" /D "_WINDOWS" /D "_MBCS" *.C /I.\..\..\..\include /c + @link.exe /nologo *.obj /LIBPATH:.\..\..\..\lib axiom.lib axutil.lib axis2_engine.lib axis2_parser.lib /DLL /OUT:math.dll + + + + diff --git a/samples/server/math/math_skeleton.c b/samples/server/math/math_skeleton.c new file mode 100644 index 0000000..4aabce8 --- /dev/null +++ b/samples/server/math/math_skeleton.c @@ -0,0 +1,157 @@ + +/* + * 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 "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 "math.h" +#include +#include + +int AXIS2_CALL math_free( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env); + +/* + * This method invokes the right service method + */ +axiom_node_t *AXIS2_CALL math_invoke( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env, + axiom_node_t * node, + axis2_msg_ctx_t * msg_ctx); + +int AXIS2_CALL math_init( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env); + +static const axis2_svc_skeleton_ops_t math_svc_skeleton_ops_var = { + math_init, + math_invoke, + NULL, + math_free +}; + +AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL +math_create( + const axutil_env_t * env) +{ + axis2_svc_skeleton_t *svc_skeleton = NULL; + svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t)); + + svc_skeleton->ops = &math_svc_skeleton_ops_var; + + svc_skeleton->func_array = NULL; + + return svc_skeleton; +} + +int AXIS2_CALL +math_init( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env) +{ + /* Any initialization stuff of math goes here */ + return AXIS2_SUCCESS; +} + +int AXIS2_CALL +math_free( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env) +{ + if (svc_skeleton) + { + AXIS2_FREE(env->allocator, svc_skeleton); + svc_skeleton = NULL; + } + return AXIS2_SUCCESS; +} + +/* + * This method invokes the right service method + */ +axiom_node_t *AXIS2_CALL +math_invoke( + axis2_svc_skeleton_t * svc_skeleton, + const axutil_env_t * env, + axiom_node_t * node, + axis2_msg_ctx_t * msg_ctx) +{ + /* Depending on the function name invoke the + * corresponding math method + */ + if (node) + { + if (axiom_node_get_node_type(node, env) == AXIOM_ELEMENT) + { + axiom_element_t *element = NULL; + element = + (axiom_element_t *) axiom_node_get_data_element(node, env); + if (element) + { + axis2_char_t *op_name = + axiom_element_get_localname(element, env); + if (op_name) + { + if (axutil_strcmp(op_name, "add") == 0) + return axis2_math_add(env, node); + if (axutil_strcmp(op_name, "sub") == 0) + return axis2_math_sub(env, node); + if (axutil_strcmp(op_name, "mul") == 0) + return axis2_math_mul(env, node); + if (axutil_strcmp(op_name, "div") == 0) + return axis2_math_div(env, node); + } + } + } + } + + printf("Math service ERROR: invalid OM parameters in request\n"); + + /** Note: 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, + const axutil_env_t * env) +{ + *inst = math_create(env); + if (!(*inst)) + { + return AXIS2_FAILURE; + } + + return AXIS2_SUCCESS; +} + +AXIS2_EXPORT int +axis2_remove_instance( + axis2_svc_skeleton_t * inst, + const axutil_env_t * env) +{ + axis2_status_t status = AXIS2_FAILURE; + if (inst) + { + status = AXIS2_SVC_SKELETON_FREE(inst, env); + } + return status; +} diff --git a/samples/server/math/services.xml b/samples/server/math/services.xml new file mode 100644 index 0000000..70ff77b --- /dev/null +++ b/samples/server/math/services.xml @@ -0,0 +1,18 @@ + + math + + This is a testing service, named 'math' to test multiple operations in the same service + + + + + + + + + + + + + + -- cgit v1.1-32-gdbae