axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r394983 - in /webservices/axis2/trunk/c: modules/core/deployment/ modules/core/engine/ modules/core/phaseresolver/ modules/mod_addr/ samples/server/
Date Tue, 18 Apr 2006 16:55:16 GMT
Author: samisa
Date: Tue Apr 18 09:55:14 2006
New Revision: 394983

URL: http://svn.apache.org/viewcvs?rev=394983&view=rev
Log:
Fixes added to get the correct SOAP fault handling model working.
Now the server is capable of dealing with the out fault flow

Modified:
    webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c
    webservices/axis2/trunk/c/modules/core/engine/conf.c
    webservices/axis2/trunk/c/modules/core/engine/engine.c
    webservices/axis2/trunk/c/modules/core/phaseresolver/phase_resolver.c
    webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c
    webservices/axis2/trunk/c/modules/mod_addr/module.xml
    webservices/axis2/trunk/c/samples/server/axis2.xml

Modified: webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c Tue Apr 18 09:55:14 2006
@@ -818,6 +818,8 @@
     }
     
     status = AXIS2_CONF_SET_PHASESINFO(dep_engine_impl->conf, env, dep_engine_impl->phases_info);
+    AXIS2_CONF_SET_OUT_FAULTPHASES(dep_engine_impl->conf, env,
+        AXIS2_PHASES_INFO_GET_OP_OUT_FAULTPHASES(dep_engine_impl->phases_info, env));
     if(AXIS2_SUCCESS != status) 
     {
         AXIS2_REPOS_LISTENER_FREE(dep_engine_impl->repos_listener, env);

Modified: webservices/axis2/trunk/c/modules/core/engine/conf.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/conf.c?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/conf.c Tue Apr 18 09:55:14 2006
@@ -1478,7 +1478,7 @@
         config_impl->phases_info = NULL;
     }
     config_impl->phases_info = phases_info;
-    config_impl->out_faultphases = AXIS2_PHASES_INFO_GET_OUT_FAULTPHASES(phases_info,
env); 
+    /*config_impl->out_faultphases = AXIS2_PHASES_INFO_GET_OP_OUT_FAULTPHASES(phases_info,
env); */
     return AXIS2_SUCCESS;
 }
 

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=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Tue Apr 18 09:55:14 2006
@@ -23,6 +23,7 @@
 #include <axis2_soap_fault.h>
 #include <axis2_transport_sender.h>
 #include <axis2_http_transport.h>
+#include <axis2_addr.h>
 
 /**
  * There is only one engine for the Server and the Client. the send() and receive()
@@ -336,6 +337,7 @@
     axis2_op_t *op = NULL;
     axis2_array_list_t *pre_calculated_phases = NULL;
     axis2_array_list_t *op_specific_phases = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
@@ -376,7 +378,12 @@
     } 
     else 
     {
-        axis2_engine_invoke_phases(engine, env, pre_calculated_phases, msg_ctx);
+        status = axis2_engine_invoke_phases(engine, env, pre_calculated_phases, msg_ctx);
+        if (status != AXIS2_SUCCESS)
+        {
+            if (AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env))
+                return status;
+        }
 
         if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
         {
@@ -389,7 +396,12 @@
         {
             op = AXIS2_OP_CTX_GET_OP(op_ctx, env);
             op_specific_phases = AXIS2_OP_GET_REMAINING_PHASES_INFLOW(op, env);
-            axis2_engine_invoke_phases(engine, env, op_specific_phases, msg_ctx);
+            status = axis2_engine_invoke_phases(engine, env, op_specific_phases, msg_ctx);
+            if (status != AXIS2_SUCCESS)
+            {
+                return status;
+            }
+                                        
             if (AXIS2_MSG_CTX_IS_PAUSED(msg_ctx, env))
             {
                 return AXIS2_SUCCESS;
@@ -456,7 +468,7 @@
         axis2_conf_ctx_t *conf_ctx = NULL;
         axis2_transport_sender_t *transport_sender = NULL;
 
-        /*conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env);
+        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);
@@ -468,7 +480,7 @@
                     axis2_engine_invoke_phases(engine, env, phases, msg_ctx);
                  }
             }
-        }*/
+        }
         
         axis2_transport_out_desc_t *transport_out = AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx,
env);
         
@@ -561,7 +573,11 @@
     axis2_endpoint_ref_t *fault_to = NULL;
     axis2_property_t *property = NULL;
     axis2_soap_envelope_t *envelope = NULL;
-    
+    axis2_char_t *wsa_action = NULL;
+    axis2_char_t *msg_id = NULL;
+    axis2_relates_to_t *relates_to = NULL;
+    axis2_char_t *msg_uuid = NULL;
+
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, processing_context, AXIS2_FAILURE);
     
@@ -602,6 +618,29 @@
         }
     }
 
+    /* set soap action */
+    wsa_action = AXIS2_MSG_CTX_GET_SOAP_ACTION(processing_context, env);
+    if (!wsa_action)
+    {
+        wsa_action = "http://www.w3.org/2005/08/addressing/fault";
+    }
+    AXIS2_MSG_CTX_SET_WSA_ACTION(fault_ctx, env, wsa_action);
+
+    /* set relates to */
+    msg_id = AXIS2_MSG_CTX_GET_MSG_ID(processing_context, env);
+    relates_to = axis2_relates_to_create(env, msg_id,
+            AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE);
+    AXIS2_MSG_CTX_SET_RELATES_TO(fault_ctx, env, relates_to);
+    
+    /* set msg id */
+    msg_uuid =  axis2_uuid_gen(env);
+    AXIS2_MSG_CTX_SET_MESSAGE_ID(fault_ctx, env, msg_uuid);
+    if(NULL != msg_uuid)
+    {
+        AXIS2_FREE((*env)->allocator, msg_uuid);
+        msg_uuid = NULL;
+    }
+
     AXIS2_MSG_CTX_SET_OP_CTX(fault_ctx, env, AXIS2_MSG_CTX_GET_OP_CTX(processing_context,
env));
     AXIS2_MSG_CTX_SET_PROCESS_FAULT(fault_ctx, env, AXIS2_TRUE);
     AXIS2_MSG_CTX_SET_SERVER_SIDE(fault_ctx, env, AXIS2_TRUE);
@@ -790,6 +829,8 @@
 {
     int i = 0;
     int count = 0;
+    axis2_status_t status = AXIS2_SUCCESS;
+    
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, phases, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);    
@@ -803,7 +844,11 @@
         AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, 
             "Invoking phase %s", AXIS2_PHASE_GET_NAME(phase, env));
         
-        AXIS2_PHASE_INVOKE(phase, env, msg_ctx);
+        status = AXIS2_PHASE_INVOKE(phase, env, msg_ctx);
+        if (status != AXIS2_SUCCESS)
+        {
+            return status;
+        }
     }
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/core/phaseresolver/phase_resolver.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/phaseresolver/phase_resolver.c?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/phaseresolver/phase_resolver.c (original)
+++ webservices/axis2/trunk/c/modules/core/phaseresolver/phase_resolver.c Tue Apr 18 09:55:14
2006
@@ -425,10 +425,10 @@
             }
            
             
-            if(!all_handlers)
+            /*if(!all_handlers)
             {
                 return AXIS2_FAILURE;
-            }
+            }*/
 
             for (j = 0; j < count; j++) 
             {
@@ -439,7 +439,7 @@
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 phase_rule = AXIS2_HANDLER_DESC_GET_RULES(metadata, env);
                 phase_name = AXIS2_PHASE_RULE_GET_NAME(phase_rule, env);
-                if(NULL != phase_name)
+                if(NULL == phase_name)
                 {
                     return AXIS2_FAILURE;
                 }
@@ -1424,10 +1424,10 @@
                 {
                     return AXIS2_FAILURE;
                 }
-                if ((0 == AXIS2_STRCMP(AXIS2_PHASE_TRANSPORTIN, phase_name)) ||
-                    (0 == AXIS2_STRCMP(AXIS2_PHASE_DISPATCH, phase_name)) ||
-                    (0 == AXIS2_STRCMP(AXIS2_PHASE_POST_DISPATCH, phase_name)) ||
-                    (0 == AXIS2_STRCMP(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
+                /*if ((0 != AXIS2_STRCMP(AXIS2_PHASE_TRANSPORTIN, phase_name)) &&
+                    (0 != AXIS2_STRCMP(AXIS2_PHASE_DISPATCH, phase_name)) &&
+                    (0 != AXIS2_STRCMP(AXIS2_PHASE_POST_DISPATCH, phase_name)) &&
+                    (0 != AXIS2_STRCMP(AXIS2_PHASE_PRE_DISPATCH, phase_name)))*/
                 {
                     status = AXIS2_PHASE_HOLDER_ADD_HANDLER(resolver_impl->
                         phase_holder, env, metadata);
@@ -1437,7 +1437,7 @@
                     }
           
                 } 
-                else 
+                /*else 
                 {
                     /**
                      * These handlers will go to op's handler chains , since 
@@ -1446,7 +1446,7 @@
                      * that. here the global module are the module which are
                      * reffred by axis2.xml
                      */
-                }
+                /*}*/
             }
         }
     }

Modified: webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c (original)
+++ webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c Tue Apr 18 09:55:14 2006
@@ -80,11 +80,11 @@
         axis2_array_list_t *addr_headers,
         axis2_msg_ctx_t *msg_ctx);
 
-axis2_soap_envelope_t *
+void 
 axis2_addr_in_create_fault_envelope(axis2_env_t **env,
         axis2_char_t *header_name,
         axis2_char_t *addr_ns_str,
-        int soap_version);
+        axis2_msg_ctx_t *msg_ctx);
 
 /******************************************************************************/        
                
 
@@ -287,7 +287,12 @@
     axis2_hash_t *header_block_ht = NULL;
     axis2_hash_index_t *hash_index =  NULL;
     axis2_msg_info_headers_t *msg_info_headers = *(msg_info_headers_p);
+    axis2_status_t status = AXIS2_SUCCESS;
     axis2_bool_t to_found = AXIS2_FALSE;
+    axis2_bool_t reply_to_found = AXIS2_FALSE;
+    axis2_bool_t fault_to_found = AXIS2_FALSE;
+    axis2_bool_t action_found = AXIS2_FALSE;
+    axis2_bool_t msg_id_found = AXIS2_FALSE;
     
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, soap_header, AXIS2_FAILURE);
@@ -327,26 +332,20 @@
         {
              /* here the addressing epr overidde what ever already there in the message context
*/   
                 
-                epr = axis2_endpoint_ref_create(env, AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele,
env, header_block_node));
-                if (to_found == AXIS2_TRUE)
-                {
-                    /* Duplicate To */
-                    int soap_version = AXIS2_SOAP12;
-                    axis2_soap_envelope_t *envelope = NULL;
-                    if (AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
-                    {
-                        soap_version = AXIS2_SOAP11;
-                    }
-                    envelope = axis2_addr_in_create_fault_envelope(env, 
-                            "wsa:To", addr_ns_str, soap_version);
-                    AXIS2_MSG_CTX_SET_FAULT_SOAP_ENVELOPE(msg_ctx, env, envelope);
-                    return AXIS2_FAILURE;
-                }
-                AXIS2_MSG_INFO_HEADERS_SET_TO(msg_info_headers, env, epr);
-                
-                axis2_addr_in_extract_to_epr_ref_params(env, epr, soap_header, addr_ns_str);
-                AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);
-                to_found = AXIS2_TRUE;
+            epr = axis2_endpoint_ref_create(env, AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele,
env, header_block_node));
+            if (to_found == AXIS2_TRUE)
+            {
+                /* Duplicate To */
+                axis2_addr_in_create_fault_envelope(env, 
+                        "wsa:To", addr_ns_str, msg_ctx);
+                status = AXIS2_FAILURE;
+                continue;
+            }
+            AXIS2_MSG_INFO_HEADERS_SET_TO(msg_info_headers, env, epr);
+            
+            axis2_addr_in_extract_to_epr_ref_params(env, epr, soap_header, addr_ns_str);
+            AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);
+            to_found = AXIS2_TRUE;
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_FROM) == 0)
         {
@@ -356,7 +355,6 @@
                     /* I don't know the address now. Let me pass the empty 
                         string now and fill this once I process the Elements under this.
*/
                     
-                    
                     epr = axis2_endpoint_ref_create(env, "");
                     AXIS2_MSG_INFO_HEADERS_SET_FROM(msg_info_headers, env, epr);
                 }     
@@ -366,6 +364,16 @@
         else if( AXIS2_STRCMP(ele_localname, AXIS2_WSA_REPLY_TO) == 0)
         {
             epr = AXIS2_MSG_INFO_HEADERS_GET_REPLY_TO(msg_info_headers, env);
+            
+            if (reply_to_found == AXIS2_TRUE)
+            {
+                /* Duplicate Reply To */
+                axis2_addr_in_create_fault_envelope(env, 
+                        "wsa:ReplyTo", addr_ns_str, msg_ctx);
+                status = AXIS2_FAILURE;
+                continue;
+            }
+            
             if(!epr)
             {
                 epr = axis2_endpoint_ref_create(env, "");
@@ -373,10 +381,22 @@
             }
             axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str);
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);
+            reply_to_found = AXIS2_TRUE;
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_FAULT_TO) == 0)
         {
             epr = AXIS2_MSG_INFO_HEADERS_GET_FAULT_TO(msg_info_headers , env);
+            
+            if (fault_to_found == AXIS2_TRUE)
+            {
+                /* Duplicate Fault To */
+                axis2_addr_in_create_fault_envelope(env, 
+                        "wsa:FaultTo", addr_ns_str, msg_ctx);
+                status = AXIS2_FAILURE;
+                AXIS2_MSG_INFO_HEADERS_SET_FAULT_TO(msg_info_headers, env, NULL);
+                continue;
+            }
+            
             if(!epr)
             {
                epr = axis2_endpoint_ref_create(env, "");
@@ -384,20 +404,43 @@
              }                    
             axis2_addr_in_extract_epr_information(env, header_block, epr, addr_ns_str);
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);         
+            fault_to_found = AXIS2_TRUE;
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_MESSAGE_ID) == 0)
         {
             axis2_char_t *text = NULL;
+            
+            if (msg_id_found == AXIS2_TRUE)
+            {
+                /* Duplicate Message ID */
+                axis2_addr_in_create_fault_envelope(env, 
+                        "wsa:MessageID", addr_ns_str, msg_ctx);
+                status = AXIS2_FAILURE;
+                continue;
+            }
+            
             text = AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node);
             AXIS2_MSG_INFO_HEADERS_SET_MESSAGE_ID(msg_info_headers, env, text);
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);              
+            msg_id_found = AXIS2_TRUE;
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_ACTION) == 0)
         {
             axis2_char_t *text = NULL;
+            
+            if (action_found == AXIS2_TRUE)
+            {
+                /* Duplicate Action */
+                axis2_addr_in_create_fault_envelope(env, 
+                        "wsa:Action", addr_ns_str, msg_ctx);
+                status = AXIS2_FAILURE;
+                continue;
+            }
+            
             text = AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node);
             AXIS2_MSG_INFO_HEADERS_SET_ACTION(msg_info_headers, env, text); 
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);       
+            action_found = AXIS2_TRUE;
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_RELATES_TO) == 0)
         {
@@ -438,7 +481,15 @@
             AXIS2_QNAME_FREE(rqn, env);
         }
      }
-     return AXIS2_SUCCESS;
+    
+    if (action_found == AXIS2_FALSE) /* Check is an action was found */
+    {
+        axis2_addr_in_create_fault_envelope(env, 
+                "wsa:Action", addr_ns_str, msg_ctx);
+        status = AXIS2_FAILURE;
+    }
+    
+    return status;
 }
 
 axis2_status_t 
@@ -683,15 +734,21 @@
         (AXIS2_STRCMP(exp_qn_nsuri,act_qn_nsuri) == 0));
 }
 
-axis2_soap_envelope_t *
+void 
 axis2_addr_in_create_fault_envelope(axis2_env_t **env,
         axis2_char_t *header_name,
         axis2_char_t *addr_ns_str,
-        int soap_version)
+        axis2_msg_ctx_t *msg_ctx)
 {
     axis2_soap_envelope_t *envelope = NULL;
     axis2_array_list_t *sub_codes = NULL;
+    int soap_version = AXIS2_SOAP12;
 
+    if (AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
+    {
+        soap_version = AXIS2_SOAP11;
+    }
+    
     axis2_om_node_t* text_om_node = NULL;
     axis2_om_element_t * text_om_ele = NULL;
     axis2_om_namespace_t *ns1 = NULL;
@@ -710,6 +767,9 @@
             "soapenv:Sender", 
             "A header representing a Message Addressing Property is not valid and the message
cannot be processed",
             soap_version, sub_codes, text_om_node);
-    return envelope;            
+    AXIS2_MSG_CTX_SET_FAULT_SOAP_ENVELOPE(msg_ctx, env, envelope);
+    AXIS2_MSG_CTX_SET_SOAP_ACTION(msg_ctx, env,
+            "http://www.w3.org/2005/08/addressing/fault");
+    return;
 }
 

Modified: webservices/axis2/trunk/c/modules/mod_addr/module.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/mod_addr/module.xml?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/mod_addr/module.xml (original)
+++ webservices/axis2/trunk/c/modules/mod_addr/module.xml Tue Apr 18 09:55:14 2006
@@ -10,4 +10,10 @@
             <order phase="MessageOut"/>
         </handler>
     </outflow>
+
+    <Outfaultflow>
+        <handler name="AddressingOutHandler" class="axis2_mod_addr">
+            <order phase="MessageOut"/>
+        </handler>
+    </Outfaultflow>
 </module>

Modified: webservices/axis2/trunk/c/samples/server/axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/server/axis2.xml?rev=394983&r1=394982&r2=394983&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/server/axis2.xml (original)
+++ webservices/axis2/trunk/c/samples/server/axis2.xml Tue Apr 18 09:55:14 2006
@@ -158,7 +158,7 @@
         <!--phase name="RMPhase"/-->
         <!--phase name="userphase1"/-->
         <!--phase name="PolicyDetermination"/-->
-        <!--phase name="MessageOut"/-->
+        <phase name="MessageOut"/>
     </phaseOrder>
 </axisconfig>
 



Mime
View raw message