ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r471639 - in /webservices/sandesha/trunk/c/samples: ./ RMSampleService/ client/ server/
Date Mon, 06 Nov 2006 05:07:53 GMT
Author: damitha
Date: Sun Nov  5 21:07:52 2006
New Revision: 471639

URL: http://svn.apache.org/viewvc?view=rev&rev=471639
Log:
Removing existing samples adding new samples which are interoperable
with sandesha2 java

Added:
    webservices/sandesha/trunk/c/samples/RMSampleService/
    webservices/sandesha/trunk/c/samples/RMSampleService/Makefile.am
    webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c
    webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.h
    webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc_skel.c
    webservices/sandesha/trunk/c/samples/RMSampleService/services.xml
Removed:
    webservices/sandesha/trunk/c/samples/client/
    webservices/sandesha/trunk/c/samples/server/
Modified:
    webservices/sandesha/trunk/c/samples/Makefile.am
    webservices/sandesha/trunk/c/samples/configure.ac

Modified: webservices/sandesha/trunk/c/samples/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/Makefile.am?view=diff&rev=471639&r1=471638&r2=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/Makefile.am (original)
+++ webservices/sandesha/trunk/c/samples/Makefile.am Sun Nov  5 21:07:52 2006
@@ -1,4 +1,4 @@
 samplesdir=$(prefix)/samples
-SUBDIRS = server client
+SUBDIRS = RMSampleService rm_echo rm_ping
 samples_DATA= Makefile.am Makefile.in
 

Added: webservices/sandesha/trunk/c/samples/RMSampleService/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/Makefile.am?view=auto&rev=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/Makefile.am Sun Nov  5 21:07:52 2006
@@ -0,0 +1,13 @@
+prglibdir=$(prefix)/services/RMSampleService
+samplesdir=$(prefix)/samples/server/rm/RMSampleService
+prglib_LTLIBRARIES = libRMSampleService.la
+samples_DATA=rm_sample_svc.c rm_sample_svc_skel.c rm_sample_svc.h services.xml Makefile.am
Makefile.in
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml
+noinst_HEADERS = rm_sample_svc.h
+SUBDIRS =
+libRMSampleService_la_SOURCES = rm_sample_svc.c rm_sample_svc_skel.c
+libRMSampleService_la_LIBADD  =
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c?view=auto&rev=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c (added)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c Sun Nov  5 21:07:52
2006
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "rm_svc_interop.h"
+#include <axiom_xml_writer.h>
+#include <stdio.h>
+#include <axis2_qname.h>
+
+axiom_node_t *
+build_echo_om(
+    const axis2_env_t *env, 
+    axis2_char_t *text);
+
+axiom_node_t *
+rm_svc_interop_echo (
+    const axis2_env_t *env, 
+    axiom_node_t *node)
+{
+    axiom_node_t *text_parent_node = NULL;
+    axiom_element_t *text_parent_element = NULL;
+    axiom_node_t *text_node = NULL;
+    axiom_node_t *ret_node = NULL;
+    axiom_element_t *element = NULL;
+    axis2_char_t *ns = "http://tempuri.org/";
+    axis2_qname_t *qname = 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 */
+    {
+        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;
+    }
+    else
+    {
+        axiom_xml_writer_t *writer = NULL;
+        axiom_output_t *om_output = NULL;
+        axis2_char_t *buffer = NULL;
+  
+        writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+            AXIS2_XML_PARSER_TYPE_BUFFER);
+        om_output = axiom_output_create (env, writer);
+
+        AXIOM_NODE_SERIALIZE (node, env, om_output);
+        buffer = AXIOM_XML_WRITER_GET_XML(writer, env);
+        printf("buffer = %s \n", buffer);
+    }
+
+    element = AXIOM_NODE_GET_DATA_ELEMENT(node, env);
+    qname = axis2_qname_create(env, "Text", ns, NULL);
+    text_parent_element = AXIOM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(element, env, 
+            qname, node, &text_parent_node);
+    AXIS2_QNAME_FREE(qname, env);
+    if (!text_parent_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;
+    }
+    
+    text_node = AXIOM_NODE_GET_FIRST_CHILD(text_parent_node, env);
+    if (!text_node) /* actual text to echo */
+    {
+        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(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 = AXIOM_TEXT_GET_VALUE(text, env);
+            printf("Echoing text value  %s \n", text_str);
+            ret_node = build_echo_om(env, text_str);
+        }
+    }
+    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_echo_om(
+    const axis2_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://tempuri.org/", "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);
+
+    echo_om_ele = axiom_element_create(env, NULL, "echoStringResponse", ns1, &echo_om_node);
+    text_om_ele = axiom_element_create(env, echo_om_node, "EchoStringReturn", ns1, &text_om_node);
+    AXIOM_ELEMENT_SET_TEXT(text_om_ele, env, text, text_om_node);
+
+    
+    return echo_om_node;
+}
+
+void
+rm_svc_interop_ping (
+    const axis2_env_t *env, 
+    axiom_node_t *node)
+{
+    axiom_node_t *text_parent_node = NULL;
+    axiom_element_t *text_parent_element = NULL;
+    axiom_node_t *text_node = NULL;
+    axiom_node_t *ret_node = NULL;
+    axiom_element_t *element = NULL;
+    axis2_char_t *ns = "http://tempuri.org/";
+    axis2_qname_t *qname = 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 */
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL, AXIS2_FAILURE);
+        printf("Echo client ERROR: input parameter NULL\n");
+        return;
+    }
+    else
+    {
+        axiom_xml_writer_t *writer = NULL;
+        axiom_output_t *om_output = NULL;
+        axis2_char_t *buffer = NULL;
+  
+        writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+            AXIS2_XML_PARSER_TYPE_BUFFER);
+        om_output = axiom_output_create (env, writer);
+
+        AXIOM_NODE_SERIALIZE (node, env, om_output);
+        buffer = AXIOM_XML_WRITER_GET_XML(writer, env);
+        printf("buffer = %s \n", buffer);
+    }
+
+    element = AXIOM_NODE_GET_DATA_ELEMENT(node, env);
+    qname = axis2_qname_create(env, "Text", ns, NULL);
+    text_parent_element = AXIOM_ELEMENT_GET_FIRST_CHILD_WITH_QNAME(element, env, 
+            qname, node, &text_parent_node);
+    AXIS2_QNAME_FREE(qname, env);
+    if (!text_parent_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;
+    }
+    
+    text_node = AXIOM_NODE_GET_FIRST_CHILD(text_parent_node, env);
+    if (!text_node) /* actual text to echo */
+    {
+        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;
+    }
+    
+    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 = AXIOM_TEXT_GET_VALUE(text, env);
+            printf("Echoing text value  %s \n", text_str);
+        }
+    }
+    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;
+    }
+   
+    return;
+}
+

Added: webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.h?view=auto&rev=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.h (added)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.h Sun Nov  5 21:07:52
2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef CALC_H
+#define CALC_H
+
+
+#include <axis2_svc_skeleton.h>
+#include <axis2_log_default.h>
+#include <axis2_error_default.h>
+#include <axiom_text.h>
+#include <axiom_node.h>
+#include <axiom_element.h>
+
+axiom_node_t *
+rm_svc_interop_echo(
+    const axis2_env_t *env, 
+    axiom_node_t *node);
+
+void
+rm_svc_interop_ping (
+    const axis2_env_t *env, 
+    axiom_node_t *node);
+
+#endif /* CALC_H*/

Added: webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc_skel.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc_skel.c?view=auto&rev=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc_skel.c (added)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc_skel.c Sun Nov  5 21:07:52
2006
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <axis2_svc_skeleton.h>
+#include "rm_svc_interop.h"
+#include <axis2_array_list.h>
+#include <axis2_op.h>
+
+int AXIS2_CALL
+rm_svc_interop_free(axis2_svc_skeleton_t *svc_skeleton,
+            const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+rm_svc_interop_free_void_arg(void *svc_skeleton,
+                    const axis2_env_t *env);
+
+/*
+ * This method invokes the right service method 
+ */
+axiom_node_t* AXIS2_CALL 
+rm_svc_interop_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            const axis2_env_t *env,
+            axiom_node_t *node,
+            axis2_msg_ctx_t *msg_ctx);
+            
+
+int AXIS2_CALL 
+rm_svc_interop_init(axis2_svc_skeleton_t *svc_skeleton,
+          const axis2_env_t *env);
+
+axiom_node_t* AXIS2_CALL
+rm_svc_interop_on_fault(axis2_svc_skeleton_t *svc_skeli, 
+              const axis2_env_t *env, axiom_node_t *node);
+
+/*Create function */
+axis2_svc_skeleton_t *
+rm_svc_interop_create(const axis2_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 = AXIS2_MALLOC(
+        env->allocator, sizeof(axis2_svc_skeleton_ops_t));
+
+    svc_skeleton->func_array = NULL;
+    /* Assign function pointers */
+    svc_skeleton->ops->free = rm_svc_interop_free;
+    svc_skeleton->ops->init = rm_svc_interop_init;
+    svc_skeleton->ops->invoke = rm_svc_interop_invoke;
+    svc_skeleton->ops->on_fault = rm_svc_interop_on_fault;
+
+    return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+rm_svc_interop_init(
+    axis2_svc_skeleton_t *svc_skeleton,
+    const axis2_env_t *env)
+{
+    svc_skeleton->func_array = axis2_array_list_create(env, 0);
+    /* Add the implemented operation names of the service to  
+     * the array list of functions 
+     */
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "echoString");
+    AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "ping");
+    /* Any initialization stuff of echo service should go here */
+    return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method 
+ */
+axiom_node_t* AXIS2_CALL
+rm_svc_interop_invoke(
+    axis2_svc_skeleton_t *svc_skeleton,
+    const axis2_env_t *env,
+    axiom_node_t *node,
+    axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_op_t *op = NULL;
+    axis2_qname_t *op_qname = NULL;
+    axis2_char_t *op_name = NULL;
+    
+    op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env);
+    if(op)
+    {
+        op_qname = AXIS2_OP_GET_QNAME(op, env);
+        if(op_qname)
+            op_name = AXIS2_QNAME_GET_LOCALPART(op_qname, env);
+        if(op_name)
+        {
+            if (AXIS2_STRCMP(op_name, "echoString") == 0)
+                return rm_svc_interop_echo(env, node);
+            if (AXIS2_STRCMP(op_name, "ping") == 0)
+            {
+                rm_svc_interop_ping(env, node);
+                return NULL;
+            }
+        }
+    }
+    return NULL;
+}
+
+/* On fault, handle the fault */
+axiom_node_t* AXIS2_CALL
+rm_svc_interop_on_fault(axis2_svc_skeleton_t *svc_skeli, 
+              const axis2_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
+rm_svc_interop_free(axis2_svc_skeleton_t *svc_skeleton,
+            const axis2_env_t *env)
+{
+    /* Free the function array */
+    if(svc_skeleton->func_array)
+    {
+        AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
+        svc_skeleton->func_array = NULL;
+    }
+    
+    /* Free the function array */
+    if(svc_skeleton->ops)
+    {
+        AXIS2_FREE(env->allocator, svc_skeleton->ops);
+        svc_skeleton->ops = 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 axis2_env_t *env)
+{
+   *inst = rm_svc_interop_create(env);
+    if(!(*inst))
+    {
+        return AXIS2_FAILURE;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXPORT int 
+axis2_remove_instance(
+    axis2_svc_skeleton_t *inst,
+    const axis2_env_t *env)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+   if (inst)
+   {
+        status = AXIS2_SVC_SKELETON_FREE(inst, env);
+    }
+    return status;
+}
+

Added: webservices/sandesha/trunk/c/samples/RMSampleService/services.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/services.xml?view=auto&rev=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/services.xml (added)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/services.xml Sun Nov  5 21:07:52
2006
@@ -0,0 +1,16 @@
+<service name="RMSampleService">
+    <module ref="sandesha2"/>
+    <parameter name="ServiceClass" locked="xsd:false">RMSampleService</parameter>
+
+   <description>
+        This is a Relaible Messaging test service to be used in interop testing with java
+   </description>
+
+    <operation name="echoString">
+            <parameter name="wsamapping" >http://tempuri.org/echoString</parameter>
+    </operation>
+    <operation name="ping">
+            <parameter name="wsamapping" >http://tempuri.org/ping</parameter>
+    </operation>
+
+</service>

Modified: webservices/sandesha/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/configure.ac?view=diff&rev=471639&r1=471638&r2=471639
==============================================================================
--- webservices/sandesha/trunk/c/samples/configure.ac (original)
+++ webservices/sandesha/trunk/c/samples/configure.ac Sun Nov  5 21:07:52 2006
@@ -118,16 +118,9 @@
 AC_SUBST(DICLIENT_DIR)
 
 AC_CONFIG_FILES([Makefile \
-    server/Makefile \
-    server/rm_mtom/Makefile \
-    server/rm_ping/Makefile \
-    server/rm_echo/Makefile \
-    client/Makefile \
-    client/rm_mtom/Makefile \
-    client/rm_mtom/resources/Makefile \
-    client/rm_ping/Makefile \
-    client/rm_echo/Makefile \
-    client/rm_echo_blocking/Makefile
+    RMSampleService/Makefile \
+    rm_echo/Makefile
+    rm_ping/Makefile
     ])
     
 AC_OUTPUT



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message