summaryrefslogtreecommitdiffstats
path: root/samples/server
diff options
context:
space:
mode:
authorGravatar gmcdonald2010-02-13 01:32:03 +0000
committerGravatar gmcdonald2010-02-13 01:32:03 +0000
commit0425aadc78680e53000fd0108b540d6eca048516 (patch)
tree8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /samples/server
downloadaxis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.gz
axis2c-0425aadc78680e53000fd0108b540d6eca048516.tar.bz2
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
Diffstat (limited to 'samples/server')
-rw-r--r--samples/server/Calculator/Calculator.mk7
-rw-r--r--samples/server/Calculator/Calculator.wsdl183
-rw-r--r--samples/server/Calculator/Makefile.am9
-rw-r--r--samples/server/Calculator/calc.c553
-rw-r--r--samples/server/Calculator/calc.h41
-rw-r--r--samples/server/Calculator/calc_skeleton.c157
-rw-r--r--samples/server/Calculator/services.xml28
-rw-r--r--samples/server/Makefile.am2
-rw-r--r--samples/server/axis2.log1
-rw-r--r--samples/server/axis2.xml129
-rw-r--r--samples/server/echo/Makefile.am9
-rw-r--r--samples/server/echo/echo.c116
-rw-r--r--samples/server/echo/echo.h32
-rw-r--r--samples/server/echo/echo.mk8
-rw-r--r--samples/server/echo/echo_skeleton.c182
-rw-r--r--samples/server/echo/services.xml34
-rw-r--r--samples/server/math/Makefile.am9
-rw-r--r--samples/server/math/math.c537
-rw-r--r--samples/server/math/math.h41
-rw-r--r--samples/server/math/math.mk7
-rw-r--r--samples/server/math/math_skeleton.c157
-rw-r--r--samples/server/math/services.xml18
-rw-r--r--samples/server/mtom/Makefile.am9
-rw-r--r--samples/server/mtom/mtom.c261
-rw-r--r--samples/server/mtom/mtom.h33
-rw-r--r--samples/server/mtom/mtom.mk8
-rw-r--r--samples/server/mtom/mtom_skeleton.c166
-rw-r--r--samples/server/mtom/services.xml12
-rw-r--r--samples/server/mtom_callback/Makefile.am9
-rw-r--r--samples/server/mtom_callback/mtom_callback.c261
-rw-r--r--samples/server/mtom_callback/mtom_callback.h33
-rw-r--r--samples/server/mtom_callback/mtom_callback.mk8
-rw-r--r--samples/server/mtom_callback/mtom_skeleton.c166
-rw-r--r--samples/server/mtom_callback/services.xml16
-rw-r--r--samples/server/notify/Makefile.am9
-rw-r--r--samples/server/notify/notify.c77
-rw-r--r--samples/server/notify/notify.h32
-rw-r--r--samples/server/notify/notify.mk8
-rw-r--r--samples/server/notify/notify_skeleton.c167
-rw-r--r--samples/server/notify/services.xml13
-rw-r--r--samples/server/sg_math/Makefile.am11
-rw-r--r--samples/server/sg_math/add.c180
-rw-r--r--samples/server/sg_math/add.h33
-rw-r--r--samples/server/sg_math/add_skeleton.c151
-rw-r--r--samples/server/sg_math/div.c150
-rw-r--r--samples/server/sg_math/div.h32
-rw-r--r--samples/server/sg_math/div_skeleton.c151
-rw-r--r--samples/server/sg_math/mul.c148
-rw-r--r--samples/server/sg_math/mul.h32
-rw-r--r--samples/server/sg_math/mul_skeleton.c151
-rw-r--r--samples/server/sg_math/services.xml30
-rw-r--r--samples/server/sg_math/sg_math.mk15
-rw-r--r--samples/server/sg_math/sub.c148
-rw-r--r--samples/server/sg_math/sub.h32
-rw-r--r--samples/server/sg_math/sub_skeleton.c151
-rw-r--r--samples/server/version/Makefile.am10
-rw-r--r--samples/server/version/services.xml9
-rw-r--r--samples/server/version/version.c59
-rw-r--r--samples/server/version/version.h32
-rw-r--r--samples/server/version/version_skel.c151
60 files changed, 5224 insertions, 0 deletions
diff --git a/samples/server/Calculator/Calculator.mk b/samples/server/Calculator/Calculator.mk
new file mode 100644
index 0000000..8b4c683
--- /dev/null
+++ b/samples/server/Calculator/Calculator.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:Calculator.dll
+
+
+
+
diff --git a/samples/server/Calculator/Calculator.wsdl b/samples/server/Calculator/Calculator.wsdl
new file mode 100644
index 0000000..a37e390
--- /dev/null
+++ b/samples/server/Calculator/Calculator.wsdl
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- -->
+<!-- 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. -->
+<!-- -->
+<wsdl:definitions
+ targetNamespace="http://ws.apache.org/axis2/services/Calculator"
+ xmlns:impl="http://ws.apache.org/axis2/services/Calculator"
+ xmlns:type="http://ws.apache.org/axis2/services/Calculator/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema
+ targetNamespace="http://ws.apache.org/axis2/services/Calculator/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:impl="http://ws.apache.org/axis2/services/Calculator"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <element name="add">
+ <complexType>
+ <sequence>
+ <element name="param_1" type="xsd:int"/>
+ <element name="param_2" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="addResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="sub">
+ <complexType>
+ <sequence>
+ <element name="param_1" type="xsd:int"/>
+ <element name="param_2" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="subResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="mul">
+ <complexType>
+ <sequence>
+ <element name="param_1" type="xsd:int"/>
+ <element name="param_2" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="mulResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="div">
+ <complexType>
+ <sequence>
+ <element name="param_1" type="xsd:int"/>
+ <element name="param_2" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="divResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="addResponse">
+ <wsdl:part element="type:addResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="addRequest">
+ <wsdl:part element="type:add" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="subResponse">
+ <wsdl:part element="type:subResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="subRequest">
+ <wsdl:part element="type:sub" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="divResponse">
+ <wsdl:part element="type:divResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="divRequest">
+ <wsdl:part element="type:div" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="mulResponse">
+ <wsdl:part element="type:mulResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="mulRequest">
+ <wsdl:part element="type:mul" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="CalculatorPortType">
+ <wsdl:operation name="add">
+ <wsdl:input message="impl:addRequest" name="addRequest"/>
+ <wsdl:output message="impl:addResponse" name="addResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="sub">
+ <wsdl:input message="impl:subRequest" name="subRequest"/>
+ <wsdl:output message="impl:subResponse" name="subResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="mul">
+ <wsdl:input message="impl:mulRequest" name="mulRequest"/>
+ <wsdl:output message="impl:mulResponse" name="mulResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="div">
+ <wsdl:input message="impl:divRequest" name="divRequest"/>
+ <wsdl:output message="impl:divResponse" name="divResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="CalculatorSoapBinding" type="impl:CalculatorPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="add">
+ <soap:operation soapAction="Calculator#add"/>
+ <wsdl:input name="addRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="addResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="sub">
+ <soap:operation soapAction="Calculator#sub"/>
+ <wsdl:input name="subRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="subResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="mul">
+ <soap:operation soapAction="Calculator#mul"/>
+ <wsdl:input name="mulRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="mulResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="div">
+ <soap:operation soapAction="Calculator#div"/>
+ <wsdl:input name="divRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="divResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="Calculator">
+ <wsdl:port binding="impl:CalculatorSoapBinding" name="CalculatorSOAPport_http">
+ <soap:address location="http://localhost:9090/axis2/services/Calculator"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/samples/server/Calculator/Makefile.am b/samples/server/Calculator/Makefile.am
new file mode 100644
index 0000000..65f95ce
--- /dev/null
+++ b/samples/server/Calculator/Makefile.am
@@ -0,0 +1,9 @@
+prglibdir=$(prefix)/services/Calculator
+prglib_LTLIBRARIES = libCalculator.la
+prglib_DATA=services.xml Calculator.wsdl
+EXTRA_DIST = services.xml Calculator.wsdl Calculator.mk calc.h
+noinst_HEADERS = calc.h
+SUBDIRS =
+libCalculator_la_SOURCES = calc.c calc_skeleton.c
+libCalculator_la_LIBADD =
+INCLUDES = @AXIS2INC@
diff --git a/samples/server/Calculator/calc.c b/samples/server/Calculator/calc.c
new file mode 100644
index 0000000..3e5eeba
--- /dev/null
+++ b/samples/server/Calculator/calc.c
@@ -0,0 +1,553 @@
+
+/*
+ * 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 "calc.h"
+#include <stdio.h>
+
+axiom_node_t *
+axis2_calc_add(
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ axiom_node_t *complex_node = NULL;
+ axiom_node_t *seq_node = NULL;
+ 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("Calculator client request ERROR: input parameter NULL\n");
+ return NULL;
+ }
+ complex_node = axiom_node_get_first_child(node, env);
+ if (!complex_node)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
+ AXIS2_FAILURE);
+ printf("Calculator service ERROR: invalid XML in request\n");
+ return NULL;
+ }
+ seq_node = axiom_node_get_first_child(complex_node, env);
+ if (!seq_node)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
+ AXIS2_FAILURE);
+ printf("Calculator service ERROR: invalid XML in request\n");
+ return NULL;
+ }
+
+ param1_node = axiom_node_get_first_child(seq_node, env);
+ if (!param1_node)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
+ AXIS2_FAILURE);
+ printf("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator service ERROR: invalid parameters\n");
+ return NULL;
+}
+
+axiom_node_t *
+axis2_calc_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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator service ERROR: invalid parameters\n");
+ return NULL;
+}
+
+axiom_node_t *
+axis2_calc_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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator service ERROR: invalid parameters\n");
+ return NULL;
+}
+
+axiom_node_t *
+axis2_calc_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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator 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("Calculator service ERROR: invalid parameters\n");
+ return NULL;
+}
diff --git a/samples/server/Calculator/calc.h b/samples/server/Calculator/calc.h
new file mode 100644
index 0000000..58ffde8
--- /dev/null
+++ b/samples/server/Calculator/calc.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 CALC_H
+#define CALC_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_calc_add(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+axiom_node_t *axis2_calc_sub(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+axiom_node_t *axis2_calc_mul(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+axiom_node_t *axis2_calc_div(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* CALC_H */
diff --git a/samples/server/Calculator/calc_skeleton.c b/samples/server/Calculator/calc_skeleton.c
new file mode 100644
index 0000000..c153eee
--- /dev/null
+++ b/samples/server/Calculator/calc_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 "calc.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL calc_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL calc_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 calc_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t calc_svc_skeleton_ops_var = {
+ calc_init,
+ calc_invoke,
+ NULL,
+ calc_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_calc_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 = &calc_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+calc_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of calc goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+calc_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
+calc_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 calc 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_calc_add(env, node);
+ if (axutil_strcmp(op_name, "sub") == 0)
+ return axis2_calc_sub(env, node);
+ if (axutil_strcmp(op_name, "mul") == 0)
+ return axis2_calc_mul(env, node);
+ if (axutil_strcmp(op_name, "div") == 0)
+ return axis2_calc_div(env, node);
+ }
+ }
+ }
+ }
+
+ printf("Calculator 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 = axis2_calc_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/Calculator/services.xml b/samples/server/Calculator/services.xml
new file mode 100644
index 0000000..b449764
--- /dev/null
+++ b/samples/server/Calculator/services.xml
@@ -0,0 +1,28 @@
+<service name="Calculator">
+ <parameter name="ServiceClass" locked="xsd:false">Calculator</parameter>
+
+ <description>
+ This is a testing service, named 'Calculator' to test dynamic client
+ </description>
+
+ <operation name="add">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >Calculator#add</parameter>
+ </operation>
+
+ <operation name="sub">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >Calculator#sub</parameter>
+ </operation>
+
+ <operation name="mul">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >Calculator#mul</parameter>
+ </operation>
+
+ <operation name="div">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >Calculator#div</parameter>
+ </operation>
+
+</service>
diff --git a/samples/server/Makefile.am b/samples/server/Makefile.am
new file mode 100644
index 0000000..677aad9
--- /dev/null
+++ b/samples/server/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = echo math notify sg_math mtom Calculator version mtom_callback
+EXTRA_DIST = axis2.xml
diff --git a/samples/server/axis2.log b/samples/server/axis2.log
new file mode 100644
index 0000000..39cdd0d
--- /dev/null
+++ b/samples/server/axis2.log
@@ -0,0 +1 @@
+-
diff --git a/samples/server/axis2.xml b/samples/server/axis2.xml
new file mode 100644
index 0000000..0851e3b
--- /dev/null
+++ b/samples/server/axis2.xml
@@ -0,0 +1,129 @@
+<axisconfig name="Axis2/C">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <!-- Uncomment following to enable MTOM support globally -->
+ <!--parameter name="enableMTOM" locked="false">true</parameter-->
+
+ <!-- Set the suitable size for optimum memory usage when sending large attachments -->
+ <!--parameter name="MTOMBufferSize" locked="false">10</parameter-->
+ <!--parameter name="MTOMMaxBuffers" locked="false">1000</parameter-->
+ <!--parameter name="EnableMTOMServiceCallback" locked="false">true</parameter-->
+ <!--parameter name="attachmentDIR" locked="false">/path/to/the/attachment/caching/dir/</parameter-->
+ <!--parameter name="MTOMCachingCallback" locked="false">/path/to/the/caching_callback</parameter-->
+ <!--parameter name="MTOMSendingCallback" locked="false">/path/to/the/sending_callback</parameter-->
+
+ <!-- Enable REST -->
+ <parameter name="enableREST" locked="false">true</parameter>
+
+ <!-- Uncomment following to persist op_ctx, useful with RM -->
+ <!--parameter name="persistOperationContext" locked="false">true</parameter-->
+
+ <!--if you want to extract the service archive file and work with that please uncomment this-->
+ <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+ <!--exploded directory into /service directory-->
+ <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+ <!--messageReceiver mep="INOUT" class="axis2_receivers"/-->
+
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+
+ <transportReceiver name="http" class="axis2_http_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+ <parameter name="exposeHeaders" locked="true">false</parameter>
+ </transportReceiver>
+
+ <!--transportReceiver name="https" class="axis2_http_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+ <parameter name="exposeHeaders" locked="true">false</parameter>
+ </transportReceiver-->
+
+ <!--transportReceiver name="tcp" class="axis2_tcp_receiver">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver-->
+
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="http" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ <!--parameter name="Keep-Alive" locked="false">true</parameter-->
+ <!--parameter name="Transfer-Encoding">chunked</parameter-->
+ <!--parameter name="HTTP-Authentication" username="" password="" locked="true"/-->
+ <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" proxy_username="" proxy_password="" locked="true"/-->
+ </transportSender>
+
+ <!-- Uncomment the following with appropriate parameters to enable the SSL transport sender.
+ Also make sure that the appropriate transport receiver is enabled above.-->
+ <!--transportSender name="https" class="axis2_http_sender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ </transportSender>
+ <parameter name="SERVER_CERT">/path/to/ca/certificate</parameter>
+ <parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter>
+ <parameter name="SSL_PASSPHRASE">passphrase</parameter>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the TCP transport Sender-->
+ <!--transportSender name="tcp" class="axis2_tcp_sender">
+ <parameter name="PROTOCOL" locked="false">TCP</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ </transportSender-->
+
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <module ref="addressing"/>
+
+
+ <!--Configuring module , providing paramters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="Transport"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch"/>
+ <phase name="PostDispatch"/>
+ <!--phase name="Security"/-->
+ <!-- End system pre defined phases -->
+ <!-- After PostDispatch phase, module or service author can add any phase as required -->
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ <!--system predefined phase-->
+ <phase name="MessageOut"/>
+ <!--phase name="Security"/-->
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/samples/server/echo/Makefile.am b/samples/server/echo/Makefile.am
new file mode 100644
index 0000000..8413c5a
--- /dev/null
+++ b/samples/server/echo/Makefile.am
@@ -0,0 +1,9 @@
+prglibdir=$(prefix)/services/echo
+prglib_LTLIBRARIES = libecho.la
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml echo.mk echo.h
+noinst_HEADERS = echo.h
+SUBDIRS =
+libecho_la_SOURCES = echo.c echo_skeleton.c
+libecho_la_LIBADD =
+INCLUDES = @AXIS2INC@
diff --git a/samples/server/echo/echo.c b/samples/server/echo/echo.c
new file mode 100644
index 0000000..2ce6a08
--- /dev/null
+++ b/samples/server/echo/echo.c
@@ -0,0 +1,116 @@
+
+/*
+ * 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 "echo.h"
+#include <axiom_xml_writer.h>
+#include <stdio.h>
+
+axiom_node_t *build_om_programatically(
+ const axutil_env_t * env,
+ axis2_char_t * text);
+
+void set_custom_error(
+ const axutil_env_t * env,
+ axis2_char_t * error_message);
+
+axiom_node_t *
+axis2_echo_echo(
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ axiom_node_t *text_parent_node = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_node_t *ret_node = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ /* Expected request format is :-
+ * <ns1:echoString xmlns:ns1="http://ws.apache.org/axis2/c/samples">
+ * <text>echo5</text>
+ * </ns1:echoString>
+ */
+ if (!node) /* 'echoString' node */
+ {
+ set_custom_error(env, "Invalid payload; echoString node is NULL");
+ return NULL;
+ }
+
+ text_parent_node = axiom_node_get_first_element(node, env);
+ if (!text_parent_node)
+ {
+ set_custom_error(env, "Invalid payload; text node is NULL");
+ return NULL;
+ }
+
+ text_node = axiom_node_get_first_child(text_parent_node, env);
+ if (!text_node) /* actual text to echo */
+ {
+ set_custom_error(env, "Invalid payload; text to be echoed is NULL");
+ return NULL;
+ }
+
+ if (axiom_node_get_node_type(text_node, env) == AXIOM_TEXT)
+ {
+ axiom_text_t *text =
+ (axiom_text_t *) axiom_node_get_data_element(text_node, env);
+ if (text && axiom_text_get_value(text, env))
+ {
+ axis2_char_t *text_str =
+ (axis2_char_t *) axiom_text_get_value(text, env);
+ ret_node = build_om_programatically(env, text_str);
+ }
+ }
+ else
+ {
+ set_custom_error(env, "Invalid payload; invalid XML in request");
+ return NULL;
+ }
+
+ return ret_node;
+}
+
+/* Builds the response content */
+axiom_node_t *
+build_om_programatically(
+ const axutil_env_t * env,
+ axis2_char_t * text)
+{
+ axiom_node_t *echo_om_node = NULL;
+ axiom_element_t *echo_om_ele = NULL;
+ axiom_node_t *text_om_node = NULL;
+ axiom_element_t *text_om_ele = NULL;
+ axiom_namespace_t *ns1 = NULL;
+
+ ns1 =
+ axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples",
+ "ns1");
+ echo_om_ele =
+ axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node);
+ text_om_ele =
+ axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);
+ axiom_element_set_text(text_om_ele, env, text, text_om_node);
+ return echo_om_node;
+}
+
+void
+set_custom_error(
+ const axutil_env_t * env,
+ axis2_char_t * error_message)
+{
+ axutil_error_set_error_message(env->error, error_message);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_LAST + 1, AXIS2_FAILURE);
+}
diff --git a/samples/server/echo/echo.h b/samples/server/echo/echo.h
new file mode 100644
index 0000000..ecad867
--- /dev/null
+++ b/samples/server/echo/echo.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 CALC_H
+#define CALC_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_echo_echo(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* CALC_H */
diff --git a/samples/server/echo/echo.mk b/samples/server/echo/echo.mk
new file mode 100644
index 0000000..ae0f769
--- /dev/null
+++ b/samples/server/echo/echo.mk
@@ -0,0 +1,8 @@
+echo:
+ @cl.exe /nologo /D "WIN32" /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:echo.dll
+
+
+
+
+
diff --git a/samples/server/echo/echo_skeleton.c b/samples/server/echo/echo_skeleton.c
new file mode 100644
index 0000000..2f902ab
--- /dev/null
+++ b/samples/server/echo/echo_skeleton.c
@@ -0,0 +1,182 @@
+
+/*
+ * 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 "echo.h"
+#include <axutil_array_list.h>
+#include <axis2_msg_ctx.h>
+#include <stdio.h>
+
+int AXIS2_CALL echo_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL echo_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 echo_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+axiom_node_t *AXIS2_CALL echo_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+static const axis2_svc_skeleton_ops_t echo_svc_skeleton_ops_var = {
+ echo_init,
+ echo_invoke,
+ echo_on_fault,
+ echo_free
+};
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_echo_create(
+ const axutil_env_t * env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ /* Allocate memory for the structs */
+ svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t));
+
+ svc_skeleton->ops = &echo_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+echo_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of echo service should go here */
+ return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL
+echo_invoke(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx)
+{
+ /* Invoke the business logic.
+ * Depending on the function name invoke the correct impl method.
+ * We have only echo in this sample, hence invoke echo method.
+ * To see how to deal with multiple impl methods, have a look at the
+ * math sample.
+ */
+ axis2_endpoint_ref_t* to_epr = NULL;
+ to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
+
+ if (to_epr)
+ {
+ axis2_char_t* to_address = NULL;
+ to_address = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
+
+ if (to_address && strstr(to_address, AXIS2_ANON_SERVICE))
+ {
+ axis2_msg_ctx_set_wsa_action(msg_ctx, env, AXIS2_ANON_OUT_IN_OP);
+ }
+ }
+
+ return axis2_echo_echo(env, node);
+}
+
+/* On fault, handle the fault */
+axiom_node_t *AXIS2_CALL
+echo_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ /* Here we are just setting a simple error message inside an element
+ * called 'EchoServiceError'
+ */
+ axiom_node_t *error_node = NULL;
+ axiom_element_t *error_ele = NULL;
+
+ error_ele =
+ axiom_element_create(env, NULL, "EchoServiceError", NULL, &error_node);
+ axiom_element_set_text(error_ele, env, "Echo service failed ", error_node);
+ return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+echo_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Free the function array */
+ if (svc_skeleton->func_array)
+ {
+ axutil_array_list_free(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
+ }
+
+ /* Free the service skeleton */
+ if (svc_skeleton)
+ {
+ AXIS2_FREE(env->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(
+ axis2_svc_skeleton_t ** inst,
+ const axutil_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,
+ 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/echo/services.xml b/samples/server/echo/services.xml
new file mode 100644
index 0000000..ea75640
--- /dev/null
+++ b/samples/server/echo/services.xml
@@ -0,0 +1,34 @@
+<service name="echo">
+ <parameter name="ServiceClass" locked="xsd:false">echo</parameter>
+
+ <!--Uncomment to specify static WSDL path-->
+ <!--parameter name="wsdl_path">PATH</parameter-->
+
+ <!--Uncomment to include defaul method with REST as GET-->
+ <!--parameter name="defaultRESTMethod">GET</parameter-->
+
+ <description>
+ This is a testing service, to test whether the system is working or not
+ </description>
+
+ <operation name="echoString">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping">http://ws.apache.org/axis2/c/samples/echoString</parameter>
+ <!--Please note that you can only have one RESTMethod and one RESTLocation-->
+ <!--Uncomment for POST method with REST-->
+ <parameter name="RESTMethod">POST</parameter>
+ <parameter name="RESTLocation">echoString</parameter>
+ <!--Uncomment for GET method -->
+ <!--parameter name="RESTMethod">GET</parameter>
+ <parameter name="RESTLocation">get_echo/{param}</parameter-->
+ <!--Uncomment for PUT method -->
+ <!--parameter name="RESTMethod">PUT</parameter>
+ <parameter name="RESTLocation">put_echo/{param}</parameter-->
+ <!--Uncomment for DELETE method -->
+ <!--parameter name="RESTMethod">DELETE</parameter>
+ <parameter name="RESTLocation">delete_echo/{param}</parameter-->
+ <!--Uncomment for HEAD method -->
+ <!--parameter name="RESTMethod">HEAD</parameter>
+ <parameter name="RESTLocation">get_echo/{param}</parameter-->
+ </operation>
+</service>
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 <stdio.h>
+
+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 <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+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 <axutil_array_list.h>
+#include <stdio.h>
+
+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 @@
+<service name="math">
+ <parameter name="ServiceClass" locked="xsd:false">math</parameter>
+ <description>
+ This is a testing service, named 'math' to test multiple operations in the same service
+ </description>
+ <operation name="add">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+ <operation name="sub">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+ <operation name="mul">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+ <operation name="div">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+</service>
diff --git a/samples/server/mtom/Makefile.am b/samples/server/mtom/Makefile.am
new file mode 100644
index 0000000..198cad3
--- /dev/null
+++ b/samples/server/mtom/Makefile.am
@@ -0,0 +1,9 @@
+prglibdir=$(prefix)/services/mtom
+prglib_LTLIBRARIES = libmtom.la
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml mtom.mk mtom.h
+noinst_HEADERS = mtom.h
+SUBDIRS =
+libmtom_la_SOURCES = mtom.c mtom_skeleton.c
+libmtom_la_LIBADD =
+INCLUDES = @AXIS2INC@
diff --git a/samples/server/mtom/mtom.c b/samples/server/mtom/mtom.c
new file mode 100644
index 0000000..f00b68b
--- /dev/null
+++ b/samples/server/mtom/mtom.c
@@ -0,0 +1,261 @@
+/*
+ * 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 "mtom.h"
+#include <axiom.h>
+#include <stdio.h>
+
+axiom_node_t *build_response1(
+ const axutil_env_t * env,
+ axis2_char_t * text);
+
+axiom_node_t *build_response2(
+ const axutil_env_t *env,
+ axiom_data_handler_t *data_handler);
+
+axiom_node_t*
+axis2_mtom_mtom(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axiom_node_t *file_name_node = NULL;
+ axiom_node_t *file_text_node = NULL;
+ axiom_node_t *ret_node = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ /* Expected request format is :-
+ * <ns1:mtomSample xmlns:ns1="http://ws.apache.org/axis2/c/samples">
+ <ns1:fileName>test.jpg</ns1:fileName>
+ <ns1:image>
+ <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.dd5183d4-d58a-1da1-2578-001125b4c063@apache.org"></xop:Include>
+ </ns1:image>
+ </ns1:mtomSample>
+ */
+ if (!node) /* 'mtomSample' 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;
+ }
+
+ file_name_node = axiom_node_get_first_child(node, env);
+ if (!file_name_node) /* '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;
+ }
+
+ file_text_node = axiom_node_get_first_child(file_name_node, env);
+ if (!file_text_node) /* actual text to mtom */
+ {
+ 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 (axiom_node_get_node_type(file_text_node, env) == AXIOM_TEXT)
+ {
+ axiom_text_t *text =
+ (axiom_text_t *) axiom_node_get_data_element(file_text_node, env);
+ if (text && axiom_text_get_value(text, env))
+ {
+ axiom_node_t *image_node = NULL;
+ axis2_char_t *text_str =
+ (axis2_char_t *) axiom_text_get_value(text, env);
+ printf("File Name %s \n", text_str);
+
+ image_node = axiom_node_get_next_sibling(file_name_node, env);
+ if (image_node)
+ {
+ /* axiom_node_t *inc_node = NULL;
+ inc_node = axiom_node_get_first_child(image_node, env);
+ if (inc_node)
+ { */
+ axiom_node_t *binary_node = NULL;
+ binary_node = axiom_node_get_first_child(image_node, env);
+ if (binary_node)
+ {
+ axiom_data_handler_t *data_handler = NULL;
+ axiom_text_t *bin_text = (axiom_text_t *)
+ axiom_node_get_data_element(binary_node, env);
+ data_handler = axiom_text_get_data_handler(bin_text, env);
+ if (data_handler && !axiom_data_handler_get_cached(data_handler, env))
+ {
+ axiom_data_handler_t *data_handler_res = NULL;
+ axis2_byte_t *input_buff = NULL;
+ axis2_byte_t *buff = NULL;
+ size_t buff_len = 0;
+
+
+ axiom_data_handler_set_file_name(data_handler, env,
+ text_str);
+ axiom_data_handler_write_to(data_handler, env);
+
+ input_buff = axiom_data_handler_get_input_stream(data_handler, env);
+ buff_len = axiom_data_handler_get_input_stream_len(data_handler, env);
+
+ data_handler_res = axiom_data_handler_create(env, NULL, NULL);
+
+ buff = AXIS2_MALLOC(env->allocator, sizeof(axis2_byte_t)*buff_len);
+
+ if (!buff)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
+ "malloc failed, not enough memory");
+ return NULL;
+ }
+
+ memcpy(buff, input_buff, buff_len);
+
+ axiom_data_handler_set_binary_data(data_handler_res, env, buff, buff_len);
+
+ axis2_msg_ctx_set_doing_mtom (msg_ctx, env, AXIS2_TRUE);
+ ret_node = build_response2(env, data_handler_res);
+ }
+ else if(data_handler && axiom_data_handler_get_cached(data_handler, env))
+ {
+ axiom_data_handler_t *data_handler_res = NULL;
+ axis2_char_t *file_name = NULL;
+
+ file_name = axiom_data_handler_get_file_name(data_handler, env);
+ if(!file_name)
+ {
+ return NULL;
+ }
+
+ data_handler_res = axiom_data_handler_create(env, file_name, NULL);
+
+ axis2_msg_ctx_set_doing_mtom (msg_ctx, env, AXIS2_TRUE);
+ ret_node = build_response2(env, data_handler_res);
+ }
+
+ else if (axiom_node_get_node_type(binary_node, env) == AXIOM_TEXT) /* attachment has come by value, as non-optimized binary */
+ {
+ int plain_binary_len = 0;
+ int ret_len = 0;
+ axiom_text_t *bin_text = (axiom_text_t *)
+ axiom_node_get_data_element(binary_node, env);
+ axis2_byte_t *plain_binary = NULL;
+ axiom_data_handler_t *data_handler = NULL;
+
+ axis2_char_t *base64text =
+ (axis2_char_t *) axiom_text_get_value(bin_text,
+ env);
+ printf("base64text = %s\n", base64text);
+ plain_binary_len = axutil_base64_decode_len(base64text);
+ plain_binary = AXIS2_MALLOC(env->
+ allocator,
+ sizeof(unsigned char) *
+ plain_binary_len);
+ ret_len =
+ axutil_base64_decode_binary((unsigned char *)
+ plain_binary,
+ base64text);
+ data_handler =
+ axiom_data_handler_create(env, text_str, NULL);
+ axiom_data_handler_set_binary_data(data_handler, env,
+ plain_binary,
+ ret_len);
+ axiom_data_handler_write_to(data_handler, env);
+ ret_node = build_response1(env, base64text);
+ }
+ else /* nothing came */
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_ATTACHMENT_MISSING,
+ AXIS2_FAILURE);
+ printf("Echo client ERROR: attachment is missing.\n");
+ return NULL;
+ }
+ /* } */
+ }
+ }
+
+ }
+ }
+ 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;
+}
+
+/* Builds the response content */
+axiom_node_t *
+build_response1(
+ const axutil_env_t * env,
+ axis2_char_t * text)
+{
+ axiom_node_t *mtom_om_node = NULL;
+ axiom_element_t *mtom_om_ele = NULL;
+ axiom_node_t *om_node = NULL;
+ axiom_element_t *om_ele = NULL;
+
+
+ axiom_namespace_t *ns1 = NULL;
+
+ ns1 =
+ axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples",
+ "ns1");
+
+ mtom_om_ele =
+ axiom_element_create(env, NULL, "response", ns1, &mtom_om_node);
+
+ om_ele = axiom_element_create(env, mtom_om_node, "string", NULL, &om_node);
+
+ axiom_element_set_text(mtom_om_ele, env, text, om_node);
+
+
+ return mtom_om_node;
+}
+
+
+axiom_node_t *build_response2(
+ const axutil_env_t *env,
+ axiom_data_handler_t *data_handler)
+{
+ axiom_node_t *mtom_om_node = NULL;
+ axiom_element_t *mtom_om_ele = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_namespace_t *ns1 = NULL;
+
+ ns1 =
+ axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples",
+ "ns1");
+ mtom_om_ele =
+ axiom_element_create(env, NULL, "response", ns1, &mtom_om_node);
+
+ axiom_text_create_with_data_handler(env, mtom_om_node, data_handler,
+ &text_node);
+
+ return mtom_om_node;
+}
+
+
+
diff --git a/samples/server/mtom/mtom.h b/samples/server/mtom/mtom.h
new file mode 100644
index 0000000..8ee6a39
--- /dev/null
+++ b/samples/server/mtom/mtom.h
@@ -0,0 +1,33 @@
+
+/*
+ * 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 CALC_H
+#define CALC_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_mtom_mtom(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t *msg_ctx);
+
+#endif /* CALC_H */
diff --git a/samples/server/mtom/mtom.mk b/samples/server/mtom/mtom.mk
new file mode 100644
index 0000000..a2d9b9b
--- /dev/null
+++ b/samples/server/mtom/mtom.mk
@@ -0,0 +1,8 @@
+echo:
+ @cl.exe /nologo /D "WIN32" /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:mtom.dll
+
+
+
+
+
diff --git a/samples/server/mtom/mtom_skeleton.c b/samples/server/mtom/mtom_skeleton.c
new file mode 100644
index 0000000..3ef10b6
--- /dev/null
+++ b/samples/server/mtom/mtom_skeleton.c
@@ -0,0 +1,166 @@
+
+/*
+ * 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 "mtom.h"
+#include <axutil_array_list.h>
+
+int AXIS2_CALL mtom_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL mtom_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 mtom_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+axiom_node_t *AXIS2_CALL mtom_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+static const axis2_svc_skeleton_ops_t mtom_svc_skeleton_ops_var = {
+ mtom_init,
+ mtom_invoke,
+ mtom_on_fault,
+ mtom_free
+};
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_mtom_create(
+ const axutil_env_t * env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ /* Allocate memory for the structs */
+ svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t));
+
+ svc_skeleton->ops = &mtom_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+mtom_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of mtom service should go here */
+ return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL
+mtom_invoke(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx)
+{
+ /* Invoke the business logic.
+ * Depending on the function name invoke the correct impl method.
+ * We have only mtom in this sample, hence invoke mtom method.
+ * To see how to deal with multiple impl methods, have a look at the
+ * math sample.
+ */
+ return axis2_mtom_mtom(env, node, msg_ctx);
+}
+
+/* On fault, handle the fault */
+axiom_node_t *AXIS2_CALL
+mtom_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ /* Here we are just setting a simple error message inside an element
+ * called 'EchoServiceError'
+ */
+ axiom_node_t *error_node = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_element_t *error_ele = NULL;
+ error_ele = axiom_element_create(env, node, "EchoServiceError", NULL,
+ &error_node);
+ axiom_element_set_text(error_ele, env, "Echo service failed ", text_node);
+ return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+mtom_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Free the function array */
+ if (svc_skeleton->func_array)
+ {
+ axutil_array_list_free(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
+ }
+
+ /* Free the service skeleton */
+ if (svc_skeleton)
+ {
+ AXIS2_FREE(env->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(
+ axis2_svc_skeleton_t ** inst,
+ const axutil_env_t * env)
+{
+ *inst = axis2_mtom_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/mtom/services.xml b/samples/server/mtom/services.xml
new file mode 100644
index 0000000..1a1b1b2
--- /dev/null
+++ b/samples/server/mtom/services.xml
@@ -0,0 +1,12 @@
+<service name="mtom">
+ <parameter name="ServiceClass" locked="xsd:false">mtom</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+
+ <operation name="mtomSample">
+ <parameter name="wsamapping" >http://ws.apache.org/axis2/c/samples/mtom</parameter>
+ </operation>
+
+</service>
diff --git a/samples/server/mtom_callback/Makefile.am b/samples/server/mtom_callback/Makefile.am
new file mode 100644
index 0000000..11a107e
--- /dev/null
+++ b/samples/server/mtom_callback/Makefile.am
@@ -0,0 +1,9 @@
+prglibdir=$(prefix)/services/mtom_callback
+prglib_LTLIBRARIES = libmtom_callback.la
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml mtom_callback.mk mtom_callback.h
+noinst_HEADERS = mtom_callback.h
+SUBDIRS =
+libmtom_callback_la_SOURCES = mtom_callback.c mtom_skeleton.c
+libmtom_callback_la_LIBADD =
+INCLUDES = @AXIS2INC@
diff --git a/samples/server/mtom_callback/mtom_callback.c b/samples/server/mtom_callback/mtom_callback.c
new file mode 100644
index 0000000..7029124
--- /dev/null
+++ b/samples/server/mtom_callback/mtom_callback.c
@@ -0,0 +1,261 @@
+/*
+ * 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 "mtom_callback.h"
+#include <axiom.h>
+#include <stdio.h>
+#include <axis2_op_ctx.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_soap_body.h>
+#include <axis2_const.h>
+#include <axutil_param.h>
+
+axiom_node_t *build_response(
+ const axutil_env_t *env,
+ axiom_data_handler_t *data_handler);
+
+axis2_status_t process_attachments(
+ axis2_msg_ctx_t *msg_ctx,
+ const axutil_env_t * env,
+ void *user_param,
+ axis2_char_t *callback_name);
+
+axiom_node_t*
+axis2_mtom_callback_mtom(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ axiom_node_t *attachment_node = NULL;
+ axiom_node_t *binary_node = NULL;
+ axiom_node_t *ret_node = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ void *user_param = NULL;
+ axutil_param_t *callback_name_param = NULL;
+ axis2_char_t *callback_name = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ /* Expected request format is :-
+ * <ns1:mtomSample xmlns:ns1="http://ws.apache.org/axis2/c/samples">
+ <ns1:attachment>
+ <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.dd5183d4-d58a-1da1-2578-001125b4c063@apache.org"></xop:Include>
+ </ns1:attachment>
+ </ns1:mtomSample>
+ */
+ if (!node) /* 'mtomSample' 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;
+ }
+
+ attachment_node = axiom_node_get_first_child(node, env);
+ if (!attachment_node) /* '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;
+ }
+
+ /* This is the paramter specified in the services.xml
+ * or in axis2.xml
+ */
+
+ callback_name_param = axis2_msg_ctx_get_parameter (msg_ctx, env,
+ AXIS2_MTOM_CACHING_CALLBACK);
+
+ if(callback_name_param)
+ {
+ callback_name = (axis2_char_t *) axutil_param_get_value (callback_name_param, env);
+ }
+
+ /* This will process the attachment data in the stream */
+
+ status = process_attachments(msg_ctx, env, user_param, callback_name);
+ if(status == AXIS2_FAILURE)
+ {
+ return NULL;
+ }
+
+ binary_node = axiom_node_get_first_child(attachment_node, env);
+ if (binary_node)
+ {
+ axiom_data_handler_t *data_handler = NULL;
+ axiom_text_t *bin_text = NULL;
+ axis2_char_t *attachment_id = NULL;
+ axiom_data_handler_t *data_handler_res = NULL;
+ axis2_char_t *location = NULL;
+
+ bin_text = (axiom_text_t *)axiom_node_get_data_element(binary_node, env);
+ if(bin_text)
+ {
+ data_handler = axiom_text_get_data_handler(bin_text, env);
+ if(!data_handler)
+ {
+ return NULL;
+ }
+ }
+
+ attachment_id = axiom_data_handler_get_mime_id(data_handler, env);
+
+ if(!attachment_id)
+ {
+ return NULL;
+ }
+
+ /* This is the case where the attachment resides in memory */
+
+ if (!axiom_data_handler_get_cached(data_handler, env))
+ {
+ /* axis2_byte_t *input_buff = NULL;
+ axis2_byte_t *buff = NULL;
+ int buff_len = 0;*/
+
+ axiom_data_handler_set_file_name(data_handler, env, attachment_id);
+ axiom_data_handler_write_to(data_handler, env);
+ location = attachment_id;
+ }
+
+ else
+ {
+ axiom_data_handler_type_t data_handler_type;
+ data_handler_type = axiom_data_handler_get_data_handler_type(data_handler, env);
+
+ if(data_handler_type == AXIOM_DATA_HANDLER_TYPE_CALLBACK)
+ {
+ /* The service implementer should be aware of how to deal with the attachment
+ * Becasue it was stored using the callback he provided. */
+
+ /*axis2_char_t command[1000];
+
+ sprintf(command, "rm -f /opt/tmp/%s", attachment_id);
+ system(command);*/
+
+ /*location = attachment_id;*/
+ /*location = "/home/manjula/axis2/mtom/resources/song.MP3"; */
+
+ location = "/opt/manjula-mtom.MPG";
+ }
+ else if(data_handler_type == AXIOM_DATA_HANDLER_TYPE_FILE)
+ {
+ axis2_char_t *file_name = NULL;
+
+ file_name = axiom_data_handler_get_file_name(data_handler, env);
+ if(file_name)
+ {
+ location = axutil_strdup(env, file_name);
+ }
+ }
+ }
+
+ /* The samples sends back an attachment to the client. Hence we are creating the
+ * response data_handler as a type CALLBACK. So the sender callback should be
+ * specified either in the services.xml or in the axis2.xml.
+ */
+
+ data_handler_res = axiom_data_handler_create(env, NULL, NULL);
+ axiom_data_handler_set_data_handler_type(data_handler_res, env, AXIOM_DATA_HANDLER_TYPE_CALLBACK);
+ axiom_data_handler_set_user_param(data_handler_res, env, (void *)location);
+
+ axis2_msg_ctx_set_doing_mtom (msg_ctx, env, AXIS2_TRUE);
+ ret_node = build_response(env, data_handler_res);
+ }
+ 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;
+}
+
+/* Builds the response content */
+
+
+axiom_node_t *build_response(
+ const axutil_env_t *env,
+ axiom_data_handler_t *data_handler)
+{
+ axiom_node_t *mtom_om_node = NULL;
+ axiom_element_t *mtom_om_ele = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_namespace_t *ns1 = NULL;
+
+ ns1 =
+ axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples",
+ "ns1");
+ mtom_om_ele =
+ axiom_element_create(env, NULL, "response", ns1, &mtom_om_node);
+
+ axiom_text_create_with_data_handler(env, mtom_om_node, data_handler,
+ &text_node);
+
+ return mtom_om_node;
+}
+
+axis2_status_t process_attachments(
+ axis2_msg_ctx_t *msg_ctx,
+ const axutil_env_t * env,
+ void *user_param,
+ axis2_char_t *callback_name)
+{
+ axis2_op_ctx_t *op_ctx = NULL;
+ axis2_msg_ctx_t *in_msg_ctx = NULL;
+ axiom_soap_envelope_t *soap_envelope = NULL;
+ axiom_soap_body_t *soap_body = NULL;
+
+ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+ if(op_ctx)
+ {
+ in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
+ if(in_msg_ctx)
+ {
+ soap_envelope = axis2_msg_ctx_get_soap_envelope(in_msg_ctx, env);
+ if(soap_envelope)
+ {
+ soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+ if(soap_body)
+ {
+ return axiom_soap_body_process_attachments(soap_body, env, user_param, callback_name);
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+}
+
diff --git a/samples/server/mtom_callback/mtom_callback.h b/samples/server/mtom_callback/mtom_callback.h
new file mode 100644
index 0000000..b7c0057
--- /dev/null
+++ b/samples/server/mtom_callback/mtom_callback.h
@@ -0,0 +1,33 @@
+
+/*
+ * 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 MTOM_CALLBACK_H
+#define MTOM_CALLBACK_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_mtom_callback_mtom(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t *msg_ctx);
+
+#endif /* MTOM_CALLBACK_H */
diff --git a/samples/server/mtom_callback/mtom_callback.mk b/samples/server/mtom_callback/mtom_callback.mk
new file mode 100644
index 0000000..29cca6a
--- /dev/null
+++ b/samples/server/mtom_callback/mtom_callback.mk
@@ -0,0 +1,8 @@
+echo:
+ @cl.exe /nologo /D "WIN32" /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:mtom_callback.dll
+
+
+
+
+
diff --git a/samples/server/mtom_callback/mtom_skeleton.c b/samples/server/mtom_callback/mtom_skeleton.c
new file mode 100644
index 0000000..941521e
--- /dev/null
+++ b/samples/server/mtom_callback/mtom_skeleton.c
@@ -0,0 +1,166 @@
+
+/*
+ * 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 "mtom_callback.h"
+#include <axutil_array_list.h>
+
+int AXIS2_CALL mtom_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL mtom_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 mtom_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+axiom_node_t *AXIS2_CALL mtom_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+static const axis2_svc_skeleton_ops_t mtom_svc_skeleton_ops_var = {
+ mtom_init,
+ mtom_invoke,
+ mtom_on_fault,
+ mtom_free
+};
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_mtom_create(
+ const axutil_env_t * env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ /* Allocate memory for the structs */
+ svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t));
+
+ svc_skeleton->ops = &mtom_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+mtom_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of mtom service should go here */
+ return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL
+mtom_invoke(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx)
+{
+ /* Invoke the business logic.
+ * Depending on the function name invoke the correct impl method.
+ * We have only mtom in this sample, hence invoke mtom method.
+ * To see how to deal with multiple impl methods, have a look at the
+ * math sample.
+ */
+ return axis2_mtom_callback_mtom(env, node, msg_ctx);
+}
+
+/* On fault, handle the fault */
+axiom_node_t *AXIS2_CALL
+mtom_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ /* Here we are just setting a simple error message inside an element
+ * called 'EchoServiceError'
+ */
+ axiom_node_t *error_node = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_element_t *error_ele = NULL;
+ error_ele = axiom_element_create(env, node, "EchoServiceError", NULL,
+ &error_node);
+ axiom_element_set_text(error_ele, env, "Echo service failed ", text_node);
+ return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+mtom_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Free the function array */
+ if (svc_skeleton->func_array)
+ {
+ axutil_array_list_free(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
+ }
+
+ /* Free the service skeleton */
+ if (svc_skeleton)
+ {
+ AXIS2_FREE(env->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(
+ axis2_svc_skeleton_t ** inst,
+ const axutil_env_t * env)
+{
+ *inst = axis2_mtom_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/mtom_callback/services.xml b/samples/server/mtom_callback/services.xml
new file mode 100644
index 0000000..7219c8b
--- /dev/null
+++ b/samples/server/mtom_callback/services.xml
@@ -0,0 +1,16 @@
+<service name="mtom_callback">
+ <parameter name="ServiceClass" locked="xsd:false">mtom_callback</parameter>
+
+ <!--parameter name="MTOMCachingCallback" locked="false">/home/manjula/axis2/c/deploy/bin/mtom_caching_callback/libmtom_caching_callback.so</parameter-->
+
+ <!--parameter name="MTOMSendingCallback" locked="false">/home/manjula/axis2/c/deploy/bin/mtom_sending_callback/libmtom_sending_callback.so</parameter-->
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+
+ <operation name="mtomSample">
+ <parameter name="wsamapping" >http://ws.apache.org/axis2/c/samples/mtomCallbackSample</parameter>
+ </operation>
+
+</service>
diff --git a/samples/server/notify/Makefile.am b/samples/server/notify/Makefile.am
new file mode 100644
index 0000000..2e2bf2c
--- /dev/null
+++ b/samples/server/notify/Makefile.am
@@ -0,0 +1,9 @@
+prglibdir=$(prefix)/services/notify
+prglib_LTLIBRARIES = libnotify.la
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml notify.mk notify.h
+noinst_HEADERS = notify.h
+SUBDIRS =
+libnotify_la_SOURCES = notify.c notify_skeleton.c
+libnotify_la_LIBADD =
+INCLUDES = @AXIS2INC@
diff --git a/samples/server/notify/notify.c b/samples/server/notify/notify.c
new file mode 100644
index 0000000..80dc5bd
--- /dev/null
+++ b/samples/server/notify/notify.c
@@ -0,0 +1,77 @@
+
+/*
+ * 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 "notify.h"
+#include <stdio.h>
+
+void
+axis2_notify_notify(
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ axiom_node_t *text_node = NULL;
+
+ if (!env || !env)
+ {
+ return;
+ }
+
+ /* Expected request format is :-
+ <m:notify xmlns:m="http://example.org/notify">Message 3</m:notify>
+ */
+ if (!node) /* 'notify' node */
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Echo client ERROR: input parameter NULL");
+ return;
+ }
+
+ text_node = axiom_node_get_first_child(node, env);
+ if (!text_node) /* actual text to notify */
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Echo client ERROR: invalid XML in request");
+ return;
+ }
+
+ if (axiom_node_get_node_type(text_node, env) == AXIOM_TEXT)
+ {
+ axiom_text_t *text =
+ (axiom_text_t *) axiom_node_get_data_element(text_node, env);
+ if (text && axiom_text_get_value(text, env))
+ {
+ axis2_char_t *text_str =
+ (axis2_char_t *) axiom_text_get_value(text, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Notification received : %s", text_str);
+ }
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
+ AXIS2_FAILURE);
+ printf("\n");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Echo client ERROR: invalid XML in request");
+ return;
+ }
+
+ return;
+}
+
diff --git a/samples/server/notify/notify.h b/samples/server/notify/notify.h
new file mode 100644
index 0000000..5a175a0
--- /dev/null
+++ b/samples/server/notify/notify.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 CALC_H
+#define CALC_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+void axis2_notify_notify(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* CALC_H */
diff --git a/samples/server/notify/notify.mk b/samples/server/notify/notify.mk
new file mode 100644
index 0000000..9f3d533
--- /dev/null
+++ b/samples/server/notify/notify.mk
@@ -0,0 +1,8 @@
+echo:
+ @cl.exe /nologo /D "WIN32" /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:notify.dll
+
+
+
+
+
diff --git a/samples/server/notify/notify_skeleton.c b/samples/server/notify/notify_skeleton.c
new file mode 100644
index 0000000..82acf49
--- /dev/null
+++ b/samples/server/notify/notify_skeleton.c
@@ -0,0 +1,167 @@
+
+/*
+ * 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 "notify.h"
+#include <axutil_array_list.h>
+
+int AXIS2_CALL notify_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL notify_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 notify_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+axiom_node_t *AXIS2_CALL notify_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+static const axis2_svc_skeleton_ops_t notify_svc_skeleton_ops_var = {
+ notify_init,
+ notify_invoke,
+ notify_on_fault,
+ notify_free
+};
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_notify_create(
+ const axutil_env_t * env)
+{
+ axis2_svc_skeleton_t *svc_skeleton = NULL;
+ /* Allocate memory for the structs */
+ svc_skeleton = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_skeleton_t));
+
+ svc_skeleton->ops = &notify_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+notify_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of notify service should go here */
+ return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL
+notify_invoke(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx)
+{
+ /* Invoke the business logic.
+ * Depending on the function name invoke the correct impl method.
+ * We have only notify in this sample, hence invoke notify method.
+ * To see how to deal with multiple impl methods, have a look at the
+ * math sample.
+ */
+ axis2_notify_notify(env, node);
+ return NULL;
+}
+
+/* On fault, handle the fault */
+axiom_node_t *AXIS2_CALL
+notify_on_fault(
+ axis2_svc_skeleton_t * svc_skeli,
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ /* Here we are just setting a simple error message inside an element
+ * called 'EchoServiceError'
+ */
+ axiom_node_t *error_node = NULL;
+ axiom_node_t *text_node = NULL;
+ axiom_element_t *error_ele = NULL;
+ error_ele = axiom_element_create(env, node, "NotifyServiceError", NULL,
+ &error_node);
+ axiom_element_set_text(error_ele, env, "Notify service failed ", text_node);
+ return error_node;
+}
+
+/* Free the resources used */
+int AXIS2_CALL
+notify_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Free the function array */
+ if (svc_skeleton->func_array)
+ {
+ axutil_array_list_free(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
+ }
+
+ /* Free the service skeleton */
+ if (svc_skeleton)
+ {
+ AXIS2_FREE(env->allocator, svc_skeleton);
+ svc_skeleton = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+AXIS2_EXPORT int
+axis2_get_instance(
+ axis2_svc_skeleton_t ** inst,
+ const axutil_env_t * env)
+{
+ *inst = axis2_notify_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/notify/services.xml b/samples/server/notify/services.xml
new file mode 100644
index 0000000..ff2be47
--- /dev/null
+++ b/samples/server/notify/services.xml
@@ -0,0 +1,13 @@
+<service name="notify">
+ <parameter name="ServiceClass" locked="xsd:false">notify</parameter>
+
+ <description>
+ This is a testing service , to test one way service support
+ </description>
+
+ <operation name="notify" mep="http://www.w3.org/2004/08/wsdl/in-only">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >http://example.org/action/notify</parameter>
+ </operation>
+
+</service>
diff --git a/samples/server/sg_math/Makefile.am b/samples/server/sg_math/Makefile.am
new file mode 100644
index 0000000..82cc1ba
--- /dev/null
+++ b/samples/server/sg_math/Makefile.am
@@ -0,0 +1,11 @@
+prglibdir=$(prefix)/services/sg_math
+prglib_LTLIBRARIES = libadd.la libsub.la libmul.la libdiv.la
+prglib_DATA=services.xml
+EXTRA_DIST = services.xml sg_math.mk add.h div.h mul.h sub.h
+
+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 = @AXIS2INC@
diff --git a/samples/server/sg_math/add.c b/samples/server/sg_math/add.c
new file mode 100644
index 0000000..91cf99a
--- /dev/null
+++ b/samples/server/sg_math/add.c
@@ -0,0 +1,180 @@
+
+/*
+ * 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 "add.h"
+#include <stdio.h>
+#include <axis2_svc_grp_ctx.h>
+
+axiom_node_t *
+axis2_add_add(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx)
+{
+ 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;
+
+ axis2_svc_grp_ctx_t *svc_grp_ctx = 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);
+
+ /* Put the result into service group context */
+ svc_grp_ctx = axis2_msg_ctx_get_svc_grp_ctx(msg_ctx, env);
+ if (svc_grp_ctx)
+ {
+ axis2_ctx_t *ctx = NULL;
+ ctx = axis2_svc_grp_ctx_get_base(svc_grp_ctx, env);
+ if (ctx)
+ {
+ axutil_property_t *prop = NULL;
+ /* get value */
+ prop = axis2_ctx_get_property(ctx, env, "ADD_RESULT");
+ if (prop)
+ {
+ axis2_char_t *val =
+ (axis2_char_t *) axutil_property_get_value(prop, env);
+ printf("Previous result = %s\n", val);
+ }
+ /* set value */
+ prop = axutil_property_create(env);
+ if (prop)
+ {
+ axutil_property_set_value(prop, env,
+ axutil_strdup(env, result_str));
+ axis2_ctx_set_property(ctx, env, "ADD_RESULT", prop);
+ }
+ }
+ }
+
+ 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/sg_math/add.h b/samples/server/sg_math/add.h
new file mode 100644
index 0000000..40ec76b
--- /dev/null
+++ b/samples/server/sg_math/add.h
@@ -0,0 +1,33 @@
+
+/*
+ * 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 ADD_H
+#define ADD_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_add_add(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axis2_msg_ctx_t * msg_ctx);
+
+#endif /* ADD_H */
diff --git a/samples/server/sg_math/add_skeleton.c b/samples/server/sg_math/add_skeleton.c
new file mode 100644
index 0000000..7e7e13a
--- /dev/null
+++ b/samples/server/sg_math/add_skeleton.c
@@ -0,0 +1,151 @@
+
+/*
+ * 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 "add.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL add_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL add_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 add_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t add_svc_skeleton_ops_var = {
+ add_init,
+ add_invoke,
+ NULL,
+ add_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_add_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 = &add_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+add_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of add goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+add_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
+add_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 add 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_add_add(env, node, msg_ctx);
+ }
+ }
+ }
+ }
+
+ 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 = axis2_add_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/sg_math/div.c b/samples/server/sg_math/div.c
new file mode 100644
index 0000000..13ac9b5
--- /dev/null
+++ b/samples/server/sg_math/div.c
@@ -0,0 +1,150 @@
+
+/*
+ * 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 "div.h"
+#include <stdio.h>
+
+axiom_node_t *
+axis2_div_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/sg_math/div.h b/samples/server/sg_math/div.h
new file mode 100644
index 0000000..3b03e42
--- /dev/null
+++ b/samples/server/sg_math/div.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 DIV_H
+#define DIV_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_div_div(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* DIV_H */
diff --git a/samples/server/sg_math/div_skeleton.c b/samples/server/sg_math/div_skeleton.c
new file mode 100644
index 0000000..9007a58
--- /dev/null
+++ b/samples/server/sg_math/div_skeleton.c
@@ -0,0 +1,151 @@
+
+/*
+ * 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 "div.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL div_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL div_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 div_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t div_svc_skeleton_ops_var = {
+ div_init,
+ div_invoke,
+ NULL,
+ div_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_div_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 = &div_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+div_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of div goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+div_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
+div_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 div 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, "div") == 0)
+ return axis2_div_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 = axis2_div_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/sg_math/mul.c b/samples/server/sg_math/mul.c
new file mode 100644
index 0000000..b86a22b
--- /dev/null
+++ b/samples/server/sg_math/mul.c
@@ -0,0 +1,148 @@
+
+/*
+ * 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 "mul.h"
+#include <stdio.h>
+
+axiom_node_t *
+axis2_mul_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;
+}
diff --git a/samples/server/sg_math/mul.h b/samples/server/sg_math/mul.h
new file mode 100644
index 0000000..5e2d243
--- /dev/null
+++ b/samples/server/sg_math/mul.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 MUL_H
+#define MUL_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_mul_mul(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* MUL_H */
diff --git a/samples/server/sg_math/mul_skeleton.c b/samples/server/sg_math/mul_skeleton.c
new file mode 100644
index 0000000..1a58e3b
--- /dev/null
+++ b/samples/server/sg_math/mul_skeleton.c
@@ -0,0 +1,151 @@
+
+/*
+ * 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 "mul.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL mul_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL mul_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 mul_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t mul_svc_skeleton_ops_var = {
+ mul_init,
+ mul_invoke,
+ NULL,
+ mul_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_mul_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 = &mul_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+mul_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of mul goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+mul_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
+mul_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 mul 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, "mul") == 0)
+ return axis2_mul_mul(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 = axis2_mul_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/sg_math/services.xml b/samples/server/sg_math/services.xml
new file mode 100644
index 0000000..524a7ee
--- /dev/null
+++ b/samples/server/sg_math/services.xml
@@ -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>
diff --git a/samples/server/sg_math/sg_math.mk b/samples/server/sg_math/sg_math.mk
new file mode 100644
index 0000000..5ee16ed
--- /dev/null
+++ b/samples/server/sg_math/sg_math.mk
@@ -0,0 +1,15 @@
+echo:
+ @cl.exe /nologo /D "WIN32" /D "AXIS2_DECLARE_EXPORT" /D "_WINDOWS" /D "_MBCS" add.c add_skeleton.c /I.\..\..\..\include /c
+ @link.exe /nologo add.obj /LIBPATH:.\..\..\..\lib axiom.lib axutil.lib axis2_engine.lib axis2_parser.lib /DLL /OUT:add.dll
+
+
+ @cl.exe /nologo /D "WIN32" /D "AXIS2_DECLARE_EXPORT" /D "_WINDOWS" /D "_MBCS" div.c div_skeleton.c /I.\..\..\..\include /c
+ @link.exe /nologo div.obj /LIBPATH:.\..\..\..\lib axiom.lib axis2_util.lib axis2_engine.lib axis2_parser.lib /DLL /OUT:div.dll
+
+
+ @cl.exe /nologo /D "WIN32" /D "AXIS2_DECLARE_EXPORT" /D "_WINDOWS" /D "_MBCS" sub.c sub_skeleton.c /I.\..\..\..\include /c
+ @link.exe /nologo sub.obj /LIBPATH:.\..\..\..\lib axiom.lib axutil.lib axis2_engine.lib axis2_parser.lib /DLL /OUT:sub.dll
+
+
+ @cl.exe /nologo /D "WIN32" /D "AXIS2_DECLARE_EXPORT" /D "_WINDOWS" /D "_MBCS" mul.c mul_skeleton.c /I.\..\..\..\include /c
+ @link.exe /nologo mul.obj /LIBPATH:.\..\..\..\lib axiom.lib axutil.lib axis2_engine.lib axis2_parser.lib /DLL /OUT:mul.dll
diff --git a/samples/server/sg_math/sub.c b/samples/server/sg_math/sub.c
new file mode 100644
index 0000000..2b6b4e9
--- /dev/null
+++ b/samples/server/sg_math/sub.c
@@ -0,0 +1,148 @@
+
+/*
+ * 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 "sub.h"
+#include <stdio.h>
+
+axiom_node_t *
+axis2_sub_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;
+}
diff --git a/samples/server/sg_math/sub.h b/samples/server/sg_math/sub.h
new file mode 100644
index 0000000..9083c57
--- /dev/null
+++ b/samples/server/sg_math/sub.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 SUB_H
+#define SUB_H
+
+#include <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_sub_sub(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* SUB_H */
diff --git a/samples/server/sg_math/sub_skeleton.c b/samples/server/sg_math/sub_skeleton.c
new file mode 100644
index 0000000..aedeac7
--- /dev/null
+++ b/samples/server/sg_math/sub_skeleton.c
@@ -0,0 +1,151 @@
+
+/*
+ * 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 "sub.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL sub_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL sub_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 sub_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t sub_svc_skeleton_ops_var = {
+ sub_init,
+ sub_invoke,
+ NULL,
+ sub_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+axis2_sub_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 = &sub_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+sub_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of sub goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+sub_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
+sub_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 sub 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, "sub") == 0)
+ return axis2_sub_sub(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 = axis2_sub_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/version/Makefile.am b/samples/server/version/Makefile.am
new file mode 100644
index 0000000..9e6f94a
--- /dev/null
+++ b/samples/server/version/Makefile.am
@@ -0,0 +1,10 @@
+prglibdir=$(prefix)/services/version
+prglib_LTLIBRARIES = libversion.la
+prglib_DATA=services.xml
+noinst_HEADERS = version.h
+SUBDIRS =
+libversion_la_SOURCES = version.c version_skel.c
+libversion_la_LIBADD =
+INCLUDES = @AXIS2INC@
+EXTRA_DIST = services.xml version.h
+
diff --git a/samples/server/version/services.xml b/samples/server/version/services.xml
new file mode 100644
index 0000000..37bdc6b
--- /dev/null
+++ b/samples/server/version/services.xml
@@ -0,0 +1,9 @@
+<service name="version">
+ <parameter name="ServiceClass" locked="xsd:false">version</parameter>
+ <description>
+ This is a testing service, named 'version' to test multiple operations in the same service
+ </description>
+ <operation name="GetVersion">
+ <!--messageReceiver class="axis2_receivers" /-->
+ </operation>
+</service>
diff --git a/samples/server/version/version.c b/samples/server/version/version.c
new file mode 100644
index 0000000..81182eb
--- /dev/null
+++ b/samples/server/version/version.c
@@ -0,0 +1,59 @@
+
+/*
+ * 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 "version.h"
+#include <stdio.h>
+
+axiom_node_t *
+axis2_version_get_version(
+ const axutil_env_t * env,
+ axiom_node_t * node)
+{
+ 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;
+ }
+ else
+ {
+ 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;
+
+ sprintf(result_str, "%s", "Version 1.6");
+
+ ns1 = axiom_namespace_create(env,
+ "urn:aewebservices71", "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/version/version.h b/samples/server/version/version.h
new file mode 100644
index 0000000..56fc54e
--- /dev/null
+++ b/samples/server/version/version.h
@@ -0,0 +1,32 @@
+
+/*
+ * 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 <axis2_svc_skeleton.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *axis2_version_get_version(
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+#endif /* MATH_H */
diff --git a/samples/server/version/version_skel.c b/samples/server/version/version_skel.c
new file mode 100644
index 0000000..961c3d8
--- /dev/null
+++ b/samples/server/version/version_skel.c
@@ -0,0 +1,151 @@
+
+/*
+ * 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 "version.h"
+#include <axutil_array_list.h>
+#include <stdio.h>
+
+int AXIS2_CALL version_free(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t *AXIS2_CALL version_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 version_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env);
+
+static const axis2_svc_skeleton_ops_t version_svc_skeleton_ops_var = {
+ version_init,
+ version_invoke,
+ NULL,
+ version_free
+};
+
+AXIS2_EXTERN axis2_svc_skeleton_t *AXIS2_CALL
+version_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 = &version_svc_skeleton_ops_var;
+
+ svc_skeleton->func_array = NULL;
+
+ return svc_skeleton;
+}
+
+int AXIS2_CALL
+version_init(
+ axis2_svc_skeleton_t * svc_skeleton,
+ const axutil_env_t * env)
+{
+ /* Any initialization stuff of version goes here */
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+version_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
+version_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 version 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, "GetVersion") == 0)
+ return axis2_version_get_version(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 = version_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;
+}