You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ma...@apache.org on 2007/08/15 13:14:52 UTC

svn commit: r566103 - /webservices/rampart/trunk/c/samples/client/sec_echo/echo.c

Author: manjula
Date: Wed Aug 15 04:14:51 2007
New Revision: 566103

URL: http://svn.apache.org/viewvc?view=rev&rev=566103
Log:
Modified fault handling logic.

Modified:
    webservices/rampart/trunk/c/samples/client/sec_echo/echo.c

Modified: webservices/rampart/trunk/c/samples/client/sec_echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/client/sec_echo/echo.c?view=diff&rev=566103&r1=566102&r2=566103
==============================================================================
--- webservices/rampart/trunk/c/samples/client/sec_echo/echo.c (original)
+++ webservices/rampart/trunk/c/samples/client/sec_echo/echo.c Wed Aug 15 04:14:51 2007
@@ -132,36 +132,43 @@
     /* Send request */
     ret_node = axis2_svc_client_send_receive(svc_client, env, payload);
 
-    if (ret_node){
+    if (axis2_svc_client_get_last_response_has_fault(svc_client, env))
+    {
+        axiom_soap_envelope_t *soap_envelope = NULL;
+        axiom_soap_body_t *soap_body = NULL;
+        axiom_soap_fault_t *soap_fault = NULL;
+
+        printf ("\nResponse has a SOAP fault\n");
+        soap_envelope =
+            axis2_svc_client_get_last_response_soap_envelope(svc_client, env);
+        if (soap_envelope)
+            soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+        if (soap_body)
+            soap_fault = axiom_soap_body_get_fault(soap_body, env);
+        if (soap_fault)
+        {
+            printf("\nReturned SOAP fault: %s\n",
+            axiom_node_to_string(axiom_soap_fault_get_base_node(soap_fault,env),
+                env));
+        }
+            printf("echo client invoke FAILED!\n");
+            return -1;
+    }
+    
+    if (ret_node)
+    {
         axis2_char_t *om_str = NULL;
         om_str = axiom_node_to_string(ret_node, env);
-        if (om_str){
+        if (om_str)
+        {
             printf("\nReceived OM : %s\n", om_str);
         }
         printf("\necho client invoke SUCCESSFUL!\n");
-    }else{
-        if (axis2_svc_client_get_last_response_has_fault(svc_client, env))
-        {
-            axiom_soap_envelope_t *soap_envelope = NULL;
-            axiom_soap_body_t *soap_body = NULL;
-            axiom_soap_fault_t *soap_fault = NULL;
-
-            printf ("\nResponse has a SOAP fault\n");
-            soap_envelope =
-                axis2_svc_client_get_last_response_soap_envelope(svc_client, env);
-            if (soap_envelope)
-                soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-            if (soap_body)
-                soap_fault = axiom_soap_body_get_fault(soap_body, env);
-            if (soap_fault)
-            {
-                printf("\nReturned SOAP fault: %s\n",
-                    axiom_node_to_string(axiom_soap_fault_get_base_node(soap_fault,env),
-                    env));
-            }
-            return -1;
-        }
+    }
+    else
+    {
         printf("echo client invoke FAILED!\n");
+        return -1;
     }
 
     if (svc_client)