You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by da...@apache.org on 2006/09/10 05:13:06 UTC

svn commit: r441889 - in /webservices/sandesha/trunk/c/samples: ./ client/ client/rm_echo/ client/rm_echo_blocking/ client/rm_mtom/ client/rm_mtom/resources/ client/rm_ping/ server/ server/rm_echo/

Author: damitha
Date: Sat Sep  9 20:13:05 2006
New Revision: 441889

URL: http://svn.apache.org/viewvc?view=rev&rev=441889
Log:
Added sandesha2 samples

Added:
    webservices/sandesha/trunk/c/samples/
    webservices/sandesha/trunk/c/samples/Makefile.am
    webservices/sandesha/trunk/c/samples/client/
    webservices/sandesha/trunk/c/samples/client/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_echo/
    webservices/sandesha/trunk/c/samples/client/rm_echo/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.c
    webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.h
    webservices/sandesha/trunk/c/samples/client/rm_echo/rm_echo_client.c
    webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/
    webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.c
    webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.h
    webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/rm_echo_blocking.c
    webservices/sandesha/trunk/c/samples/client/rm_mtom/
    webservices/sandesha/trunk/c/samples/client/rm_mtom/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_mtom/mtom_client.c
    webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/
    webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/axis2.jpg   (with props)
    webservices/sandesha/trunk/c/samples/client/rm_ping/
    webservices/sandesha/trunk/c/samples/client/rm_ping/Makefile.am
    webservices/sandesha/trunk/c/samples/client/rm_ping/rm_ping_client.c
    webservices/sandesha/trunk/c/samples/configure.ac
    webservices/sandesha/trunk/c/samples/server/
    webservices/sandesha/trunk/c/samples/server/rm_echo/
    webservices/sandesha/trunk/c/samples/server/rm_echo/Makefile.am
    webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.c
    webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.h
    webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c
    webservices/sandesha/trunk/c/samples/server/rm_echo/services.xml

Added: webservices/sandesha/trunk/c/samples/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,12 @@
+samplesdir=$(prefix)/samples
+samples_DATA=AUTHORS autogen.sh ChangeLog configure.ac Makefile.am NEWS README configure Makefile.in config.h.in INSTALL COPYING ../install-sh ../config.guess ../ltmain.sh ../depcomp ../missing ../config.sub
+SUBDIRS = server client
+install-data-hook:
+	chmod 755 $(samplesdir)/configure $(samplesdir)/autogen.sh
+
+dist-hook:
+	rm -rf `find $(distdir)/ -type d -name .svn`
+	rm -rf `find $(distdir)/ -type d -name .deps`
+	rm -rf `find $(distdir)/ -type d -name .libs`
+
+EXTRA_DIST=codegen autogen.sh

Added: webservices/sandesha/trunk/c/samples/client/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,4 @@
+clientdir=$(prefix)/samples/client
+SUBDIRS = rm_mtom rm_ping rm_echo rm_echo_blocking
+client_DATA = Makefile.am Makefile.in
+EXTRA_DIST= Makefile.am

Added: webservices/sandesha/trunk/c/samples/client/rm_echo/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,24 @@
+prgbindir=$(prefix)/bin/samples
+prgbin_PROGRAMS = rm_echo
+samplesdir=$(prefix)/samples/client/rm_echo
+samples_DATA=rm_echo_client.c Makefile.am Makefile.in
+rm_echo_SOURCES = rm_echo_client.c echo_util.c
+
+rm_echo_LDADD   =  \
+                    -L$(AXIS2C_HOME)/lib \
+					-laxis2_util \
+                    -laxis2_axiom \
+                    -laxis2_wsdl \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+					-lwoden \
+					-laxis2_xml_schema \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,40 @@
+/*
+ * 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 "echo_util.h"
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_payload_for_echo_svc(const axis2_env_t *env)
+{
+    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;
+    axis2_char_t *om_str = 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, "echo5", text_om_node);
+    
+    om_str = AXIOM_NODE_TO_STRING(echo_om_node, env);
+    if (om_str)
+        printf("\nSending OM : %s\n", om_str);
+
+    return echo_om_node;
+}

Added: webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.h?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.h (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo/echo_util.h Sat Sep  9 20:13:05 2006
@@ -0,0 +1,26 @@
+/*
+ * 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 AXIS2_UG_ECHO_UTIL_H
+#define AXIS2_UG_ECHO_UTIL_H
+
+#include <stdio.h>
+#include <axiom.h>
+
+axiom_node_t *
+build_om_payload_for_echo_svc(const axis2_env_t *env);
+
+#endif

Added: webservices/sandesha/trunk/c/samples/client/rm_echo/rm_echo_client.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo/rm_echo_client.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo/rm_echo_client.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo/rm_echo_client.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,227 @@
+/*
+ * 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 "echo_util.h"
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+
+#define MAX_COUNT  3000000
+
+/* my on_complete callback function */
+axis2_status_t AXIS2_CALL
+rm_echo_callback_on_complete(struct axis2_callback *callback,
+    const axis2_env_t *env);
+
+/* my on_error callback function */
+axis2_status_t AXIS2_CALL
+rm_echo_callback_on_error(struct axis2_callback *callback,
+    const axis2_env_t *env,
+    int exception);
+
+/* to check whether the callback is completed */
+int is_complete = 0;
+
+int main(int argc, char** argv)
+{
+    const axis2_env_t *env = NULL;
+    const axis2_char_t *address = NULL;
+    axis2_endpoint_ref_t* endpoint_ref = NULL;
+    axis2_endpoint_ref_t* reply_to = NULL;
+    axis2_options_t *options = NULL;
+    const axis2_char_t *client_home = NULL;
+    axis2_svc_client_t* svc_client = NULL;
+    axiom_node_t *payload = NULL;
+    axis2_callback_t *callback1 = NULL;
+    axis2_callback_t *callback2 = NULL;
+    int count = 0;
+    axis2_property_t *property = NULL;
+    /*axis2_qname_t *op_qname = NULL;*/
+   
+    /* Set up the environment */
+    env = axis2_env_create_all("echo_non_blocking_dual.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set end point reference of echo service */
+    address = "http://localhost:9090/axis2/services/rm_echo";
+    if (argc > 1 )
+        address = argv[1];
+    if (AXIS2_STRCMP(address, "-h") == 0)
+    {
+        printf("Usage : %s [endpoint_url]\n", argv[0]);
+        printf("use -h for help\n");
+        return 0;
+    }
+    printf ("Using endpoint : %s\n", address);
+    
+    /* Create EPR with given address */
+    endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+    /* Setup options */
+    options = axis2_options_create(env);
+    AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
+    AXIS2_OPTIONS_SET_USE_SEPARATE_LISTENER(options, env, AXIS2_TRUE);
+    
+    /* Seperate listner needs addressing, hence addressing stuff in options */
+    AXIS2_OPTIONS_SET_ACTION(options, env,
+        "http://ws.apache.org/axis2/c/samples/echoString");
+    reply_to = axis2_endpoint_ref_create(env, "http://localhost:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__");
+
+    AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
+    AXIS2_PROPERTY_SET_VALUE(property, env, AXIS2_VALUE_TRUE);
+
+    /* Set up deploy folder. It is from the deploy folder, the configuration is picked up 
+     * using the axis2.xml file.
+     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
+     * be different from this folder on your system. For example, you may have a different folder 
+     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
+     * modules that the client uses
+     */
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../deploy";
+
+    /* Create service client */
+    svc_client = axis2_svc_client_create(env, client_home);
+    if (!svc_client)
+    {
+        printf("Error creating service client\n");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        return -1;
+    }
+
+    /* Set service client options */
+    AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);    
+    
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING);  
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, "sandesha2");
+
+    /* Build the SOAP request message payload using OM API.*/
+    /*payload = build_om_payload_for_echo_svc(env);
+    
+    callback1 = axis2_callback_create(env);
+   
+   AXIS2_CALLBACK_SET_ON_COMPLETE(callback1, rm_echo_callback_on_complete);
+
+   AXIS2_CALLBACK_SET_ON_ERROR(callback1, rm_echo_callback_on_error);
+
+    
+    AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env, 
+        payload, callback1);
+    AXIS2_SLEEP(5);*/
+    /* Create the callback object with default on_complete and on_error 
+       callback functions */
+    callback2 = axis2_callback_create(env);
+   /* Set our on_complete fucntion pointer to the callback object */
+    AXIS2_CALLBACK_SET_ON_COMPLETE(callback2, rm_echo_callback_on_complete);
+   /* Set our on_error function pointer to the callback object */
+    AXIS2_CALLBACK_SET_ON_ERROR(callback2, rm_echo_callback_on_error);
+    payload = build_om_payload_for_echo_svc(env);
+    AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", 
+            property);
+    /* Send request */
+    AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env, 
+        payload, callback2);
+    
+    /** Wait till callback is complete. Simply keep the parent thread running
+       until our on_complete or on_error is invoked */
+   while(count < MAX_COUNT )
+   {
+      if (is_complete)
+      {
+         /* We are done with the callback */
+         break;
+      }
+        AXIS2_SLEEP(1);
+        count++;
+   }
+    
+    if (!(count < MAX_COUNT))
+    {
+        printf("\nrm_echo client invoke FAILED. Counter timed out.\n");
+    }
+    
+    if (svc_client)
+    {
+        AXIS2_SVC_CLIENT_FREE(svc_client, env);
+        svc_client = NULL;
+    }
+    
+    return 0;
+}
+
+axis2_status_t AXIS2_CALL
+rm_echo_callback_on_complete(struct axis2_callback *callback,
+                                  const axis2_env_t *env)
+{
+   /** SOAP response has arrived here; get the soap envelope 
+     from the callback object and do whatever you want to do with it */
+   
+   axiom_soap_envelope_t *soap_envelope = NULL;
+   axiom_node_t *ret_node = NULL;
+    axis2_status_t status = AXIS2_SUCCESS;
+   
+   printf("inside on_complete_callback function\n");
+   
+   soap_envelope = AXIS2_CALLBACK_GET_ENVELOPE(callback, env);
+   
+   if (!soap_envelope)
+   {
+       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                     " %d :: %s", env->error->error_number,
+                     AXIS2_ERROR_GET_MESSAGE(env->error));
+      printf("echo stub invoke FAILED!\n");
+      status = AXIS2_FAILURE;
+   }
+    else
+    {
+        ret_node = AXIOM_SOAP_ENVELOPE_GET_BASE_NODE(soap_envelope, env);
+    
+        if(!ret_node)
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                          " %d :: %s", env->error->error_number,
+                          AXIS2_ERROR_GET_MESSAGE(env->error));
+            printf("echo stub invoke FAILED!\n");
+            status = AXIS2_FAILURE;
+        }
+        else
+        {
+            axis2_char_t *om_str = NULL;
+            om_str = AXIOM_NODE_TO_STRING(ret_node, env);
+            if (om_str)
+                printf("\nReceived OM : %s\n", om_str);
+            printf("\necho client invoke SUCCESSFUL!\n");
+        }
+    }    
+    is_complete = 0;
+   return status;
+}
+
+axis2_status_t AXIS2_CALL
+rm_echo_callback_on_error(struct axis2_callback *callback,
+                            const axis2_env_t *env,
+                            int exception)
+{
+   /** take necessary action on error */
+   printf("\nEcho client invoke FAILED. Error code:%d ::%s", exception, 
+         AXIS2_ERROR_GET_MESSAGE(env->error));
+   is_complete = 1;
+   return AXIS2_SUCCESS;
+}

Added: webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,24 @@
+prgbindir=$(prefix)/bin/samples
+prgbin_PROGRAMS = rm_echo_blocking
+samplesdir=$(prefix)/samples/client/rm_echo_blocking
+samples_DATA=rm_echo_blocking.c Makefile.am Makefile.in
+rm_echo_blocking_SOURCES = echo_util.c rm_echo_blocking.c
+
+rm_echo_blocking_LDADD   =  \
+                    -L$(AXIS2C_HOME)/lib \
+					-laxis2_util \
+                    -laxis2_axiom \
+                    -laxis2_wsdl \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+					-lwoden \
+					-laxis2_xml_schema \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,42 @@
+/*
+ * 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 "echo_util.h"
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_payload_for_echo_svc(
+    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;
+    axis2_char_t *om_str = 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);
+    
+    om_str = AXIOM_NODE_TO_STRING(echo_om_node, env);
+    if (om_str)
+        printf("\nSending OM : %s\n", om_str);
+
+    return echo_om_node;
+}

Added: webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.h?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.h (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/echo_util.h Sat Sep  9 20:13:05 2006
@@ -0,0 +1,28 @@
+/*
+ * 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 AXIS2_UG_ECHO_UTIL_H
+#define AXIS2_UG_ECHO_UTIL_H
+
+#include <stdio.h>
+#include <axiom.h>
+
+axiom_node_t *
+build_om_payload_for_echo_svc(
+    const axis2_env_t *env,
+    axis2_char_t *text);
+
+#endif

Added: webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/rm_echo_blocking.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/rm_echo_blocking.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/rm_echo_blocking.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_echo_blocking/rm_echo_blocking.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,142 @@
+/*
+ * 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 "echo_util.h"
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+
+#define MAX_COUNT  3000000
+
+/* to check whether the callback is completed */
+int is_complete = 0;
+
+int main(int argc, char** argv)
+{
+    const axis2_env_t *env = NULL;
+    const axis2_char_t *address = NULL;
+    axis2_endpoint_ref_t* endpoint_ref = NULL;
+    axis2_endpoint_ref_t* reply_to = NULL;
+    axis2_options_t *options = NULL;
+    const axis2_char_t *client_home = NULL;
+    axis2_svc_client_t* svc_client = NULL;
+    axiom_node_t *payload = NULL;
+    axiom_node_t *payload2 = NULL;
+    int count = 0;
+    axis2_property_t *property = NULL;
+    /*axis2_qname_t *op_qname = NULL;*/
+   
+    /* Set up the environment */
+    env = axis2_env_create_all("echo_non_blocking_dual.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set end point reference of echo service */
+    address = "http://localhost:9090/axis2/services/rm_echo";
+    if (argc > 1 )
+        address = argv[1];
+    if (AXIS2_STRCMP(address, "-h") == 0)
+    {
+        printf("Usage : %s [endpoint_url]\n", argv[0]);
+        printf("use -h for help\n");
+        return 0;
+    }
+    printf ("Using endpoint : %s\n", address);
+    
+    /* Create EPR with given address */
+    endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+    /* Setup options */
+    options = axis2_options_create(env);
+    AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
+    AXIS2_OPTIONS_SET_USE_SEPARATE_LISTENER(options, env, AXIS2_TRUE);
+    
+    /* Seperate listner needs addressing, hence addressing stuff in options */
+    AXIS2_OPTIONS_SET_ACTION(options, env,
+        "http://ws.apache.org/axis2/c/samples/echoString");
+    reply_to = axis2_endpoint_ref_create(env, "http://192.168.1.106:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__");
+
+    AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
+    AXIS2_PROPERTY_SET_VALUE(property, env, AXIS2_VALUE_TRUE);
+
+    /* Set up deploy folder. It is from the deploy folder, the configuration is picked up 
+     * using the axis2.xml file.
+     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
+     * be different from this folder on your system. For example, you may have a different folder 
+     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
+     * modules that the client uses
+     */
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../deploy";
+
+    /* Create service client */
+    svc_client = axis2_svc_client_create(env, client_home);
+    if (!svc_client)
+    {
+        printf("Error creating service client\n");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        return -1;
+    }
+
+    /* Set service client options */
+    AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);    
+    
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING);  
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, "sandesha2");
+    
+    /* Build the SOAP request message payload using OM API.*/
+    /*payload = build_om_payload_for_echo_svc(env, "echo1");
+    AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+    AXIS2_SLEEP(2);*/
+
+    /* Build the SOAP request message payload using OM API.*/
+    payload2 = build_om_payload_for_echo_svc(env, "echo2");
+    
+    AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", 
+            property);
+    /* Send request */
+    AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload2);
+
+    /** Wait till callback is complete. Simply keep the parent thread running
+       until our on_complete or on_error is invoked */
+   while(count < MAX_COUNT )
+   {
+      if (is_complete)
+      {
+         /* We are done with the callback */
+         break;
+      }
+        AXIS2_SLEEP(1);
+        count++;
+   }
+    
+    if (!(count < MAX_COUNT))
+    {
+        printf("\nrm_echo client invoke FAILED. Counter timed out.\n");
+    }
+    
+    if (svc_client)
+    {
+        AXIS2_SVC_CLIENT_FREE(svc_client, env);
+        svc_client = NULL;
+    }
+    
+    return 0;
+}
+

Added: webservices/sandesha/trunk/c/samples/client/rm_mtom/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_mtom/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_mtom/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_mtom/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,26 @@
+SUBDIRS=resources
+prgbindir=$(prefix)/bin/samples
+prgbin_PROGRAMS = rm_mtom
+samplesdir=$(prefix)/samples/client/rm_mtom
+samples_DATA=mtom_client.c Makefile.am Makefile.in
+
+rm_mtom_SOURCES = mtom_client.c
+
+rm_mtom_LDADD   = $(LDFLAGS) \
+                    -L$(AXIS2C_HOME)/lib \
+					-laxis2_util \
+                    -laxis2_axiom \
+                    -laxis2_wsdl \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+					-lwoden \
+					-laxis2_xml_schema \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/client/rm_mtom/mtom_client.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_mtom/mtom_client.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_mtom/mtom_client.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_mtom/mtom_client.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,176 @@
+/*
+ * 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 <stdio.h>
+#include <axiom.h>
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env, 
+    const axis2_char_t *image_name, 
+    const axis2_char_t *to_save_name);
+
+int main(int argc, char** argv)
+{
+    const axis2_env_t *env = NULL;
+    const axis2_char_t *address = NULL;
+    axis2_endpoint_ref_t* endpoint_ref = NULL;
+    axis2_options_t *options = NULL;
+    const axis2_char_t *client_home = NULL;
+    axis2_svc_client_t* svc_client = NULL;
+    axiom_node_t *payload = NULL;
+    axiom_node_t *ret_node = NULL;
+    const axis2_char_t *image_name = "resources/axis2.jpg";
+    const axis2_char_t *to_save_name = "test.jpg";
+    axis2_property_t *property = NULL;
+    axis2_endpoint_ref_t* reply_to = NULL;
+
+   
+    /* Set up the environment */
+    env = axis2_env_create_all("mtom.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set end point reference of mtom service */
+    address = "http://localhost:9090/axis2/services/mtom";
+    if (argc > 1 )
+        address = argv[1];
+    if (AXIS2_STRCMP(address, "-h") == 0)
+    {
+        printf("Usage : %s [endpoint_url] [image_name] [to_save_name]\n", argv[0]);
+        printf("use -h for help\n");
+        return 0;
+    }
+    if (argc > 2)
+        image_name = argv[2];
+    if (argc > 3)
+        to_save_name = argv[3];
+
+    printf ("Using endpoint : %s\n", address);
+
+    /* Create EPR with given address */
+    endpoint_ref = axis2_endpoint_ref_create(env, address);
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
+    AXIS2_PROPERTY_SET_VALUE(property, env, AXIS2_VALUE_TRUE);
+
+    /* Setup options */
+    options = axis2_options_create(env);
+    AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
+    AXIS2_OPTIONS_SET_USE_SEPARATE_LISTENER(options, env, AXIS2_TRUE);
+    /* Seperate listner needs addressing, hence addressing stuff in options */
+    AXIS2_OPTIONS_SET_ACTION(options, env,
+        "http://ws.apache.org/axis2/c/samples/mtomSample");
+    reply_to = axis2_endpoint_ref_create(env, 
+            "http://localhost:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__");
+
+    AXIS2_OPTIONS_SET_REPLY_TO(options, env, reply_to);
+    AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11);
+    AXIS2_OPTIONS_SET_ENABLE_MTOM(options, env, AXIS2_TRUE);
+
+    /* Set up deploy folder. It is from the deploy folder, the configuration is picked up 
+     * using the axis2.xml file.
+     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
+     * be different from this folder on your system. For example, you may have a different folder 
+     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
+     * modules that the client uses
+     */
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../deploy";
+
+    /* Create service client */
+    svc_client = axis2_svc_client_create(env, client_home);
+    if (!svc_client)
+    {
+        printf("Error creating service client\n");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+    }
+
+    /* Set service client options */
+    AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);    
+    
+    /* Engage addressing module */
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING);
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, "sandesha2");
+    
+    /* Build the SOAP request message payload using OM API.*/
+    payload = build_om_programatically(env, image_name, to_save_name);
+    
+    AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", 
+            property);
+    /* Send request */
+    ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
+    
+    if(ret_node)
+    {
+        axis2_char_t *om_str = NULL;
+        om_str = AXIOM_NODE_TO_STRING(ret_node, env);
+        if (om_str)
+            printf("\nReceived OM : %s\n", om_str);
+        printf("\nmtom client invoke SUCCESSFUL!\n");
+    }
+    else
+    {
+      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        printf("mtom client invoke FAILED!\n");
+    }
+    
+    if (svc_client)
+    {
+        AXIS2_SVC_CLIENT_FREE(svc_client, env);
+        svc_client = NULL;
+    }
+
+    return 0;
+
+}
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env, 
+    const axis2_char_t *image_name, 
+    const axis2_char_t *to_save_name)
+{
+    axiom_node_t *mtom_om_node = NULL;
+    axiom_element_t* mtom_om_ele = NULL;
+    axiom_node_t* image_om_node = NULL;
+    axiom_element_t * image_om_ele = NULL;
+    axiom_node_t* file_om_node = NULL;
+    axiom_element_t * file_om_ele = NULL;
+    axiom_node_t* data_om_node = NULL;
+    axiom_text_t * data_text = NULL;
+    axiom_namespace_t *ns1 = NULL;
+
+    axiom_data_handler_t *data_handler = NULL;
+    
+    ns1 = axiom_namespace_create (env, "http://ws.apache.org/axis2/c/samples/mtom", "ns1");
+    mtom_om_ele = axiom_element_create(env, NULL, "mtomSample", ns1, &mtom_om_node);
+    
+    file_om_ele = axiom_element_create(env, mtom_om_node, "fileName", ns1, &file_om_node);
+    AXIOM_ELEMENT_SET_TEXT(file_om_ele, env, to_save_name, file_om_node);
+
+    image_om_ele = axiom_element_create(env, mtom_om_node, "image", ns1, &image_om_node);
+
+    data_handler = axiom_data_handler_create(env, image_name, "image/jpeg");
+    data_text = axiom_text_create_with_data_handler(env, image_om_node, data_handler, &data_om_node);
+    printf("%s", AXIOM_NODE_TO_STRING(mtom_om_node, env));
+    return mtom_om_node;
+}

Added: webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,6 @@
+resourcesdir=$(prefix)/samples/client/mtom/resources
+samplesdir=$(prefix)/bin/samples/resources
+samples_DATA=axis2.jpg 
+resources_DATA=Makefile.am Makefile.in axis2.jpg
+EXTRA_DIST=axis2.jpg
+

Added: webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/axis2.jpg
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/axis2.jpg?view=auto&rev=441889
==============================================================================
Binary file - no diff available.

Propchange: webservices/sandesha/trunk/c/samples/client/rm_mtom/resources/axis2.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/sandesha/trunk/c/samples/client/rm_ping/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_ping/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_ping/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_ping/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,24 @@
+prgbindir=$(prefix)/bin/samples
+prgbin_PROGRAMS = rm_ping
+samplesdir=$(prefix)/samples/client/rm_ping
+samples_DATA=rm_ping_client.c Makefile.am Makefile.in
+rm_ping_SOURCES = rm_ping_client.c
+
+rm_ping_LDADD   =  \
+                    -L$(AXIS2C_HOME)/lib \
+					-laxis2_util \
+                    -laxis2_axiom \
+                    -laxis2_wsdl \
+                    -laxis2_engine \
+                    -laxis2_parser \
+                    -lpthread \
+                    -laxis2_http_sender \
+                    -laxis2_http_receiver \
+					-lwoden \
+					-laxis2_xml_schema \
+                    $(GUTHTHILA_LIBS) \
+                    $(LIBXML2_LIBS)
+
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/client/rm_ping/rm_ping_client.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/client/rm_ping/rm_ping_client.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/client/rm_ping/rm_ping_client.c (added)
+++ webservices/sandesha/trunk/c/samples/client/rm_ping/rm_ping_client.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,162 @@
+/*
+ * 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 <stdio.h>
+#include <axiom.h>
+#include <axis2_util.h>
+#include <axiom_soap.h>
+#include <axis2_client.h>
+
+axiom_node_t *
+build_om_programatically(
+    const axis2_env_t *env,
+    axis2_char_t *text);
+
+int main(int argc, char** argv)
+{
+    const axis2_env_t *env = NULL;
+    const axis2_char_t *address = NULL;
+    axis2_endpoint_ref_t* endpoint_ref = NULL;
+    axis2_options_t *options = NULL;
+    const axis2_char_t *client_home = NULL;
+    axis2_svc_client_t* svc_client = NULL;
+    axiom_node_t *payload = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    axis2_property_t *property = NULL;
+   
+    /* Set up the environment */
+    env = axis2_env_create_all("rm_ping.log", AXIS2_LOG_LEVEL_TRACE);
+
+    /* Set end point reference of echo service */
+    address = "http://localhost:9090/axis2/services/rm_ping";
+    if (argc > 1 )
+        address = argv[1];
+    if (AXIS2_STRCMP(address, "-h") == 0)
+    {
+        printf("Usage : %s [endpoint_url]\n", argv[0]);
+        printf("use -h for help\n");
+        return 0;
+    }
+    printf ("Using endpoint : %s\n", address);
+    
+    /* Create EPR with given address */
+    endpoint_ref = axis2_endpoint_ref_create(env, address);
+
+    /* Setup options */
+    options = axis2_options_create(env);
+    AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
+    /*AXIS2_OPTIONS_SET_USE_SEPARATE_LISTENER(options, env, AXIS2_TRUE);*/
+    AXIS2_OPTIONS_SET_ACTION(options, env,
+        "http://example.org/action/ping");
+
+    /* Set up deploy folder. It is from the deploy folder, the configuration is picked up 
+     * using the axis2.xml file.
+     * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
+     * be different from this folder on your system. For example, you may have a different folder 
+     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
+     * modules that the client uses
+     */
+    client_home = AXIS2_GETENV("AXIS2C_HOME");
+    if (!client_home)
+        client_home = "../../deploy";
+
+    /* Create service client */
+    svc_client = axis2_svc_client_create(env, client_home);
+    if (!svc_client)
+    {
+        printf("Error creating service client\n");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+    }
+
+    /* Set service client options */
+    AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options);    
+    
+    /* Engage addressing module */
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING);
+    
+    /* Build the SOAP request message payload using OM API.*/
+    AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, "sandesha2");
+    
+    /* Send request */
+    /*payload = build_om_programatically(env, "ping1");
+    status = AXIS2_SVC_CLIENT_SEND_ROBUST(svc_client, env, payload);
+    if(status == AXIS2_SUCCESS)
+    {
+        printf("\nping client invoke SUCCESSFUL!\n");
+    }
+    else
+    {
+      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        printf("ping client invoke FAILED!\n");
+    }
+    AXIS2_SLEEP(2);*/
+    property = axis2_property_create(env);
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_APPLICATION);
+    AXIS2_PROPERTY_SET_VALUE(property, env, AXIS2_VALUE_TRUE);
+    AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage", 
+            property);
+    payload = build_om_programatically(env, "ping2");
+    status = AXIS2_SVC_CLIENT_SEND_ROBUST(svc_client, env, payload);
+    if(status == AXIS2_SUCCESS)
+    {
+        printf("\nping client invoke SUCCESSFUL!\n");
+    }
+    else
+    {
+      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
+                  " %d :: %s", env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
+        printf("ping client invoke FAILED!\n");
+    }
+    AXIS2_SLEEP(10);
+    
+    if (svc_client)
+    {
+        AXIS2_SVC_CLIENT_FREE(svc_client, env);
+        svc_client = NULL;
+    }
+    if (endpoint_ref)
+    {
+        AXIS2_ENDPOINT_REF_FREE(endpoint_ref, env);
+        endpoint_ref = NULL;
+    }
+    return 0;
+}
+
+/* build SOAP request message content using OM */
+axiom_node_t *
+build_om_programatically(
+    const axis2_env_t *env,
+    axis2_char_t *text)
+{
+    axiom_node_t *ping_om_node = NULL;
+    axiom_element_t* ping_om_ele = NULL;
+    axiom_namespace_t *ns1 = NULL;
+    axis2_char_t *buffer = NULL;
+    
+    ns1 = axiom_namespace_create (env, "http://example.org/rm_ping", "m");
+    ping_om_ele = axiom_element_create(env, NULL, "ping", ns1, &ping_om_node);
+    AXIOM_ELEMENT_SET_TEXT(ping_om_ele, env, text, ping_om_node);
+    
+    buffer = AXIOM_NODE_TO_STRING(ping_om_node, env);
+    printf("\nSending OM node in XML : %s \n",  buffer); 
+
+    return ping_om_node;
+}

Added: webservices/sandesha/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/configure.ac?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/configure.ac (added)
+++ webservices/sandesha/trunk/c/samples/configure.ac Sat Sep  9 20:13:05 2006
@@ -0,0 +1,116 @@
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+
+AC_INIT(sandesha2-sample-src, 0.93)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE([tar-ustar])
+AC_PREFIX_DEFAULT(/usr/local/sandesha2/samples)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AM_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+dnl Checks for libraries.
+AC_CHECK_LIB(dl, dlopen)
+
+CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE"
+LDFLAGS="-lpthread"
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+
+PKG_CHECK_MODULES(LIBXML2, libxml-2.0)
+CFLAGS="$CFLAGS $LIBXML2_CFLAGS $GUTHTHILA_CFLAGS"
+
+AC_MSG_CHECKING(To Use Axis2 C AXIOM. This is a compulsory module to build Axis2 C)
+AC_ARG_WITH(axiom,
+[  --with-axiom[=PATH]      use axiom.],
+[ case "$withval" in
+  no)
+    AC_MSG_RESULT(no)
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    dnl Find axiom include dir in the path
+    if test -d $withval; then
+        axiominc="-I$withval"
+    dnl else find the axiom include dir in $(AXIS2C_HOME)/include
+    elif test -d '$(AXIS2C_HOME)/include'; then
+        axiominc="-I$(AXIS2C_HOME)/include"
+    else
+        AC_MSG_ERROR(could not find axiom. stop)
+    fi
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(To Use Axis2 C Util. This is a compulsory module to build Axis2 C)
+AC_ARG_WITH(axis2_util,
+[  --with-axis2_util[=PATH]      use axis2_util.],
+[ case "$withval" in
+  no)
+    AC_MSG_RESULT(no)
+    ;;
+  *)
+    AC_MSG_RESULT(yes)
+    dnl Find axis2_util include dir in the path
+    if test -d $withval; then
+        axis2_utilinc="-I$withval"
+    dnl else find the axis2_util include dir in $(AXIS2C_HOME)/include
+    elif test -d '$(AXIS2C_HOME)/include'; then
+        axis2_utilinc="-I$(AXIS2C_HOME)/include"
+    else
+        AC_MSG_ERROR(could not find axis2_util. stop)
+    fi
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+
+APACHE2INC=$apache2inc
+AXIOMINC=$axiominc
+UTILINC=$axis2_utilinc
+APRINC=$aprinc
+
+AC_SUBST(APACHE2INC)
+AC_SUBST(APRINC)
+AC_SUBST(AXIOMINC)
+AC_SUBST(UTILINC)
+AC_SUBST(LIBXML2_CFLAGS)
+AC_SUBST(LIBXML2_LIBS)
+AC_SUBST(LIBXML2_DIR)
+AC_SUBST(GUTHTHILA_DIR)
+AC_SUBST(GUTHTHILA_LIBS)
+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
+    ])
+    
+AC_OUTPUT

Added: webservices/sandesha/trunk/c/samples/server/rm_echo/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/server/rm_echo/Makefile.am?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/server/rm_echo/Makefile.am (added)
+++ webservices/sandesha/trunk/c/samples/server/rm_echo/Makefile.am Sat Sep  9 20:13:05 2006
@@ -0,0 +1,13 @@
+prglibdir=$(prefix)/services/rm_echo
+samplesdir=$(prefix)/samples/server/rm/rm_echo
+prglib_LTLIBRARIES = librm_echo.la
+samples_DATA=rm_echo.c rm_echo_skeleton.c rm_echo.h services.xml Makefile.am Makefile.in
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml
+noinst_HEADERS = rm_echo.h
+SUBDIRS =
+librm_echo_la_SOURCES = rm_echo.c rm_echo_skeleton.c
+librm_echo_la_LIBADD  =
+INCLUDES = -I$(AXIS2C_HOME)/include \
+			@UTILINC@ \
+			@AXIOMINC@

Added: webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.c (added)
+++ webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,114 @@
+/*
+ * 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_echo.h"
+#include <axiom_xml_writer.h>
+#include <stdio.h>
+
+axiom_node_t *
+build_om_programatically(const axis2_env_t *env, axis2_char_t *text);
+
+axiom_node_t *
+axis2_rm_echo_echo (const axis2_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 */
+    {
+        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);
+   }
+
+    text_parent_node = AXIOM_NODE_GET_FIRST_CHILD(node, 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_om_programatically(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_om_programatically(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://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;
+}
+

Added: webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.h?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.h (added)
+++ webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo.h Sat Sep  9 20:13:05 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef 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 *axis2_rm_echo_echo(const axis2_env_t *env, axiom_node_t *node);
+
+#endif /* CALC_H*/

Added: webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c (added)
+++ webservices/sandesha/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c Sat Sep  9 20:13:05 2006
@@ -0,0 +1,175 @@
+/*
+ * 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_echo.h"
+#include <axis2_array_list.h>
+
+int AXIS2_CALL
+rm_echo_free(axis2_svc_skeleton_t *svc_skeleton,
+            const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+rm_echo_free_void_arg(void *svc_skeleton,
+                    const axis2_env_t *env);
+
+/*
+ * This method invokes the right service method 
+ */
+axiom_node_t* AXIS2_CALL 
+rm_echo_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_echo_init(axis2_svc_skeleton_t *svc_skeleton,
+          const axis2_env_t *env);
+
+axiom_node_t* AXIS2_CALL
+rm_echo_on_fault(axis2_svc_skeleton_t *svc_skeli, 
+              const axis2_env_t *env, axiom_node_t *node);
+
+/*Create function */
+axis2_svc_skeleton_t *
+axis2_rm_echo_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_echo_free;
+    svc_skeleton->ops->init = rm_echo_init;
+    svc_skeleton->ops->invoke = rm_echo_invoke;
+    svc_skeleton->ops->on_fault = rm_echo_on_fault;
+
+    return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+rm_echo_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");
+    /* 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_echo_invoke(axis2_svc_skeleton_t *svc_skeleton,
+            const axis2_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.
+     */
+    return axis2_rm_echo_echo(env, node);
+}
+
+/* On fault, handle the fault */
+axiom_node_t* AXIS2_CALL
+rm_echo_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_echo_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 = axis2_rm_echo_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/server/rm_echo/services.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/server/rm_echo/services.xml?view=auto&rev=441889
==============================================================================
--- webservices/sandesha/trunk/c/samples/server/rm_echo/services.xml (added)
+++ webservices/sandesha/trunk/c/samples/server/rm_echo/services.xml Sat Sep  9 20:13:05 2006
@@ -0,0 +1,14 @@
+<service name="rm_echo">
+    <module ref="sandesha2"/>
+    <parameter name="ServiceClass" locked="xsd:false">rm_echo</parameter>
+
+   <description>
+        This is a testing service , to test 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>
+    </operation>
+
+</service>



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