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 09:40:41 UTC

svn commit: r596988 - in /webservices/axis2/trunk/c/src/core: engine/disp_checker.c engine/engine.c transport/http/common/http_worker.c transport/http/sender/http_transport_sender.c transport/http/util/http_transport_utils.c

Author: dinesh
Date: Wed Nov 21 00:40:40 2007
New Revision: 596988

URL: http://svn.apache.org/viewvc?rev=596988&view=rev
Log:
fixed:axis2c-777, getting soapfaults while processing rest messages

Modified:
    webservices/axis2/trunk/c/src/core/engine/disp_checker.c
    webservices/axis2/trunk/c/src/core/engine/engine.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c
    webservices/axis2/trunk/c/src/core/transport/http/util/http_transport_utils.c

Modified: webservices/axis2/trunk/c/src/core/engine/disp_checker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/disp_checker.c?rev=596988&r1=596987&r2=596988&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/disp_checker.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/disp_checker.c Wed Nov 21 00:40:40 2007
@@ -173,6 +173,9 @@
     int soap_version = AXIOM_SOAP12;
     axis2_char_t *fault_code = NULL;
 
+    axis2_char_t exception[1024];
+    axis2_char_t *wsa_action;
+
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
@@ -209,7 +212,9 @@
     endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
 
     if (endpoint_ref)
+    {
         address = axis2_endpoint_ref_get_address(endpoint_ref, env);
+    }
 
     svc = axis2_msg_ctx_get_svc(msg_ctx, env);
     if (!svc)
@@ -239,6 +244,13 @@
             axiom_soap_fault_create_default_fault(env, soap_body, fault_code,
                                                   "Service Not Found",
                                                   soap_version);
+
+        wsa_action = (axis2_char_t *)axis2_msg_ctx_get_wsa_action (msg_ctx, 
+                                                                   env);
+        sprintf (exception, "Service Not Found, Endpoint referance address is %s and wsa\
+ actions is %s", address, wsa_action);
+
+        axiom_soap_fault_set_exception (soap_fault, env, exception);
         axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
         return AXIS2_FAILURE;
     }
@@ -262,6 +274,8 @@
                 AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
                 AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
         }
+
+
         soap_envelope =
             axiom_soap_envelope_create_default_soap_envelope(env, soap_version);
         soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
@@ -269,6 +283,13 @@
             axiom_soap_fault_create_default_fault(env, soap_body, fault_code,
                                                   "Operation Not Found",
                                                   soap_version);
+
+        wsa_action = (axis2_char_t *)axis2_msg_ctx_get_wsa_action (msg_ctx, 
+                                                                   env);
+        sprintf (exception, "Operation Not Found, Endpoint referance address is %s and wsa\
+ actions is %s", address, wsa_action);
+
+        axiom_soap_fault_set_exception (soap_fault, env, exception);
         axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
         return AXIS2_FAILURE;
     }

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?rev=596988&r1=596987&r2=596988&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/engine.c Wed Nov 21 00:40:40 2007
@@ -407,39 +407,6 @@
         }
     }
 
-    /*if (!( axis2_msg_ctx_is_paused(msg_ctx, env)))
-       {
-       axis2_conf_ctx_t *conf_ctx = NULL;
-       axis2_transport_sender_t *transport_sender = NULL;
-       axis2_transport_out_desc_t *transport_out  = NULL;
-       conf_ctx =  axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-       if (conf_ctx)
-       {
-       axis2_conf_t *conf =  axis2_conf_ctx_get_conf(conf_ctx, env);
-       if (conf)
-       {
-       axutil_array_list_t *phases =  
-       axis2_conf_get_out_fault_flow(conf, env);
-       if (phases)
-       {
-       axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
-       }
-       }
-       }
-
-       transport_out =  axis2_msg_ctx_get_transport_out_desc(msg_ctx, env);
-
-       if (transport_out)
-       {
-       transport_sender = 
-       axis2_transport_out_desc_get_sender(transport_out, env);
-       }
-
-       if (transport_sender)
-       {
-       AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, msg_ctx);
-       }
-       } */
     return AXIS2_SUCCESS;
 }
 
@@ -525,6 +492,7 @@
     axis2_relates_to_t *relates_to = NULL;
     axis2_char_t *msg_uuid = NULL;
     axis2_msg_info_headers_t *msg_info_headers = NULL;
+    axis2_bool_t doing_rest = AXIS2_FALSE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, processing_context, AXIS2_FAILURE);
@@ -655,6 +623,9 @@
             return NULL;
         }
     }
+
+    doing_rest = axis2_msg_ctx_get_doing_rest (processing_context, env);
+    axis2_msg_ctx_set_doing_rest (fault_ctx, env, doing_rest);
 
     axis2_msg_ctx_set_soap_envelope(fault_ctx, env, envelope);
     axis2_msg_ctx_set_http_out_transport_info(fault_ctx, env,

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?rev=596988&r1=596987&r2=596988&view=diff
==============================================================================
--- 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 Wed Nov 21 00:40:40 2007
@@ -154,9 +154,11 @@
                     http_version);
 
     response = axis2_http_simple_response_create_default(env);
-    encoding_header = axis2_http_simple_request_get_first_header(simple_request,
-                                                                 env,
-                                                                 AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
+    encoding_header = axis2_http_simple_request_get_first_header(
+        simple_request,
+        env,
+        AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
+
     if (encoding_header)
     {
         encoding_header_value = axis2_http_header_get_value(encoding_header,

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c?rev=596988&r1=596987&r2=596988&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_transport_sender.c Wed Nov 21 00:40:40 2007
@@ -28,6 +28,7 @@
 #include <axis2_http_sender.h>
 #include <axiom_soap_body.h>
 #include <axutil_types.h>
+#include <axiom_soap_fault_detail.h>
 
 /**
  * HTTP Transport Sender struct impl
@@ -315,8 +316,11 @@
             if (AXIS2_TRUE == axis2_msg_ctx_get_doing_rest(msg_ctx, env))
             {
                 axiom_node_t *body_node = NULL;
+                axis2_bool_t fault = AXIS2_FALSE;
+                axiom_soap_fault_t *soap_fault;
                 axiom_soap_body_t *soap_body =
                     axiom_soap_envelope_get_body(soap_data_out, env);
+                axiom_soap_fault_detail_t *soap_fault_detial;
 
                 if (!soap_body)
                 {
@@ -330,29 +334,75 @@
                     xml_writer = NULL;
                     return AXIS2_FAILURE;
                 }
-                body_node = axiom_soap_body_get_base_node(soap_body, env);
-                if (!body_node)
+                
+                fault = axiom_soap_body_has_fault (soap_body, env);
+                
+                if (fault == AXIS2_TRUE)
                 {
-                    axiom_output_free(om_output, env);
-                    om_output = NULL;
-                    xml_writer = NULL;
-                    return AXIS2_FAILURE;
+                    soap_fault = axiom_soap_body_get_fault (soap_body, env);
+
+                    if (!soap_fault)
+                    {
+                        
+                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s",
+                                        "Rest fault has occure, error not available");
+                        axiom_output_free(om_output, env);
+                        om_output = NULL;
+                        xml_writer = NULL;
+                        return AXIS2_FAILURE;
+                    }
+
+                    soap_fault_detial = axiom_soap_fault_get_detail (soap_fault, env);
+
+                    if (!soap_fault_detial)
+                    {
+                        axiom_output_free(om_output, env);
+                        om_output = NULL;
+                        xml_writer = NULL;
+                        return AXIS2_FAILURE;
+                    }
+
+                    body_node = axiom_soap_fault_detail_get_base_node(soap_fault_detial, env);
+
+                    if (!body_node)
+                    {
+                        axiom_output_free(om_output, env);
+                        om_output = NULL;
+                        xml_writer = NULL;
+                        return AXIS2_FAILURE;
+                    }
+
                 }
+                else
+                {
+
+                    body_node = axiom_soap_body_get_base_node(soap_body, env);
+                    if (!body_node)
+                    {
+                        axiom_output_free(om_output, env);
+                        om_output = NULL;
+                        xml_writer = NULL;
+                        return AXIS2_FAILURE;
+                    }
+                }
+             
                 data_out = axiom_node_get_first_element(body_node, env);
-                if (!data_out || axiom_node_get_node_type(data_out, env)
-                    != AXIOM_ELEMENT)
+
+                if (!data_out || 
+                    axiom_node_get_node_type(data_out, env)!= AXIOM_ELEMENT) 
                 {
                     axiom_output_free(om_output, env);
                     om_output = NULL;
                     xml_writer = NULL;
                     return AXIS2_FAILURE;
                 }
+
                 axiom_node_serialize(data_out, env, om_output);
                 buffer =
                     (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
                 buffer_size = axiom_xml_writer_get_xml_size(xml_writer, env);
-
                 axutil_stream_write(out_stream, env, buffer, buffer_size);
+                
             }
             else
             {

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?rev=596988&r1=596987&r2=596988&view=diff
==============================================================================
--- 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 Wed Nov 21 00:40:40 2007
@@ -242,9 +242,11 @@
     if (headers)
     {
         axis2_http_header_t *encoding_header = NULL;
-        encoding_header = (axis2_http_header_t *) axutil_hash_get(headers,
-                                                                  AXIS2_HTTP_HEADER_TRANSFER_ENCODING,
-                                                                  AXIS2_HASH_KEY_STRING);
+        encoding_header = (axis2_http_header_t *) axutil_hash_get(
+            headers,
+            AXIS2_HTTP_HEADER_TRANSFER_ENCODING,
+            AXIS2_HASH_KEY_STRING);
+
         if (encoding_header)
         {
             axis2_char_t *encoding_value = NULL;



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