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 sa...@apache.org on 2006/04/19 13:29:24 UTC

svn commit: r395213 - in /webservices/axis2/trunk/c/modules: core/engine/engine.c core/receivers/msg_recv.c core/transport/http/sender/http_transport_sender.c core/util/core_utils.c mod_addr/addr_out_handler.c

Author: samisa
Date: Wed Apr 19 04:29:23 2006
New Revision: 395213

URL: http://svn.apache.org/viewcvs?rev=395213&view=rev
Log:
More fault related changes.
Now it sends 500 in case of fault

Modified:
    webservices/axis2/trunk/c/modules/core/engine/engine.c
    webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
    webservices/axis2/trunk/c/modules/core/util/core_utils.c
    webservices/axis2/trunk/c/modules/mod_addr/addr_out_handler.c

Modified: webservices/axis2/trunk/c/modules/core/engine/engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/engine.c?rev=395213&r1=395212&r2=395213&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Wed Apr 19 04:29:23 2006
@@ -338,6 +338,7 @@
     axis2_op_t *op = NULL;
     axis2_array_list_t *pre_calculated_phases = NULL;
     axis2_array_list_t *op_specific_phases = NULL;
+    axis2_soap_envelope_t *soap_envelope = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -422,10 +423,34 @@
             AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, "Message receiver not set in operation description");
             return AXIS2_FAILURE;
         }
-        AXIS2_MSG_RECV_RECEIVE(receiver, env, msg_ctx, receiver->derived);        
+        status = AXIS2_MSG_RECV_RECEIVE(receiver, env, msg_ctx, receiver->derived);        
+    }
+    else
+    {
+        status = AXIS2_SUCCESS;
     }
     AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, "Axis2 engine receive successful");
-    return AXIS2_SUCCESS;
+
+    /*soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE (msg_ctx, env);
+    if (soap_envelope)
+    {
+        axis2_soap_body_t *body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
+        if (body)
+        {
+            /* in case of a SOAP fault, we got to return failure so that 
+               transport gets to know that it should send 500 */
+      /*      if (AXIS2_SOAP_BODY_HAS_FAULT(body, env))
+            {
+                status = AXIS2_FAILURE;
+                AXIS2_MSG_CTX_SET_FAULT_SOAP_ENVELOPE(msg_ctx, env, soap_envelope);
+            }
+            else
+            {
+                status = AXIS2_SUCCESS;
+            }
+        }
+    }*/
+    return status;
 }
 
 /**
@@ -572,6 +597,7 @@
     axis2_msg_ctx_t *fault_ctx = NULL;
     axis2_engine_impl_t *engine_impl = NULL;
     axis2_endpoint_ref_t *fault_to = NULL;
+    axis2_endpoint_ref_t *reply_to = NULL;
     axis2_property_t *property = NULL;
     axis2_soap_envelope_t *envelope = NULL;
     axis2_char_t *wsa_action = NULL;
@@ -600,9 +626,32 @@
     fault_to = AXIS2_MSG_CTX_GET_FAULT_TO(processing_context, env);
     if (fault_to)
     {
-        AXIS2_MSG_CTX_SET_FAULT_TO(fault_ctx, env, fault_to);
+        axis2_char_t *address = AXIS2_ENDPOINT_REF_GET_ADDRESS(fault_to, env);
+        if (!address)
+        {
+            fault_to = NULL;
+        }
+        else if (AXIS2_STRCMP(AXIS2_WSA_NONE_URL, address) == 0 ||
+            AXIS2_STRCMP(AXIS2_WSA_NONE_URL_SUBMISSION, address) == 0)
+        {
+            reply_to = AXIS2_MSG_CTX_GET_REPLY_TO(processing_context, env);
+            if (reply_to)
+            {
+               AXIS2_MSG_CTX_SET_FAULT_TO(fault_ctx, env, reply_to); 
+            }
+            else
+            {
+                AXIS2_MSG_CTX_SET_FAULT_TO(fault_ctx, env, fault_to);
+            }
+        }
+        else
+        {
+            AXIS2_MSG_CTX_SET_FAULT_TO(fault_ctx, env, fault_to);
+        }
+        
     }
-    else
+    
+    if (!fault_to)
     {
         property = AXIS2_MSG_CTX_GET_PROPERTY(processing_context, env, 
                 AXIS2_TRANSPORT_OUT, AXIS2_FALSE);

Modified: webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c?rev=395213&r1=395212&r2=395213&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c (original)
+++ webservices/axis2/trunk/c/modules/core/receivers/msg_recv.c Wed Apr 19 04:29:23 2006
@@ -23,6 +23,8 @@
 #include <axis2_engine.h>
 #include <axis2_core_utils.h>
 #include <axis2_property.h>
+#include <axis2_soap_envelope.h>
+#include <axis2_soap_body.h>
 
 /** 
  * @brief Message Receiver struct impl
@@ -420,11 +422,30 @@
         AXIS2_MSG_CTX_FREE(out_msg_ctx, env);
         return AXIS2_FAILURE;
     }       
-    if (AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(out_msg_ctx, env) || AXIS2_ERROR_GET_STATUS_CODE((*env)->error) != AXIS2_SUCCESS )
+    if (AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(out_msg_ctx, env))
     {
-        /* if it is two way or if there is a fault then send through engine.
-           if it is one way we do not need to do an engine send */
-        status = AXIS2_ENGINE_SEND(engine, env, out_msg_ctx);
+        axis2_soap_envelope_t *soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE (out_msg_ctx, env);
+        if (soap_envelope)
+        {
+            axis2_soap_body_t *body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
+            if (body)
+            {
+                /* in case of a SOAP fault, we got to return failure so that 
+                   transport gets to know that it should send 500 */
+                if (AXIS2_SOAP_BODY_HAS_FAULT(body, env))
+                {
+                    status = AXIS2_FAILURE;
+                    AXIS2_MSG_CTX_SET_FAULT_SOAP_ENVELOPE(msg_ctx, env, soap_envelope);
+                    AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(out_msg_ctx, env, NULL);
+                }
+                else
+                {
+                    /* if it is two way and not a fault then send through engine.
+                       if it is one way we do not need to do an engine send */
+                    status = AXIS2_ENGINE_SEND(engine, env, out_msg_ctx);
+                }
+            }
+        }
     }
     AXIS2_ENGINE_FREE(engine, env);
     axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c?rev=395213&r1=395212&r2=395213&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c Wed Apr 19 04:29:23 2006
@@ -255,10 +255,19 @@
     }
 	if(NULL != epr)
 	{
-		axis2_http_transport_sender_write_message(transport_sender, env, msg_ctx
+        if (AXIS2_STRCMP(AXIS2_WSA_NONE_URL_SUBMISSION, AXIS2_ENDPOINT_REF_GET_ADDRESS(epr, env)) == 0 || 
+                AXIS2_STRCMP(AXIS2_WSA_NONE_URL, AXIS2_ENDPOINT_REF_GET_ADDRESS(epr, env)) ==0 )
+        {
+            epr = NULL;
+        }
+        else
+        {
+    		axis2_http_transport_sender_write_message(transport_sender, env, msg_ctx
 							, epr, soap_data_out, om_output);
+        }    
 	}
-	else
+	
+    if (!epr)
 	{
 		axis2_stream_t *out_stream = NULL;
         

Modified: webservices/axis2/trunk/c/modules/core/util/core_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/util/core_utils.c?rev=395213&r1=395212&r2=395213&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/util/core_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/util/core_utils.c Wed Apr 19 04:29:23 2006
@@ -83,6 +83,19 @@
     }
     reply_to = AXIS2_MSG_INFO_HEADERS_GET_REPLY_TO(old_msg_info_headers, env);
     AXIS2_MSG_INFO_HEADERS_SET_TO(msg_info_headers, env, reply_to);
+    /*if (reply_to)
+    {
+        axis2_endpoint_ref_t *epr = NULL;
+        axis2_char_t *address = NULL;
+
+        address = AXIS2_ENDPOINT_REF_GET_ADDRESS (endpoint_ref, env);
+        if (address)
+        {
+            epr = axis2_endpoint_ref_create (env, address);
+            AXIS2_MSG_INFO_HEADERS_SET_REPLY_TO(msg_info_headers, env, epr);
+        }
+    }*/
+        
     
     fault_to = AXIS2_MSG_INFO_HEADERS_GET_FAULT_TO(old_msg_info_headers, env);
     AXIS2_MSG_INFO_HEADERS_SET_FAULT_TO(msg_info_headers, env, fault_to);

Modified: webservices/axis2/trunk/c/modules/mod_addr/addr_out_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/mod_addr/addr_out_handler.c?rev=395213&r1=395212&r2=395213&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/mod_addr/addr_out_handler.c (original)
+++ webservices/axis2/trunk/c/modules/mod_addr/addr_out_handler.c Wed Apr 19 04:29:23 2006
@@ -261,7 +261,15 @@
                     axis2_endpoint_ref_t *fault_epr = AXIS2_MSG_INFO_HEADERS_GET_FAULT_TO (msg_info_headers, env); 
                     if (fault_epr)
                     {
-                        AXIS2_ENDPOINT_REF_SET_ADDRESS (epr, env, AXIS2_ENDPOINT_REF_GET_ADDRESS (fault_epr, env));
+                        axis2_char_t *fault_address = AXIS2_ENDPOINT_REF_GET_ADDRESS(fault_epr, env);
+                        if (fault_address)
+                        {
+                            if (AXIS2_STRCMP(AXIS2_WSA_NONE_URL, fault_address) != 0 &&
+                                    AXIS2_STRCMP(AXIS2_WSA_NONE_URL_SUBMISSION, fault_address) != 0)
+                            {
+                                AXIS2_ENDPOINT_REF_SET_ADDRESS (epr, env, fault_address);
+                            }
+                        }
                     }
                 }
             }