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 se...@apache.org on 2008/03/14 16:28:37 UTC

svn commit: r637133 - in /webservices/axis2/trunk/c/src/core/transport/http: common/http_worker.c util/http_transport_utils.c

Author: senaka
Date: Fri Mar 14 08:28:34 2008
New Revision: 637133

URL: http://svn.apache.org/viewvc?rev=637133&view=rev
Log:
Fixing JIRA Issue AXIS2C-1007

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

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=637133&r1=637132&r2=637133&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 Fri Mar 14 08:28:34 2008
@@ -335,11 +335,7 @@
             axis2_char_t *body_string = NULL;
             axis2_char_t *wsdl = NULL;
             axis2_bool_t is_services_path = AXIS2_FALSE;
-            axis2_http_simple_response_set_status_line(response, env,
-                                                       http_version,
-                                                       AXIS2_HTTP_RESPONSE_OK_CODE_VAL,
-                                                       "OK");
-            if (is_get)
+            if (!is_delete)
             {
                 axis2_char_t *temp = NULL;
                 temp = strstr(axutil_url_get_path(request_url, env), AXIS2_REQUEST_URL_PREFIX);
@@ -371,7 +367,7 @@
                                                      AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML);
                 axis2_http_simple_response_set_header(response, env, cont_type);
             }
-            else if (wsdl)
+            else if (!is_delete && wsdl)
             {
                 axis2_http_simple_response_set_status_line(response, env,
                                                            http_version,
@@ -455,7 +451,62 @@
                  axis2_http_simple_request_get_content_type(simple_request, env),
                  content_length, soap_action_str, url_external_form);
         }
-        if (status == AXIS2_FAILURE)
+        if (AXIS2_FALSE == status && (is_put ||
+            axis2_msg_ctx_get_doing_rest(msg_ctx, env)))
+        {
+            axis2_http_header_t *cont_len = NULL;
+            axis2_http_header_t *cont_type = NULL;
+            axis2_char_t *body_string = NULL;
+            if (env->error->error_number == AXIS2_ERROR_SVC_OR_OP_NOT_FOUND)
+            {
+                axis2_http_simple_response_set_status_line(response, env,
+                                                           http_version,
+                                                           404,
+                                                           "Not Found");
+
+                body_string = axis2_http_transport_utils_get_not_found(env,
+                                                                       conf_ctx);
+                cont_type = axis2_http_header_create(env,
+                                                     AXIS2_HTTP_HEADER_CONTENT_TYPE,
+                                                     AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML);
+                axis2_http_simple_response_set_header(response, env, cont_type);
+            }
+            else
+            {
+                axis2_http_simple_response_set_status_line(response, env,
+                                                           http_version,
+                                                           500,
+                                                           "Internal Server Error");
+
+                body_string = axis2_http_transport_utils_get_services_html(env,
+                                                                           conf_ctx);
+                cont_type = axis2_http_header_create(env,
+                                                     AXIS2_HTTP_HEADER_CONTENT_TYPE,
+                                                     AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML);
+                axis2_http_simple_response_set_header(response, env, cont_type);
+            }
+
+            if (body_string)
+            {
+                axis2_char_t str_len[10];
+                if (!is_head)
+                {
+                    axis2_http_simple_response_set_body_string(response, env,
+                                                               body_string);
+                }
+                sprintf(str_len, "%d", axutil_strlen(body_string));
+                cont_len = axis2_http_header_create(env,
+                                                    AXIS2_HTTP_HEADER_CONTENT_LENGTH,
+                                                    str_len);
+                axis2_http_simple_response_set_header(response, env, cont_len);
+            }
+            axis2_http_worker_set_response_headers(http_worker, env, svr_conn,
+                                                   simple_request, response, 0);
+            axis2_simple_http_svr_conn_write_response(svr_conn, env, response);
+            axis2_http_simple_response_free(response, env);
+            return AXIS2_TRUE;
+        }
+        else if (status == AXIS2_FAILURE)
         {
             axis2_msg_ctx_t *fault_ctx = NULL;
             axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);

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=637133&r1=637132&r2=637133&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 Fri Mar 14 08:28:34 2008
@@ -399,7 +399,7 @@
 
     if(soap_action_header){
     axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action_header);
-    }else{
+    }else if (soap_action){
         axutil_string_t *soap_action_str = NULL;
         soap_action_str = axutil_string_create(env,soap_action);
         axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action_str);
@@ -532,6 +532,15 @@
             axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
             axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_POST);
         }
+        else
+        {
+            return AXIS2_FAILURE;
+        }
+        if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env,
+                                                                            msg_ctx))
+        {
+            return AXIS2_FAILURE;
+        }
     }
 
     if (binary_data_map)
@@ -899,6 +908,15 @@
             axiom_soap_body_add_child(def_body, env, root_node);
             axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
             axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_PUT);
+        }
+        else
+        {
+            return AXIS2_FAILURE;
+        }
+        if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env,
+                                                                            msg_ctx))
+        {
+            return AXIS2_FAILURE;
         }
     }
 



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