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 di...@apache.org on 2007/11/21 11:01:51 UTC

svn commit: r597014 [1/2] - in /webservices/axis2/trunk/c/src/core: clientapi/op_client.c clientapi/svc_client.c context/msg_ctx.c transport/http/sender/http_sender.c

Author: dinesh
Date: Wed Nov 21 02:01:51 2007
New Revision: 597014

URL: http://svn.apache.org/viewvc?rev=597014&view=rev
Log:
imporoved fault handling REST

Modified:
    webservices/axis2/trunk/c/src/core/clientapi/op_client.c
    webservices/axis2/trunk/c/src/core/clientapi/svc_client.c
    webservices/axis2/trunk/c/src/core/context/msg_ctx.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c

Modified: webservices/axis2/trunk/c/src/core/clientapi/op_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/op_client.c?rev=597014&r1=597013&r2=597014&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/op_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/op_client.c Wed Nov 21 02:01:51 2007
@@ -1166,6 +1166,8 @@
     /* If request is REST we assume the response is REST, so set the variable */
     axis2_msg_ctx_set_doing_rest(response, env,
                                  axis2_msg_ctx_get_doing_rest(msg_ctx, env));
+    axis2_msg_ctx_set_status_code (response, env, 
+                                   axis2_msg_ctx_get_status_code (msg_ctx, env));
     /* set response envelope */
     if (engine)
     {

Modified: webservices/axis2/trunk/c/src/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/svc_client.c?rev=597014&r1=597013&r2=597014&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/svc_client.c Wed Nov 21 02:01:51 2007
@@ -637,6 +637,11 @@
     axis2_char_t *action_str = NULL;
     axis2_bool_t qname_free_flag = AXIS2_FALSE;
 
+    axis2_msg_ctx_t *res_msg_ctx = NULL;
+    axis2_msg_ctx_t *msg_ctx = NULL;
+
+
+
     AXIS2_ENV_CHECK(env, NULL);
 
     svc_client->last_response_soap_envelope = NULL;
@@ -768,9 +773,6 @@
     }
     else
     {
-        axis2_msg_ctx_t *res_msg_ctx = NULL;
-        axis2_msg_ctx_t *msg_ctx = NULL;
-
         msg_ctx = axis2_msg_ctx_create(env,
                                        axis2_svc_ctx_get_conf_ctx(svc_client->
                                                                   svc_ctx, env),
@@ -799,7 +801,8 @@
         }
         else
         {
-            axis2_op_client_add_msg_ctx(svc_client->op_client, env, res_msg_ctx);   /* set in msg_ctx to be NULL to reset */
+            axis2_op_client_add_msg_ctx(svc_client->op_client, env, res_msg_ctx);   
+            /* set in msg_ctx to be NULL to reset */
         }
     }
 
@@ -836,8 +839,23 @@
         return NULL;
     }
 
-    svc_client->last_response_has_fault =
-        axiom_soap_body_has_fault(soap_body, env);
+    if (axis2_msg_ctx_get_doing_rest (res_msg_ctx, env))
+    {
+        if (axis2_msg_ctx_get_status_code (res_msg_ctx, env) ==
+            AXIS2_HTTP_RESPONSE_INTERNAL_SERVER_ERROR_CODE_VAL)
+        {
+            svc_client->last_response_has_fault = AXIS2_TRUE;
+        }
+        else
+        {
+            svc_client->last_response_has_fault = AXIS2_FALSE;
+        }
+    }
+    else
+    {
+        svc_client->last_response_has_fault =
+            axiom_soap_body_has_fault(soap_body, env);
+    }
 
     if (AXIOM_SOAP11 ==
         axiom_soap_envelope_get_soap_version(soap_envelope, env))

Modified: webservices/axis2/trunk/c/src/core/context/msg_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/context/msg_ctx.c?rev=597014&r1=597013&r2=597014&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/src/core/context/msg_ctx.c Wed Nov 21 02:01:51 2007
@@ -116,6 +116,10 @@
     /** Rest through HTTP POST? */
     axis2_bool_t do_rest_through_post;
 
+    /* http status code */
+
+    unsigned int status_code;
+
     /** use SOAP 1.1? */
     axis2_bool_t is_soap_11;
 
@@ -2034,5 +2038,25 @@
         return AXIS2_FAILURE;
     }
 
+    return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN int AXIS2_CALL
+axis2_msg_ctx_get_status_code(
+    axis2_msg_ctx_t * msg_ctx,
+    const axutil_env_t * env)
+{
+    return msg_ctx->status_code;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_msg_ctx_set_status_code(
+    axis2_msg_ctx_t * msg_ctx,
+    const axutil_env_t * env,
+    const int status_code)
+{
+    msg_ctx->status_code = status_code;
     return AXIS2_SUCCESS;
 }



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