You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/09/04 10:12:08 UTC
svn commit: r572570 - in /webservices/axis2/trunk/c/samples/server/echo:
echo.c echo_skeleton.c
Author: samisa
Date: Tue Sep 4 01:12:06 2007
New Revision: 572570
URL: http://svn.apache.org/viewvc?rev=572570&view=rev
Log:
Added code to show how toset custom faults
Modified:
webservices/axis2/trunk/c/samples/server/echo/echo.c
webservices/axis2/trunk/c/samples/server/echo/echo_skeleton.c
Modified: webservices/axis2/trunk/c/samples/server/echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/echo/echo.c?rev=572570&r1=572569&r2=572570&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/server/echo/echo.c (original)
+++ webservices/axis2/trunk/c/samples/server/echo/echo.c Tue Sep 4 01:12:06 2007
@@ -21,6 +21,8 @@
axiom_node_t *
build_om_programatically(const axutil_env_t *env, axis2_char_t *text);
+void set_custom_error(const axutil_env_t *env, axis2_char_t *error_message);
+
axiom_node_t *
axis2_echo_echo(const axutil_env_t *env, axiom_node_t *node)
{
@@ -37,24 +39,21 @@
*/
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");
+ set_custom_error(env, "Invalid payload; echoString node is NULL");
return NULL;
}
text_parent_node = axiom_node_get_first_element(node, env);
if (!text_parent_node)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
- printf("Echo client ERROR 1: invalid XML in request\n");
+ set_custom_error(env, "Invalid payload; text node is NULL");
return NULL;
}
text_node = axiom_node_get_first_child(text_parent_node, env);
if (!text_node) /* actual text to echo */
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
- printf("Echo client ERROR 2: invalid XML in request\n");
+ set_custom_error(env, "Invalid payload; text to be echoed is NULL");
return NULL;
}
@@ -64,14 +63,12 @@
if (text && axiom_text_get_value(text , env))
{
axis2_char_t *text_str = (axis2_char_t *)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 3: invalid XML in request\n");
+ set_custom_error(env, "Invalid payload; invalid XML in request");
return NULL;
}
@@ -95,7 +92,9 @@
return echo_om_node;
}
-
-
-
+void set_custom_error(const axutil_env_t *env, axis2_char_t *error_message)
+{
+ axutil_error_set_error_message(env->error, error_message);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_LAST + 1, AXIS2_FAILURE);
+}
Modified: webservices/axis2/trunk/c/samples/server/echo/echo_skeleton.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/server/echo/echo_skeleton.c?rev=572570&r1=572569&r2=572570&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/server/echo/echo_skeleton.c (original)
+++ webservices/axis2/trunk/c/samples/server/echo/echo_skeleton.c Tue Sep 4 01:12:06 2007
@@ -102,11 +102,10 @@
* 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, NULL, "EchoServiceError", NULL, &error_node);
- axiom_element_set_text(error_ele, env, "Echo service failed ", text_node);
+ axiom_element_set_text(error_ele, env, "Echo service failed ", error_node);
return error_node;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org