diff options
| author | 2010-02-13 01:32:03 +0000 | |
|---|---|---|
| committer | 2010-02-13 01:32:03 +0000 | |
| commit | 0425aadc78680e53000fd0108b540d6eca048516 (patch) | |
| tree | 8ec7ab8e015d454c5ec586dfc91e05a2dce1cfc0 /samples/server/version | |
| download | axis2c-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/version')
| -rw-r--r-- | samples/server/version/Makefile.am | 10 | ||||
| -rw-r--r-- | samples/server/version/services.xml | 9 | ||||
| -rw-r--r-- | samples/server/version/version.c | 59 | ||||
| -rw-r--r-- | samples/server/version/version.h | 32 | ||||
| -rw-r--r-- | samples/server/version/version_skel.c | 151 | 
5 files changed, 261 insertions, 0 deletions
| 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; +} | 
