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 2007/07/24 11:20:43 UTC

svn commit: r558974 - in /webservices/axis2/trunk/c: include/ src/core/engine/ src/core/receivers/ src/core/transport/http/common/ src/core/transport/http/server/IIS/ src/core/transport/http/server/apache2/ src/core/transport/http/util/

Author: sahan
Date: Tue Jul 24 02:20:43 2007
New Revision: 558974

URL: http://svn.apache.org/viewvc?view=rev&rev=558974
Log:
1. Sending a proper fault when invalid XML is recieved
2. Fixing AXIS2C-647

Modified:
    webservices/axis2/trunk/c/include/axis2_engine.h
    webservices/axis2/trunk/c/src/core/engine/engine.c
    webservices/axis2/trunk/c/src/core/receivers/svr_callback.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
    webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c
    webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c
    webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c

Modified: webservices/axis2/trunk/c/include/axis2_engine.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_engine.h?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_engine.h (original)
+++ webservices/axis2/trunk/c/include/axis2_engine.h Tue Jul 24 02:20:43 2007
@@ -117,13 +117,17 @@
      * @param env pointer to environment struct
      * @param processing_context pointer to message context representing 
      * current processing context
+     * @param code_value pointer to a string containing fault code
+     * @param reason_text pointer to a string containing reason of the fault
      * @return pointer to message context representing the fault state
      */
-    AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL
-    axis2_engine_create_fault_msg_ctx(axis2_engine_t *engine,
+    AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL                                                              
+    axis2_engine_create_fault_msg_ctx(
+        axis2_engine_t *engine,
         const axutil_env_t *env,
-        axis2_msg_ctx_t *processing_context);
-     
+        axis2_msg_ctx_t *processing_context,
+        const axis2_char_t *code_value,
+        const axis2_char_t *reason_text);
 
     /**
      * Invokes the phases in the given array list of phases. The list of 

Modified: webservices/axis2/trunk/c/src/core/engine/engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/engine.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/engine.c Tue Jul 24 02:20:43 2007
@@ -412,7 +412,9 @@
 axis2_engine_create_fault_msg_ctx(
     axis2_engine_t *engine,
     const axutil_env_t *env,
-    axis2_msg_ctx_t *processing_context)
+    axis2_msg_ctx_t *processing_context,
+    const axis2_char_t *code_value,
+    const axis2_char_t *reason_text)
 {
     axis2_msg_ctx_t *fault_ctx = NULL;
     axis2_endpoint_ref_t *fault_to = NULL;
@@ -523,13 +525,15 @@
         if ( axis2_msg_ctx_get_is_soap_11(processing_context, env))
         {
             envelope = 
-                axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
+                axiom_soap_envelope_create_default_soap_fault_envelope(env, 
+                        code_value, reason_text, AXIOM_SOAP11, NULL, NULL);
 
         }
         else
         {
             envelope = 
-                axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP12);
+                axiom_soap_envelope_create_default_soap_fault_envelope(env, 
+                        code_value, reason_text, AXIOM_SOAP12, NULL, NULL);
         }
 
         if (!envelope)

Modified: webservices/axis2/trunk/c/src/core/receivers/svr_callback.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/svr_callback.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/svr_callback.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/svr_callback.c Tue Jul 24 02:20:43 2007
@@ -103,7 +103,7 @@
         return AXIS2_FAILURE;
     }
 
-    fault_ctx = axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx);
+    fault_ctx = axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx, NULL, NULL);
     return axis2_engine_send_fault(engine, env, fault_ctx);
 }
 

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c Tue Jul 24 02:20:43 2007
@@ -30,6 +30,7 @@
 #include <axutil_uuid_gen.h>
 #include <axutil_url.h>
 #include <axutil_property.h>
+#include <axiom_soap.h>
 #include <string.h>
 
 struct axis2_http_worker
@@ -315,6 +316,7 @@
             axis2_char_t status_line_str[100];
             axutil_property_t *http_error_property = NULL;
             axis2_char_t *http_error_value = NULL;
+            axis2_char_t *fault_code = NULL;
             if (! engine)
             {
                 return AXIS2_FALSE;
@@ -327,7 +329,19 @@
                 http_error_value = (axis2_char_t *)axutil_property_get_value(
                     http_error_property, env);
 
-            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx);
+            if ( axis2_msg_ctx_get_is_soap_11 (msg_ctx, env))
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":" 
+                    AXIOM_SOAP11_FAULT_CODE_SENDER;
+            }
+            else
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":" 
+                    AXIOM_SOAP12_SOAP_FAULT_VALUE_SENDER;
+            }
+
+            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx, 
+                    fault_code, axutil_error_get_message(env->error));
             req_line = axis2_http_simple_request_get_request_line(simple_request
                 , env);
             if (req_line)

Modified: webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/IIS/axis2_iis_worker.c Tue Jul 24 02:20:43 2007
@@ -268,12 +268,26 @@
         if (status == AXIS2_FAILURE)
         {
             axis2_msg_ctx_t *fault_ctx = NULL;
+            axis2_char_t *fault_code = NULL;
             axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
             if (! engine)
             {
                 send_status =  HTTP_INTERNAL_SERVER_ERROR;
             }
-            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx);
+            if ( axis2_msg_ctx_get_is_soap_11 (msg_ctx, env))
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+                    AXIOM_SOAP11_FAULT_CODE_SENDER;
+            }
+            else
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+                    AXIOM_SOAP12_SOAP_FAULT_VALUE_SENDER;
+            }
+
+            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx,
+                    fault_code, axutil_error_get_message(env->error));
+
             axis2_engine_send_fault(engine, env, fault_ctx);
             if (out_stream)
             {

Modified: webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c Tue Jul 24 02:20:43 2007
@@ -226,12 +226,24 @@
         if (status == AXIS2_FAILURE)
         {
             axis2_msg_ctx_t *fault_ctx = NULL;
+            axis2_char_t *fault_code = NULL;
             axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
             if (! engine)
             {
                 send_status =  HTTP_INTERNAL_SERVER_ERROR;
             }
-            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx);
+            if ( axis2_msg_ctx_get_is_soap_11 (msg_ctx, env))
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+                    AXIOM_SOAP11_FAULT_CODE_SENDER;
+            }
+            else
+            {
+                fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+                    AXIOM_SOAP12_SOAP_FAULT_VALUE_SENDER;
+            }
+            fault_ctx =  axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx,
+                    fault_code, axutil_error_get_message(env->error));
             axis2_engine_send_fault(engine, env, fault_ctx);
             if (out_stream)
             {

Modified: webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c?view=diff&rev=558974&r1=558973&r2=558974
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c Tue Jul 24 02:20:43 2007
@@ -327,6 +327,7 @@
 
     if (! xml_reader)
     {
+        printf("Here 1\n");
         return AXIS2_FAILURE;
     }
 
@@ -337,6 +338,7 @@
     {
         axiom_xml_reader_free(xml_reader, env);
         xml_reader = NULL;
+        printf("Here 2\n");
         return AXIS2_FAILURE;
     }
 
@@ -352,6 +354,7 @@
             /*axiom_stax_builder_free(om_builder, env);*/
             om_builder = NULL;
             xml_reader = NULL;
+            printf("Here 3\n");
             return AXIS2_FAILURE;
         }
 
@@ -364,6 +367,7 @@
             xml_reader = NULL;
             axiom_soap_builder_free(soap_builder, env);
             soap_builder = NULL;
+            printf("Here 4\n");
             return AXIS2_FAILURE;
         }
     }



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