You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2006/09/08 13:13:17 UTC
svn commit: r441475 - in /webservices/axis2/trunk/c/samples: ./ client/
client/rm_echo/ client/rm_ping/ server/ server/rm_echo/ server/rm_ping/
Author: damitha
Date: Fri Sep 8 04:13:16 2006
New Revision: 441475
URL: http://svn.apache.org/viewvc?view=rev&rev=441475
Log:
Added rm samples
Added:
webservices/axis2/trunk/c/samples/client/rm_echo/
webservices/axis2/trunk/c/samples/client/rm_echo/Makefile.am
webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.c
webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.h
webservices/axis2/trunk/c/samples/client/rm_echo/rm_echo_client.c
webservices/axis2/trunk/c/samples/client/rm_ping/
webservices/axis2/trunk/c/samples/client/rm_ping/Makefile.am
webservices/axis2/trunk/c/samples/client/rm_ping/rm_ping_client.c
webservices/axis2/trunk/c/samples/server/rm_echo/
webservices/axis2/trunk/c/samples/server/rm_echo/Makefile.am
webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.c
webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.h
webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c
webservices/axis2/trunk/c/samples/server/rm_echo/services.xml
webservices/axis2/trunk/c/samples/server/rm_ping/
webservices/axis2/trunk/c/samples/server/rm_ping/Makefile.am
webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.c
webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.h
webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping_skeleton.c
webservices/axis2/trunk/c/samples/server/rm_ping/services.xml
Modified:
webservices/axis2/trunk/c/samples/client/Makefile.am
webservices/axis2/trunk/c/samples/configure.ac
webservices/axis2/trunk/c/samples/server/Makefile.am
Modified: webservices/axis2/trunk/c/samples/client/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/Makefile.am?view=diff&rev=441475&r1=441474&r2=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/Makefile.am (original)
+++ webservices/axis2/trunk/c/samples/client/Makefile.am Fri Sep 8 04:13:16 2006
@@ -1,4 +1,4 @@
clientdir=$(prefix)/samples/client
-SUBDIRS = echo math google notify mtom dynamic_client
+SUBDIRS = echo math google notify mtom dynamic_client rm_ping rm_echo
client_DATA = Makefile.am Makefile.in
EXTRA_DIST= Makefile.am
Added: webservices/axis2/trunk/c/samples/client/rm_echo/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_echo/Makefile.am?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_echo/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/client/rm_echo/Makefile.am Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/client/rm_echo/echo_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.c (added)
+++ webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.c Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/client/rm_echo/echo_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.h?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.h (added)
+++ webservices/axis2/trunk/c/samples/client/rm_echo/echo_util.h Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/client/rm_echo/rm_echo_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_echo/rm_echo_client.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_echo/rm_echo_client.c (added)
+++ webservices/axis2/trunk/c/samples/client/rm_echo/rm_echo_client.c Fri Sep 8 04:13:16 2006
@@ -0,0 +1,233 @@
+/*
+ * 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);
+
+ /* Create the callback object with default on_complete and on_error
+ callback functions */
+ callback1 = axis2_callback_create(env);
+
+ /* Set our on_complete fucntion pointer to the callback object */
+ AXIS2_CALLBACK_SET_ON_COMPLETE(callback1, rm_echo_callback_on_complete);
+
+ /* Set our on_error function pointer to the callback object */
+ AXIS2_CALLBACK_SET_ON_ERROR(callback1, rm_echo_callback_on_error);
+
+
+ AXIS2_OPTIONS_SET_PROPERTY(options, env, "Sandesha2LastMessage",
+ property);
+ /* Send request */
+ AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env,
+ payload, callback1);
+ /*
+ op_qname = axis2_qname_create(env, "echoString", NULL, NULL);
+ AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING_WITH_OP_QNAME(svc_client,
+ env, op_qname, payload, callback1);
+ */
+ /*callback2 = axis2_callback_create(env);
+ AXIS2_CALLBACK_SET_ON_COMPLETE(callback2, rm_echo_callback_on_complete);
+ 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);
+ 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/axis2/trunk/c/samples/client/rm_ping/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_ping/Makefile.am?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_ping/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/client/rm_ping/Makefile.am Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/client/rm_ping/rm_ping_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/rm_ping/rm_ping_client.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/client/rm_ping/rm_ping_client.c (added)
+++ webservices/axis2/trunk/c/samples/client/rm_ping/rm_ping_client.c Fri Sep 8 04:13:16 2006
@@ -0,0 +1,136 @@
+/*
+ * 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);
+
+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;
+
+ /* Set up the environment */
+ env = axis2_env_create_all("rm_notify.log", AXIS2_LOG_LEVEL_TRACE);
+
+ /* Set end point reference of echo service */
+ address = "http://localhost:9090/axis2/services/rm_notify";
+ 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_ACTION(options, env,
+ "http://example.org/action/notify");
+
+ /* 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.*/
+ payload = build_om_programatically(env);
+
+ /* Send request */
+ status = AXIS2_SVC_CLIENT_SEND_ROBUST(svc_client, env, payload);
+
+ if(status == AXIS2_SUCCESS)
+ {
+ printf("\nnotify 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("notify client invoke FAILED!\n");
+ }
+
+ 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)
+{
+ axiom_node_t *notify_om_node = NULL;
+ axiom_element_t* notify_om_ele = NULL;
+ axiom_namespace_t *ns1 = NULL;
+ axis2_char_t *buffer = NULL;
+
+ ns1 = axiom_namespace_create (env, "http://example.org/rm_notify", "m");
+ notify_om_ele = axiom_element_create(env, NULL, "notify", ns1, ¬ify_om_node);
+ AXIOM_ELEMENT_SET_TEXT(notify_om_ele, env, "notify5", notify_om_node);
+
+ buffer = AXIOM_NODE_TO_STRING(notify_om_node, env);
+ printf("\nSending OM node in XML : %s \n", buffer);
+
+ return notify_om_node;
+}
Modified: webservices/axis2/trunk/c/samples/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/configure.ac?view=diff&rev=441475&r1=441474&r2=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/configure.ac (original)
+++ webservices/axis2/trunk/c/samples/configure.ac Fri Sep 8 04:13:16 2006
@@ -125,6 +125,8 @@
server/notify/Makefile \
server/sg_math/Makefile \
server/mtom/Makefile \
+ server/rm_ping/Makefile \
+ server/rm_echo/Makefile \
client/Makefile \
client/echo/Makefile \
client/math/Makefile \
@@ -133,6 +135,8 @@
client/mtom/resources/Makefile \
client/notify/Makefile \
client/google/Makefile \
+ client/rm_ping/Makefile \
+ client/rm_echo/Makefile \
user_guide/Makefile \
user_guide/clients/Makefile \
])
Modified: webservices/axis2/trunk/c/samples/server/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/Makefile.am?view=diff&rev=441475&r1=441474&r2=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/Makefile.am (original)
+++ webservices/axis2/trunk/c/samples/server/Makefile.am Fri Sep 8 04:13:16 2006
@@ -1,5 +1,5 @@
samplesdir=$(prefix)/samples/server
-SUBDIRS = echo math notify sg_math mtom Calculator
+SUBDIRS = echo math notify sg_math mtom Calculator rm_ping rm_echo
EXTRA_DIST = axis2.xml axis2.log
samples_DATA= axis2.log axis2.xml Makefile.am Makefile.in
Added: webservices/axis2/trunk/c/samples/server/rm_echo/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_echo/Makefile.am?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_echo/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/server/rm_echo/Makefile.am Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/server/rm_echo/rm_echo.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.c (added)
+++ webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.c Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/server/rm_echo/rm_echo.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.h?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.h (added)
+++ webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo.h Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/rm_echo/rm_echo_skeleton.c Fri Sep 8 04:13:16 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/axis2/trunk/c/samples/server/rm_echo/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_echo/services.xml?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_echo/services.xml (added)
+++ webservices/axis2/trunk/c/samples/server/rm_echo/services.xml Fri Sep 8 04:13:16 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>
Added: webservices/axis2/trunk/c/samples/server/rm_ping/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_ping/Makefile.am?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_ping/Makefile.am (added)
+++ webservices/axis2/trunk/c/samples/server/rm_ping/Makefile.am Fri Sep 8 04:13:16 2006
@@ -0,0 +1,13 @@
+prglibdir=$(prefix)/services/rm_ping
+samplesdir=$(prefix)/samples/server/rm_ping
+prglib_LTLIBRARIES = librm_ping.la
+samples_DATA=rm_ping.c rm_ping_skeleton.c rm_ping.h services.xml Makefile.am Makefile.in
+prglib_DATA= services.xml
+EXTRA_DIST = services.xml
+noinst_HEADERS = rm_ping.h
+SUBDIRS =
+librm_ping_la_SOURCES = rm_ping.c rm_ping_skeleton.c
+librm_ping_la_LIBADD =
+INCLUDES = -I$(AXIS2C_HOME)/include \
+ @UTILINC@ \
+ @AXIOMINC@
Added: webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.c (added)
+++ webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.c Fri Sep 8 04:13:16 2006
@@ -0,0 +1,64 @@
+/*
+ * 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_ping.h"
+#include <stdio.h>
+
+void
+axis2_rm_ping_notify (const axis2_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);
+ printf("Echo client ERROR: input parameter NULL\n");
+ return;
+ }
+
+ text_node = AXIOM_NODE_GET_FIRST_CHILD(node, env);
+ if (!node) /* actual text to notify */
+ {
+ 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("Notification received : %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/axis2/trunk/c/samples/server/rm_ping/rm_ping.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.h?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.h (added)
+++ webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping.h Fri Sep 8 04:13:16 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>
+
+void axis2_rm_ping_notify(const axis2_env_t *env, axiom_node_t *node);
+
+#endif /* CALC_H*/
Added: webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping_skeleton.c?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping_skeleton.c (added)
+++ webservices/axis2/trunk/c/samples/server/rm_ping/rm_ping_skeleton.c Fri Sep 8 04:13:16 2006
@@ -0,0 +1,177 @@
+/*
+ * 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_ping.h"
+#include <axis2_array_list.h>
+
+int AXIS2_CALL
+rm_ping_free(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+rm_ping_free_void_arg(void *svc_skeleton,
+ const axis2_env_t *env);
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+rm_ping_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_ping_init(axis2_svc_skeleton_t *svc_skeleton,
+ const axis2_env_t *env);
+
+axiom_node_t* AXIS2_CALL
+rm_ping_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_ping_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_ping_free;
+ svc_skeleton->ops->init = rm_ping_init;
+ svc_skeleton->ops->invoke = rm_ping_invoke;
+ svc_skeleton->ops->on_fault = rm_ping_on_fault;
+
+ return svc_skeleton;
+}
+
+/* Initialize the service */
+int AXIS2_CALL
+rm_ping_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, "ping");
+ /* Any initialization stuff of ping service should go here */
+ return AXIS2_SUCCESS;
+}
+
+/*
+ * This method invokes the right service method
+ */
+axiom_node_t* AXIS2_CALL
+rm_ping_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 ping in this sample, hence invoke ping method.
+ * To see how to deal with multiple impl methods, have a look at the
+ * math sample.
+ */
+ axis2_rm_ping_ping(env, node);
+ return NULL;
+}
+
+/* On fault, handle the fault */
+axiom_node_t* AXIS2_CALL
+rm_ping_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_ping_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_ping_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/axis2/trunk/c/samples/server/rm_ping/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/rm_ping/services.xml?view=auto&rev=441475
==============================================================================
--- webservices/axis2/trunk/c/samples/server/rm_ping/services.xml (added)
+++ webservices/axis2/trunk/c/samples/server/rm_ping/services.xml Fri Sep 8 04:13:16 2006
@@ -0,0 +1,13 @@
+<service name="rm_ping">
+ <parameter name="ServiceClass" locked="xsd:false">rm_ping</parameter>
+
+ <description>
+ This is a testing service , to test one way service support
+ </description>
+
+ <operation name="ping">
+ <!--messageReceiver class="axis2_receivers" /-->
+ <parameter name="wsamapping" >http://example.org/action/ping</parameter>
+ </operation>
+
+</service>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org