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 sh...@apache.org on 2009/08/18 12:15:53 UTC
svn commit: r805347 [27/31] - in /webservices/axis2/trunk/c/src: core/addr/
core/clientapi/ core/context/ core/deployment/ core/description/
core/engine/ core/phaseresolver/ core/receivers/
core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...
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=805347&r1=805346&r2=805347&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 Tue Aug 18 10:15:49 2009
@@ -119,7 +119,6 @@
axis2_conf_ctx_t * conf_ctx,
axutil_hash_t * request_params);
-
AXIS2_EXTERN axiom_stax_builder_t *AXIS2_CALL
axis2_http_transport_utils_select_builder_for_mime(
const axutil_env_t * env,
@@ -128,15 +127,18 @@
axutil_stream_t * in_stream,
axis2_char_t * content_type);
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL axis2_http_transport_utils_is_optimized(
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_http_transport_utils_is_optimized(
const axutil_env_t * env,
axiom_element_t * om_element);
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL axis2_http_transport_utils_do_write_mtom(
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_http_transport_utils_do_write_mtom(
const axutil_env_t * env,
axis2_msg_ctx_t * msg_ctx);
-AXIS2_EXTERN axis2_status_t AXIS2_CALL axis2_http_transport_utils_strdecode(
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_strdecode(
const axutil_env_t * env,
axis2_char_t * dest,
axis2_char_t * src);
@@ -205,67 +207,70 @@
void *handler,
void *user_param);
-
/***************************** End of function headers ************************/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_transport_utils_transport_out_init(axis2_http_transport_out_t *response,
- const axutil_env_t *env)
+axis2_http_transport_utils_transport_out_init(
+ axis2_http_transport_out_t *response,
+ const axutil_env_t *env)
{
- response->http_status_code_name = NULL;
- response->http_status_code = 0;
- response->msg_ctx = NULL;
- response->response_data = NULL;
- response->content_type = NULL;
- response->response_data_length = 0;
- response->content_language = NULL;
- response->output_headers = NULL;
- return AXIS2_SUCCESS;
+ response->http_status_code_name = NULL;
+ response->http_status_code = 0;
+ response->msg_ctx = NULL;
+ response->response_data = NULL;
+ response->content_type = NULL;
+ response->response_data_length = 0;
+ response->content_language = NULL;
+ response->output_headers = NULL;
+ return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_transport_utils_transport_out_uninit(axis2_http_transport_out_t *response,
- const axutil_env_t *env)
-{
- if (response->msg_ctx)
- {
- axis2_msg_ctx_free(response->msg_ctx, env);
- }
- return AXIS2_SUCCESS;
+axis2_http_transport_utils_transport_out_uninit(
+ axis2_http_transport_out_t *response,
+ const axutil_env_t *env)
+{
+ if(response->msg_ctx)
+ {
+ axis2_msg_ctx_free(response->msg_ctx, env);
+ }
+ return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_transport_utils_transport_in_init(axis2_http_transport_in_t *request,
- const axutil_env_t *env)
+axis2_http_transport_utils_transport_in_init(
+ axis2_http_transport_in_t *request,
+ const axutil_env_t *env)
{
- request->content_type = NULL;
- request->content_length = 0;
- request->msg_ctx = NULL;
- request->soap_action = NULL;
- request->request_uri = NULL;
- request->in_stream = NULL;
- request->remote_ip = NULL;
- request->svr_port = NULL;
- request->transfer_encoding = NULL;
- request->accept_header = NULL;
- request->accept_language_header = NULL;
- request->accept_charset_header = NULL;
- request->request_method = 0;
- request->out_transport_info = NULL;
- request->request_url_prefix = NULL;
- return AXIS2_SUCCESS;
+ request->content_type = NULL;
+ request->content_length = 0;
+ request->msg_ctx = NULL;
+ request->soap_action = NULL;
+ request->request_uri = NULL;
+ request->in_stream = NULL;
+ request->remote_ip = NULL;
+ request->svr_port = NULL;
+ request->transfer_encoding = NULL;
+ request->accept_header = NULL;
+ request->accept_language_header = NULL;
+ request->accept_charset_header = NULL;
+ request->request_method = 0;
+ request->out_transport_info = NULL;
+ request->request_url_prefix = NULL;
+ return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_transport_utils_transport_in_uninit(axis2_http_transport_in_t *request,
- const axutil_env_t *env)
+axis2_http_transport_utils_transport_in_uninit(
+ axis2_http_transport_in_t *request,
+ const axutil_env_t *env)
{
- if (request->msg_ctx)
- {
- axis2_msg_ctx_reset_out_transport_info(request->msg_ctx, env);
- axis2_msg_ctx_free(request->msg_ctx, env);
- }
- return AXIS2_SUCCESS;
+ if(request->msg_ctx)
+ {
+ axis2_msg_ctx_reset_out_transport_info(request->msg_ctx, env);
+ axis2_msg_ctx_free(request->msg_ctx, env);
+ }
+ return AXIS2_SUCCESS;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -304,7 +309,6 @@
axiom_mime_parser_t *mime_parser = NULL;
axis2_bool_t is_svc_callback = AXIS2_FALSE;
-
AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, in_stream, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, out_stream, AXIS2_FAILURE);
@@ -315,65 +319,60 @@
callback_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
/* Note: the memory created above is freed in xml reader free function
- as this is passed on to the reader */
+ as this is passed on to the reader */
callback_ctx->in_stream = in_stream;
callback_ctx->env = env;
callback_ctx->content_length = content_length;
callback_ctx->unread_len = content_length;
callback_ctx->chunked_stream = NULL;
- soap_action =
- (axis2_char_t *) axutil_string_get_buffer(soap_action_header, env);
+ soap_action = (axis2_char_t *)axutil_string_get_buffer(soap_action_header, env);
soap_action_len = axutil_string_get_length(soap_action_header, env);
- if (soap_action && (soap_action_len > 0))
+ if(soap_action && (soap_action_len > 0))
{
/* remove leading and trailing " s */
- if (AXIS2_DOUBLE_QUOTE == soap_action[0])
+ if(AXIS2_DOUBLE_QUOTE == soap_action[0])
{
- memmove(soap_action, soap_action + sizeof(char),
- soap_action_len - 1 + sizeof(char));
+ memmove(soap_action, soap_action + sizeof(char), soap_action_len - 1 + sizeof(char));
}
- if (AXIS2_DOUBLE_QUOTE == soap_action[soap_action_len - 2])
+ if(AXIS2_DOUBLE_QUOTE == soap_action[soap_action_len - 2])
{
soap_action[soap_action_len - 2] = AXIS2_ESC_NULL;
}
- }else{
- /** soap action is null, check whether soap action is in content_type header */
- soap_action = axis2_http_transport_utils_get_value_from_content_type(env,
- content_type, AXIS2_ACTION);
}
-
+ else
+ {
+ /** soap action is null, check whether soap action is in content_type header */
+ soap_action = axis2_http_transport_utils_get_value_from_content_type(env, content_type,
+ AXIS2_ACTION);
+ }
headers = axis2_msg_ctx_get_transport_headers(msg_ctx, env);
- if (headers)
+ 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)
+ if(encoding_header)
{
axis2_char_t *encoding_value = NULL;
encoding_value = axis2_http_header_get_value(encoding_header, env);
- if (encoding_value &&
- 0 == axutil_strcasecmp(encoding_value,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(encoding_value && 0 == axutil_strcasecmp(encoding_value,
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
- callback_ctx->chunked_stream =
- axutil_http_chunked_stream_create(env, in_stream);
+ callback_ctx->chunked_stream = axutil_http_chunked_stream_create(env, in_stream);
- if (!callback_ctx->chunked_stream)
+ if(!callback_ctx->chunked_stream)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occurred in"
- " creating in chunked stream.");
+ " creating in chunked stream.");
return AXIS2_FAILURE;
}
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "HTTP"
- " stream chunked");
+ " stream chunked");
}
}
}
@@ -383,13 +382,13 @@
/* check content encoding from msg ctx property */
axis2_char_t *value = axis2_msg_ctx_get_transfer_encoding(msg_ctx, env);
- if (value && axutil_strstr(value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(value && axutil_strstr(value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
/* In case Transfer encoding is set to message context, some streams strip chunking meta
- data, so chunked streams should not be created */
-
- callback_ctx->content_length = -1;
- callback_ctx->unread_len = -1;
+ data, so chunked streams should not be created */
+
+ callback_ctx->content_length = -1;
+ callback_ctx->unread_len = -1;
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[chunked ] setting length to -1");
}
}
@@ -397,17 +396,14 @@
/* when the message contains does not contain pure XML we can't send it
* directly to the parser, First we need to separate the SOAP part from
* the attachment */
-
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED))
+
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED))
{
/* get mime boundary */
- axis2_char_t *mime_boundary =
- axis2_http_transport_utils_get_value_from_content_type(
- env,
- content_type,
- AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
+ axis2_char_t *mime_boundary = axis2_http_transport_utils_get_value_from_content_type(env,
+ content_type, AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
- if (mime_boundary)
+ if(mime_boundary)
{
/*axiom_mime_parser_t *mime_parser = NULL;*/
int soap_body_len = 0;
@@ -420,7 +416,7 @@
axis2_char_t *value_num = NULL;
axis2_char_t *value_dir = NULL;
axis2_char_t *value_callback = NULL;
- axis2_char_t *value_enable_service_callback = NULL;
+ axis2_char_t *value_enable_service_callback = NULL;
int size = 0;
int num = 0;
@@ -428,46 +424,38 @@
/* This is the size of the buffer we keep inside mime_parser
* when parsing. */
- enable_service_callback_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_ENABLE_MTOM_SERVICE_CALLBACK);
+ enable_service_callback_param = axis2_msg_ctx_get_parameter(msg_ctx, env,
+ AXIS2_ENABLE_MTOM_SERVICE_CALLBACK);
if(enable_service_callback_param)
{
- value_enable_service_callback = (axis2_char_t *) axutil_param_get_value
- (enable_service_callback_param, env);
+ value_enable_service_callback = (axis2_char_t *)axutil_param_get_value(
+ enable_service_callback_param, env);
if(value_enable_service_callback)
{
if(!axutil_strcmp(value_enable_service_callback, AXIS2_VALUE_TRUE))
{
- is_svc_callback = AXIS2_TRUE;
+ is_svc_callback = AXIS2_TRUE;
}
- }
+ }
}
-
- buffer_size_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_BUFFER_SIZE);
- if (buffer_size_param)
+ buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
+ if(buffer_size_param)
{
- value_size =
- (axis2_char_t *) axutil_param_get_value (buffer_size_param, env);
+ value_size = (axis2_char_t *)axutil_param_get_value(buffer_size_param, env);
if(value_size)
{
size = atoi(value_size);
axiom_mime_parser_set_buffer_size(mime_parser, env, size);
}
}
-
+
/* We create an array of buffers in order to conatin SOAP data inside
* mime_parser. This is the number of sucj buffers */
- max_buffers_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_MAX_BUFFERS);
- if (max_buffers_param)
+ max_buffers_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_MAX_BUFFERS);
+ if(max_buffers_param)
{
- value_num =
- (axis2_char_t *) axutil_param_get_value (max_buffers_param, env);
+ value_num = (axis2_char_t *)axutil_param_get_value(max_buffers_param, env);
if(value_num)
{
num = atoi(value_num);
@@ -475,29 +463,24 @@
}
}
/* If this paramter is there mime_parser will cached the attachment
- * using to the directory for large attachments. */
+ * using to the directory for large attachments. */
- callback_name_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_CACHING_CALLBACK);
+ callback_name_param = axis2_msg_ctx_get_parameter(msg_ctx, env,
+ AXIS2_MTOM_CACHING_CALLBACK);
if(callback_name_param)
{
- value_callback =
- (axis2_char_t *) axutil_param_get_value (callback_name_param, env);
+ value_callback = (axis2_char_t *)axutil_param_get_value(callback_name_param, env);
if(value_callback)
{
axiom_mime_parser_set_caching_callback_name(mime_parser, env, value_callback);
}
}
- attachment_dir_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_ATTACHMENT_DIR);
+ attachment_dir_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ATTACHMENT_DIR);
if(attachment_dir_param)
{
- value_dir =
- (axis2_char_t *) axutil_param_get_value (attachment_dir_param, env);
+ value_dir = (axis2_char_t *)axutil_param_get_value(attachment_dir_param, env);
if(value_dir)
{
axiom_mime_parser_set_attachment_dir(mime_parser, env, value_dir);
@@ -506,31 +489,25 @@
axiom_mime_parser_set_mime_boundary(mime_parser, env, mime_boundary);
- if(axiom_mime_parser_parse_for_soap(mime_parser, env,
- axis2_http_transport_utils_on_data_request,
- (void *) callback_ctx,
- mime_boundary) == AXIS2_FAILURE)
+ if(axiom_mime_parser_parse_for_soap(mime_parser, env,
+ axis2_http_transport_utils_on_data_request, (void *)callback_ctx, mime_boundary)
+ == AXIS2_FAILURE)
{
return AXIS2_FAILURE;
}
-
+
if(!is_svc_callback)
{
- binary_data_map =
- axiom_mime_parser_parse_for_attachments(mime_parser, env,
- axis2_http_transport_utils_on_data_request,
- (void *) callback_ctx,
- mime_boundary,
- NULL);
+ binary_data_map = axiom_mime_parser_parse_for_attachments(mime_parser, env,
+ axis2_http_transport_utils_on_data_request, (void *)callback_ctx,
+ mime_boundary, NULL);
if(!binary_data_map)
{
return AXIS2_FAILURE;
}
}
- soap_body_len =
- axiom_mime_parser_get_soap_body_len(mime_parser, env);
- soap_body_str =
- axiom_mime_parser_get_soap_body_str(mime_parser, env);
+ soap_body_len = axiom_mime_parser_get_soap_body_len(mime_parser, env);
+ soap_body_str = axiom_mime_parser_get_soap_body_str(mime_parser, env);
if(!is_svc_callback)
{
@@ -539,10 +516,10 @@
axutil_http_chunked_stream_free(callback_ctx->chunked_stream, env);
callback_ctx->chunked_stream = NULL;
}
- }
+ }
else
{
- mime_cb_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
+ mime_cb_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
if(mime_cb_ctx)
{
mime_cb_ctx->in_stream = callback_ctx->in_stream;
@@ -554,7 +531,7 @@
}
stream = axutil_stream_create_basic(env);
- if (stream)
+ if(stream)
{
axutil_stream_write(stream, env, soap_body_str, soap_body_len);
callback_ctx->in_stream = stream;
@@ -563,7 +540,7 @@
callback_ctx->unread_len = soap_body_len;
}
/*axiom_mime_parser_free(mime_parser, env);
- mime_parser = NULL;*/
+ mime_parser = NULL;*/
/*AXIS2_FREE(env->allocator, mime_boundary);*/
}
@@ -574,28 +551,23 @@
{
axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action_header);
- }else if (soap_action)
+ }
+ else if(soap_action)
{
axutil_string_t *soap_action_str = NULL;
- soap_action_str = axutil_string_create(env,soap_action);
+ soap_action_str = axutil_string_create(env, soap_action);
axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action_str);
axutil_string_free(soap_action_str, env);
}
- axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env,
- request_uri));
+ axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, request_uri));
axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
- char_set_str =
- axis2_http_transport_utils_get_charset_enc(env, content_type);
- xml_reader =
- axiom_xml_reader_create_for_io(env,
- axis2_http_transport_utils_on_data_request,
- NULL, (void *) callback_ctx,
- axutil_string_get_buffer(char_set_str,
- env));
+ char_set_str = axis2_http_transport_utils_get_charset_enc(env, content_type);
+ xml_reader = axiom_xml_reader_create_for_io(env, axis2_http_transport_utils_on_data_request,
+ NULL, (void *)callback_ctx, axutil_string_get_buffer(char_set_str, env));
- if (!xml_reader)
+ if(!xml_reader)
{
return AXIS2_FAILURE;
}
@@ -603,22 +575,22 @@
axis2_msg_ctx_set_charset_encoding(msg_ctx, env, char_set_str);
om_builder = axiom_stax_builder_create(env, xml_reader);
- if (!om_builder)
+ if(!om_builder)
{
axiom_xml_reader_free(xml_reader, env);
xml_reader = NULL;
return AXIS2_FAILURE;
}
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
{
is_soap11 = AXIS2_FALSE;
soap_builder = axiom_soap_builder_create(env, om_builder,
- AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
- if (!soap_builder)
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+ if(!soap_builder)
{
/* We should not be freeing om_builder here as it is done by
- axiom_soap_builder_create in case of error - Samisa */
+ axiom_soap_builder_create in case of error - Samisa */
om_builder = NULL;
xml_reader = NULL;
axis2_msg_ctx_set_is_soap_11(msg_ctx, env, is_soap11);
@@ -626,7 +598,7 @@
}
soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
- if (!soap_envelope)
+ if(!soap_envelope)
{
axiom_stax_builder_free(om_builder, env);
om_builder = NULL;
@@ -637,25 +609,24 @@
return AXIS2_FAILURE;
}
}
- else if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
{
is_soap11 = AXIS2_TRUE;
- if (soap_action_header)
+ if(soap_action_header)
{
soap_builder = axiom_soap_builder_create(env, om_builder,
- AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI);
- if (!soap_builder)
+ AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI);
+ if(!soap_builder)
{
/* We should not be freeing om_builder here as it is done by
- axiom_soap_builder_create in case of error - Samisa */
+ axiom_soap_builder_create in case of error - Samisa */
om_builder = NULL;
xml_reader = NULL;
axis2_msg_ctx_set_is_soap_11(msg_ctx, env, is_soap11);
return AXIS2_FAILURE;
}
- soap_envelope =
- axiom_soap_builder_get_soap_envelope(soap_builder, env);
- if (!soap_envelope)
+ soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
+ if(!soap_envelope)
{
axiom_soap_builder_free(soap_builder, env);
om_builder = NULL;
@@ -672,8 +643,7 @@
}
}
- else if (strstr
- (content_type, AXIS2_HTTP_HEADER_ACCEPT_X_WWW_FORM_URLENCODED))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_X_WWW_FORM_URLENCODED))
{
/* REST support */
do_rest = AXIS2_TRUE;
@@ -682,10 +652,8 @@
else
{
http_error_property = axutil_property_create(env);
- axutil_property_set_value(http_error_property, env,
- AXIS2_HTTP_UNSUPPORTED_MEDIA_TYPE);
- axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HTTP_TRANSPORT_ERROR,
- http_error_property);
+ axutil_property_set_value(http_error_property, env, AXIS2_HTTP_UNSUPPORTED_MEDIA_TYPE);
+ axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HTTP_TRANSPORT_ERROR, http_error_property);
}
if(soap_builder)
@@ -706,22 +674,19 @@
}
}
- if (do_rest)
+ if(do_rest)
{
/* REST support */
- axutil_param_t *rest_param =
- axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ENABLE_REST);
- if (rest_param &&
- 0 == axutil_strcmp(AXIS2_VALUE_TRUE,
- axutil_param_get_value(rest_param, env)))
+ axutil_param_t *rest_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ENABLE_REST);
+ if(rest_param && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, axutil_param_get_value(rest_param,
+ env)))
{
axiom_soap_body_t *def_body = NULL;
axiom_document_t *om_doc = NULL;
axiom_node_t *root_node = NULL;
- if (!run_as_get)
+ if(!run_as_get)
{
- soap_envelope = axiom_soap_envelope_create_default_soap_envelope
- (env, AXIOM_SOAP11);
+ soap_envelope = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
def_body = axiom_soap_envelope_get_body(soap_envelope, env);
om_doc = axiom_stax_builder_get_document(om_builder, env);
root_node = axiom_document_build_all(om_doc, env);
@@ -729,65 +694,62 @@
}
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_POST);
- axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
+ axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
}
else
{
return AXIS2_FAILURE;
}
- if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env,
- msg_ctx))
+ if(AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
{
return AXIS2_FAILURE;
}
}
- if (run_as_get)
+ if(run_as_get)
{
axis2_char_t *buffer = NULL;
axis2_char_t *new_url = NULL;
buffer = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (content_length + 1));
- if (!buffer)
+ if(!buffer)
{
return AXIS2_FAILURE;
}
- axis2_http_transport_utils_on_data_request(buffer, content_length, (void *) callback_ctx);
-
- new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
- ((int)(strlen(request_uri) + strlen(buffer)) + 2));
- if (!new_url)
+ axis2_http_transport_utils_on_data_request(buffer, content_length, (void *)callback_ctx);
+
+ new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * ((int)(strlen(request_uri)
+ + strlen(buffer)) + 2));
+ if(!new_url)
{
return AXIS2_FAILURE;
}
sprintf(new_url, "%s?%s", request_uri, buffer);
AXIS2_FREE(env->allocator, buffer);
- soap_envelope =
- axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
axis2_http_transport_utils_get_request_params(env, new_url), AXIS2_HTTP_POST);
}
- if (binary_data_map)
+ if(binary_data_map)
{
- axiom_soap_builder_set_mime_body_parts(soap_builder, env,
- binary_data_map);
+ axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
}
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
engine = axis2_engine_create(env, conf_ctx);
- if (!soap_envelope)
+ if(!soap_envelope)
return AXIS2_FAILURE;
soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
- if (!soap_body)
+ if(!soap_body)
return AXIS2_FAILURE;
if(!is_svc_callback)
{
- if (AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
+ if(AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
{
status = axis2_engine_receive_fault(engine, env, msg_ctx);
}
@@ -801,35 +763,33 @@
status = axis2_engine_receive(engine, env, msg_ctx);
}
- if (!axis2_msg_ctx_get_soap_envelope(msg_ctx, env) &&
- AXIS2_FALSE == is_soap11)
+ if(!axis2_msg_ctx_get_soap_envelope(msg_ctx, env) && AXIS2_FALSE == is_soap11)
{
- axiom_soap_envelope_t *def_envelope =
- axiom_soap_envelope_create_default_soap_envelope(env,
- AXIOM_SOAP12);
+ axiom_soap_envelope_t *def_envelope = axiom_soap_envelope_create_default_soap_envelope(env,
+ AXIOM_SOAP12);
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, def_envelope);
}
- if (engine)
+ if(engine)
{
axis2_engine_free(engine, env);
}
- if (soap_body_str)
+ if(soap_body_str)
{
AXIS2_FREE(env->allocator, soap_body_str);
}
- if (stream)
+ if(stream)
{
axutil_stream_free(stream, env);
}
- if (char_set_str)
+ if(char_set_str)
{
axutil_string_free(char_set_str, env);
}
- if (!soap_builder && om_builder)
+ if(!soap_builder && om_builder)
{
axiom_stax_builder_free_self(om_builder, env);
om_builder = NULL;
@@ -883,41 +843,36 @@
callback_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
/* Note: the memory created above is freed in xml reader free function
- as this is passed on to the reader */
+ as this is passed on to the reader */
callback_ctx->in_stream = in_stream;
callback_ctx->env = env;
callback_ctx->content_length = content_length;
callback_ctx->unread_len = content_length;
callback_ctx->chunked_stream = NULL;
-
headers = axis2_msg_ctx_get_transport_headers(msg_ctx, env);
- if (headers)
+ 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)
+ if(encoding_header)
{
axis2_char_t *encoding_value = NULL;
encoding_value = axis2_http_header_get_value(encoding_header, env);
- if (encoding_value &&
- 0 == axutil_strcasecmp(encoding_value,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
- {
- callback_ctx->chunked_stream =
- axutil_http_chunked_stream_create(env, in_stream);
- if (!callback_ctx->chunked_stream)
+ if(encoding_value && 0 == axutil_strcasecmp(encoding_value,
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ {
+ callback_ctx->chunked_stream = axutil_http_chunked_stream_create(env, in_stream);
+ if(!callback_ctx->chunked_stream)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
- " creating in chunked stream.");
+ " creating in chunked stream.");
return AXIS2_FAILURE;
}
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "HTTP"
- " stream chunked");
+ " stream chunked");
}
}
}
@@ -926,29 +881,25 @@
/* check content encoding from msg ctx property */
axis2_char_t *value = axis2_msg_ctx_get_transfer_encoding(msg_ctx, env);
- if (value &&
- axutil_strstr(value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(value && axutil_strstr(value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
/* this is an UGLY hack to get some of the transports working
- e.g. PHP transport where it strips the chunking info in case of chunking
- and also gives out a content lenght of 0.
- We need to fix the transport design to fix sutuations like this.
+ e.g. PHP transport where it strips the chunking info in case of chunking
+ and also gives out a content lenght of 0.
+ We need to fix the transport design to fix sutuations like this.
*/
callback_ctx->content_length = AXIS2_CHUNKED_CONTENT_LENGTH;
callback_ctx->unread_len = callback_ctx->content_length;
}
}
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED))
{
/* get mime boundry */
- axis2_char_t *mime_boundary =
- axis2_http_transport_utils_get_value_from_content_type(
- env,
- content_type,
- AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
+ axis2_char_t *mime_boundary = axis2_http_transport_utils_get_value_from_content_type(env,
+ content_type, AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
- if (mime_boundary)
+ if(mime_boundary)
{
axiom_mime_parser_t *mime_parser = NULL;
int soap_body_len = 0;
@@ -965,14 +916,10 @@
mime_parser = axiom_mime_parser_create(env);
- buffer_size_param =
- axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_BUFFER_SIZE);
- if (buffer_size_param)
+ buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
+ if(buffer_size_param)
{
- value_size =
- (axis2_char_t *) axutil_param_get_value (buffer_size_param, env);
+ value_size = (axis2_char_t *)axutil_param_get_value(buffer_size_param, env);
if(value_size)
{
size = atoi(value_size);
@@ -980,13 +927,10 @@
}
}
- max_buffers_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_MAX_BUFFERS);
- if (max_buffers_param)
+ max_buffers_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_MAX_BUFFERS);
+ if(max_buffers_param)
{
- value_num =
- (axis2_char_t *) axutil_param_get_value (max_buffers_param, env);
+ value_num = (axis2_char_t *)axutil_param_get_value(max_buffers_param, env);
if(value_num)
{
num = atoi(value_num);
@@ -994,54 +938,45 @@
}
}
- callback_name_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_CACHING_CALLBACK);
+ callback_name_param = axis2_msg_ctx_get_parameter(msg_ctx, env,
+ AXIS2_MTOM_CACHING_CALLBACK);
if(callback_name_param)
{
- value_callback =
- (axis2_char_t *) axutil_param_get_value (callback_name_param, env);
+ value_callback = (axis2_char_t *)axutil_param_get_value(callback_name_param, env);
if(value_callback)
{
axiom_mime_parser_set_caching_callback_name(mime_parser, env, value_callback);
}
}
-
- attachment_dir_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_ATTACHMENT_DIR);
+ attachment_dir_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ATTACHMENT_DIR);
if(attachment_dir_param)
{
- value_dir =
- (axis2_char_t *) axutil_param_get_value (attachment_dir_param, env);
+ value_dir = (axis2_char_t *)axutil_param_get_value(attachment_dir_param, env);
if(value_dir)
{
axiom_mime_parser_set_attachment_dir(mime_parser, env, value_dir);
}
}
-
- if (mime_parser)
+ if(mime_parser)
{
/*binary_data_map =
- axiom_mime_parser_parse(mime_parser, env,
- axis2_http_transport_utils_on_data_request,
- (void *) callback_ctx,
- mime_boundary);*/
- if (!binary_data_map)
+ axiom_mime_parser_parse(mime_parser, env,
+ axis2_http_transport_utils_on_data_request,
+ (void *) callback_ctx,
+ mime_boundary);*/
+ if(!binary_data_map)
{
return AXIS2_FAILURE;
}
- soap_body_len =
- axiom_mime_parser_get_soap_body_len(mime_parser, env);
- soap_body_str =
- axiom_mime_parser_get_soap_body_str(mime_parser, env);
+ soap_body_len = axiom_mime_parser_get_soap_body_len(mime_parser, env);
+ soap_body_str = axiom_mime_parser_get_soap_body_str(mime_parser, env);
}
stream = axutil_stream_create_basic(env);
- if (stream)
+ if(stream)
{
axutil_stream_write(stream, env, soap_body_str, soap_body_len);
callback_ctx->in_stream = stream;
@@ -1055,21 +990,15 @@
AXIS2_FREE(env->allocator, mime_boundary);
}
- axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env,
- request_uri));
+ axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, request_uri));
axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
- char_set_str =
- axis2_http_transport_utils_get_charset_enc(env, content_type);
- xml_reader =
- axiom_xml_reader_create_for_io(env,
- axis2_http_transport_utils_on_data_request,
- NULL, (void *) callback_ctx,
- axutil_string_get_buffer(char_set_str,
- env));
+ char_set_str = axis2_http_transport_utils_get_charset_enc(env, content_type);
+ xml_reader = axiom_xml_reader_create_for_io(env, axis2_http_transport_utils_on_data_request,
+ NULL, (void *)callback_ctx, axutil_string_get_buffer(char_set_str, env));
- if (!xml_reader)
+ if(!xml_reader)
{
return AXIS2_FAILURE;
}
@@ -1077,22 +1006,22 @@
axis2_msg_ctx_set_charset_encoding(msg_ctx, env, char_set_str);
om_builder = axiom_stax_builder_create(env, xml_reader);
- if (!om_builder)
+ if(!om_builder)
{
axiom_xml_reader_free(xml_reader, env);
xml_reader = NULL;
return AXIS2_FAILURE;
}
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
{
is_soap11 = AXIS2_FALSE;
soap_builder = axiom_soap_builder_create(env, om_builder,
- AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
- if (!soap_builder)
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+ if(!soap_builder)
{
/* We should not be freeing om_builder here as it is done by
- axiom_soap_builder_create in case of error - Samisa */
+ axiom_soap_builder_create in case of error - Samisa */
om_builder = NULL;
xml_reader = NULL;
axis2_msg_ctx_set_is_soap_11(msg_ctx, env, is_soap11);
@@ -1100,7 +1029,7 @@
}
soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
- if (!soap_envelope)
+ if(!soap_envelope)
{
axiom_stax_builder_free(om_builder, env);
om_builder = NULL;
@@ -1111,10 +1040,10 @@
return AXIS2_FAILURE;
}
}
- else if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
{
do_rest = AXIS2_TRUE;
- if (soap_action_header)
+ if(soap_action_header)
{
return AXIS2_FAILURE;
}
@@ -1124,8 +1053,7 @@
do_rest = AXIS2_TRUE;
}
}
- else if (strstr
- (content_type, AXIS2_HTTP_HEADER_ACCEPT_X_WWW_FORM_URLENCODED))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_X_WWW_FORM_URLENCODED))
{
/* REST support */
do_rest = AXIS2_TRUE;
@@ -1134,28 +1062,23 @@
else
{
http_error_property = axutil_property_create(env);
- axutil_property_set_value(http_error_property, env,
- AXIS2_HTTP_UNSUPPORTED_MEDIA_TYPE);
- axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HTTP_TRANSPORT_ERROR,
- http_error_property);
+ axutil_property_set_value(http_error_property, env, AXIS2_HTTP_UNSUPPORTED_MEDIA_TYPE);
+ axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_HTTP_TRANSPORT_ERROR, http_error_property);
}
- if (do_rest)
+ if(do_rest)
{
/* REST support */
- axutil_param_t *rest_param =
- axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ENABLE_REST);
- if (rest_param &&
- 0 == axutil_strcmp(AXIS2_VALUE_TRUE,
- axutil_param_get_value(rest_param, env)))
+ axutil_param_t *rest_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ENABLE_REST);
+ if(rest_param && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, axutil_param_get_value(rest_param,
+ env)))
{
axiom_soap_body_t *def_body = NULL;
axiom_document_t *om_doc = NULL;
axiom_node_t *root_node = NULL;
- if (!run_as_get)
+ if(!run_as_get)
{
- soap_envelope = axiom_soap_envelope_create_default_soap_envelope
- (env, AXIOM_SOAP11);
+ soap_envelope = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
def_body = axiom_soap_envelope_get_body(soap_envelope, env);
om_doc = axiom_stax_builder_get_document(om_builder, env);
root_node = axiom_document_build_all(om_doc, env);
@@ -1163,63 +1086,60 @@
}
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_PUT);
- axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
+ axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
}
else
{
return AXIS2_FAILURE;
}
- if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env,
- msg_ctx))
+ if(AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
{
return AXIS2_FAILURE;
}
}
- if (run_as_get)
+ if(run_as_get)
{
axis2_char_t *buffer = NULL;
axis2_char_t *new_url = NULL;
buffer = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (content_length + 1));
- if (!buffer)
+ if(!buffer)
{
return AXIS2_FAILURE;
}
- axis2_http_transport_utils_on_data_request(buffer, content_length, (void *) callback_ctx);
-
- new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
- ((int)(strlen(request_uri) + strlen(buffer)) + 2));
- if (!new_url)
+ axis2_http_transport_utils_on_data_request(buffer, content_length, (void *)callback_ctx);
+
+ new_url = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * ((int)(strlen(request_uri)
+ + strlen(buffer)) + 2));
+ if(!new_url)
{
return AXIS2_FAILURE;
}
sprintf(new_url, "%s?%s", request_uri, buffer);
AXIS2_FREE(env->allocator, buffer);
- soap_envelope =
- axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
axis2_http_transport_utils_get_request_params(env, new_url), AXIS2_HTTP_POST);
}
- if (binary_data_map)
+ if(binary_data_map)
{
- axiom_soap_builder_set_mime_body_parts(soap_builder, env,
- binary_data_map);
+ axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
}
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
engine = axis2_engine_create(env, conf_ctx);
- if (!soap_envelope)
+ if(!soap_envelope)
return AXIS2_FAILURE;
soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
- if (!soap_body)
+ if(!soap_body)
return AXIS2_FAILURE;
- if (AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
+ if(AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
{
status = axis2_engine_receive_fault(engine, env, msg_ctx);
}
@@ -1227,35 +1147,33 @@
{
status = axis2_engine_receive(engine, env, msg_ctx);
}
- if (!axis2_msg_ctx_get_soap_envelope(msg_ctx, env) &&
- AXIS2_FALSE == is_soap11)
+ if(!axis2_msg_ctx_get_soap_envelope(msg_ctx, env) && AXIS2_FALSE == is_soap11)
{
- axiom_soap_envelope_t *def_envelope =
- axiom_soap_envelope_create_default_soap_envelope(env,
- AXIOM_SOAP12);
+ axiom_soap_envelope_t *def_envelope = axiom_soap_envelope_create_default_soap_envelope(env,
+ AXIOM_SOAP12);
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, def_envelope);
}
- if (engine)
+ if(engine)
{
axis2_engine_free(engine, env);
}
- if (soap_body_str)
+ if(soap_body_str)
{
AXIS2_FREE(env->allocator, soap_body_str);
}
- if (stream)
+ if(stream)
{
axutil_stream_free(stream, env);
}
- if (char_set_str)
+ if(char_set_str)
{
axutil_string_free(char_set_str, env);
}
- if (!soap_builder && om_builder)
+ if(!soap_builder && om_builder)
{
axiom_stax_builder_free_self(om_builder, env);
om_builder = NULL;
@@ -1263,7 +1181,6 @@
return status;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_http_transport_utils_process_http_head_request(
const axutil_env_t * env,
@@ -1286,23 +1203,21 @@
AXIS2_PARAM_CHECK(env->error, request_uri, AXIS2_FALSE);
- axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env,
- request_uri));
+ axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, request_uri));
axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
{
- if (soap_action_header)
+ if(soap_action_header)
{
do_rest = AXIS2_FALSE;
}
}
- else if (strstr
- (content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
{
do_rest = AXIS2_FALSE;
}
- if (do_rest)
+ if(do_rest)
{
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_HEAD);
@@ -1311,14 +1226,14 @@
{
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_FALSE);
}
- if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
+ if(AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
{
- return AXIS2_FALSE;
+ return AXIS2_FALSE;
}
- soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
- request_params, AXIS2_HTTP_HEAD);
- if (!soap_envelope)
+ soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ request_params, AXIS2_HTTP_HEAD);
+ if(!soap_envelope)
{
return AXIS2_FALSE;
}
@@ -1349,23 +1264,21 @@
AXIS2_PARAM_CHECK(env->error, out_stream, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, request_uri, AXIS2_FALSE);
- axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env,
- request_uri));
+ axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, request_uri));
axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
- if (content_type && strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
+ if(content_type && strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
{
- if (soap_action_header)
+ if(soap_action_header)
{
do_rest = AXIS2_FALSE;
}
}
- else if (content_type && strstr
- (content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
+ else if(content_type && strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
{
do_rest = AXIS2_FALSE;
}
- if (do_rest)
+ if(do_rest)
{
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_GET);
@@ -1375,19 +1288,18 @@
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_FALSE);
}
- if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
- {
- return AXIS2_FALSE;
- }
+ if(AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
+ {
+ return AXIS2_FALSE;
+ }
soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
- request_params,
- AXIS2_HTTP_GET);
- if (!soap_envelope)
+ request_params, AXIS2_HTTP_GET);
+ if(!soap_envelope)
{
return AXIS2_FALSE;
}
axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
-
+
engine = axis2_engine_create(env, conf_ctx);
axis2_engine_receive(engine, env, msg_ctx);
return AXIS2_TRUE;
@@ -1414,23 +1326,21 @@
AXIS2_PARAM_CHECK(env->error, out_stream, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, request_uri, AXIS2_FALSE);
- axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env,
- request_uri));
+ axis2_msg_ctx_set_to(msg_ctx, env, axis2_endpoint_ref_create(env, request_uri));
axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML))
{
- if (soap_action_header)
+ if(soap_action_header)
{
do_rest = AXIS2_FALSE;
}
}
- else if (strstr
- (content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
+ else if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP))
{
do_rest = AXIS2_FALSE;
}
- if (do_rest)
+ if(do_rest)
{
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_TRUE);
axis2_msg_ctx_set_rest_http_method(msg_ctx, env, AXIS2_HTTP_DELETE);
@@ -1440,23 +1350,19 @@
axis2_msg_ctx_set_doing_rest(msg_ctx, env, AXIS2_FALSE);
}
-
- soap_envelope =
- axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
- request_params,
- AXIS2_HTTP_DELETE);
- if (!soap_envelope)
+ soap_envelope = axis2_http_transport_utils_handle_media_type_url_encoded(env, msg_ctx,
+ request_params, AXIS2_HTTP_DELETE);
+ if(!soap_envelope)
{
return AXIS2_FALSE;
}
-
- axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
+ axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
- if (AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
- {
- return AXIS2_FALSE;
- }
+ if(AXIS2_SUCCESS != axis2_http_transport_utils_dispatch_and_verify(env, msg_ctx))
+ {
+ return AXIS2_FALSE;
+ }
engine = axis2_engine_create(env, conf_ctx);
axis2_engine_receive(engine, env, msg_ctx);
return AXIS2_TRUE;
@@ -1487,31 +1393,31 @@
AXIS2_PARAM_CHECK(env->error, request_uri, NULL);
- if (!tmp || AXIS2_ESC_NULL == *(tmp + 1))
+ if(!tmp || AXIS2_ESC_NULL == *(tmp + 1))
{
return NULL;
}
query_str = axutil_strdup(env, tmp + 1);
- for (tmp2 = tmp = query_str; *tmp != AXIS2_ESC_NULL; ++tmp)
+ for(tmp2 = tmp = query_str; *tmp != AXIS2_ESC_NULL; ++tmp)
{
- if (AXIS2_EQ == *tmp)
+ if(AXIS2_EQ == *tmp)
{
*tmp = AXIS2_ESC_NULL;
tmp_name = axutil_strdup(env, tmp2);
axis2_http_transport_utils_strdecode(env, tmp_name, tmp_name);
tmp2 = tmp + 1;
}
- if (AXIS2_AND == *tmp)
+ if(AXIS2_AND == *tmp)
{
*tmp = AXIS2_ESC_NULL;
tmp_value = axutil_strdup(env, tmp2);
axis2_http_transport_utils_strdecode(env, tmp_value, tmp_value);
tmp2 = tmp + 1;
}
- if (tmp_name && NULL != tmp_value)
+ if(tmp_name && NULL != tmp_value)
{
- if (!ret)
+ if(!ret)
{
ret = axutil_hash_make(env);
}
@@ -1520,9 +1426,9 @@
tmp_value = NULL;
}
}
- if (tmp_name && AXIS2_ESC_NULL != *tmp2)
+ if(tmp_name && AXIS2_ESC_NULL != *tmp2)
{
- if (!ret)
+ if(!ret)
{
ret = axutil_hash_make(env);
}
@@ -1543,12 +1449,12 @@
AXIS2_PARAM_CHECK(env->error, dest, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, src, AXIS2_FAILURE);
- for (; *src != AXIS2_ESC_NULL; ++dest, ++src)
+ for(; *src != AXIS2_ESC_NULL; ++dest, ++src)
{
- if (src[0] == AXIS2_PERCENT && isxdigit((int)src[1]) && isxdigit((int)src[2]))
+ if(src[0] == AXIS2_PERCENT && isxdigit((int)src[1]) && isxdigit((int)src[2]))
{
- *dest = (axis2_char_t)(axis2_http_transport_utils_hexit(src[1]) * 16 +
- axis2_http_transport_utils_hexit(src[2]));
+ *dest = (axis2_char_t)(axis2_http_transport_utils_hexit(src[1]) * 16
+ + axis2_http_transport_utils_hexit(src[2]));
/* We are sure that the conversion is valid */
src += 2;
}
@@ -1566,19 +1472,19 @@
axis2_http_transport_utils_hexit(
axis2_char_t c)
{
- if (c >= '0' && c <= '9')
+ if(c >= '0' && c <= '9')
{
return c - '0';
}
- if (c >= 'a' && c <= 'f')
+ if(c >= 'a' && c <= 'f')
{
return c - 'a' + 10;
}
- if (c >= 'A' && c <= 'F')
+ if(c >= 'A' && c <= 'F')
{
return c - 'A' + 10;
}
- return 0; /* shouldn't happen, we're guarded by isxdigit() */
+ return 0; /* shouldn't happen, we're guarded by isxdigit() */
}
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
@@ -1677,7 +1583,6 @@
return AXIS2_HTTP_SERVICE_UNAVILABLE;
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axis2_http_transport_utils_get_services_html(
const axutil_env_t * env,
@@ -1686,7 +1591,7 @@
axutil_hash_t *services_map = NULL;
axutil_hash_t *errorneous_svc_map = NULL;
axis2_char_t *ret = NULL;
- axis2_char_t *tmp2 = (axis2_char_t *) "<h2>Deployed Services</h2>";
+ axis2_char_t *tmp2 = (axis2_char_t *)"<h2>Deployed Services</h2>";
axutil_hash_index_t *hi = NULL;
axis2_bool_t svcs_exists = AXIS2_FALSE;
axis2_conf_t *conf = NULL;
@@ -1695,21 +1600,18 @@
conf = axis2_conf_ctx_get_conf(conf_ctx, env);
services_map = axis2_conf_get_all_svcs(conf, env);
errorneous_svc_map = axis2_conf_get_all_faulty_svcs(conf, env);
- if (services_map && 0 != axutil_hash_count(services_map))
+ if(services_map && 0 != axutil_hash_count(services_map))
{
void *service = NULL;
axis2_char_t *sname = NULL;
axutil_hash_t *ops = NULL;
svcs_exists = AXIS2_TRUE;
- for (hi = axutil_hash_first(services_map, env);
- hi; hi = axutil_hash_next(env, hi))
+ for(hi = axutil_hash_first(services_map, env); hi; hi = axutil_hash_next(env, hi))
{
axutil_hash_this(hi, NULL, NULL, &service);
- sname = axutil_qname_get_localpart(axis2_svc_get_qname(((axis2_svc_t
- *)
- service),
- env), env);
+ sname = axutil_qname_get_localpart(axis2_svc_get_qname(((axis2_svc_t *)service), env),
+ env);
ret = axutil_stracat(env, tmp2, "<h3><u>");
tmp2 = ret;
ret = axutil_stracat(env, tmp2, sname);
@@ -1720,32 +1622,26 @@
ret = axutil_stracat(env, tmp2, "<p>");
tmp2 = ret;
- /**
- *setting services description */
- ret = axutil_stracat(env, tmp2, axis2_svc_get_svc_desc((axis2_svc_t
- *) service,
- env));
+ /**
+ *setting services description */
+ ret = axutil_stracat(env, tmp2, axis2_svc_get_svc_desc((axis2_svc_t *)service, env));
tmp2 = ret;
ret = axutil_stracat(env, tmp2, "</p>");
tmp2 = ret;
- ops = axis2_svc_get_all_ops(((axis2_svc_t *) service), env);
- if (ops && 0 != axutil_hash_count(ops))
+ ops = axis2_svc_get_all_ops(((axis2_svc_t *)service), env);
+ if(ops && 0 != axutil_hash_count(ops))
{
axutil_hash_index_t *hi2 = NULL;
void *op = NULL;
axis2_char_t *oname = NULL;
- ret =
- axutil_stracat(env, tmp2,
- "<i>Available Operations</i> <ul>");
+ ret = axutil_stracat(env, tmp2, "<i>Available Operations</i> <ul>");
AXIS2_FREE(env->allocator, tmp2);
tmp2 = ret;
- for (hi2 = axutil_hash_first(ops, env); hi2;
- hi2 = axutil_hash_next(env, hi2))
+ for(hi2 = axutil_hash_first(ops, env); hi2; hi2 = axutil_hash_next(env, hi2))
{
axutil_hash_this(hi2, NULL, NULL, &op);
- oname = axutil_qname_get_localpart(
- axis2_op_get_qname(((axis2_op_t *) op), env),
+ oname = axutil_qname_get_localpart(axis2_op_get_qname(((axis2_op_t *)op), env),
env);
ret = axutil_stracat(env, tmp2, "<li>");
AXIS2_FREE(env->allocator, tmp2);
@@ -1770,23 +1666,23 @@
}
}
- if (errorneous_svc_map && 0 != axutil_hash_count(errorneous_svc_map))
+ if(errorneous_svc_map && 0 != axutil_hash_count(errorneous_svc_map))
{
void *fsname = NULL;
svcs_exists = AXIS2_TRUE;
- ret = axutil_stracat(env, tmp2, "<hr><h2><font color=\"red\">Faulty \
+ ret = axutil_stracat(env, tmp2,
+ "<hr><h2><font color=\"red\">Faulty \
Services</font></h2>");
AXIS2_FREE(env->allocator, tmp2);
tmp2 = ret;
- for (hi = axutil_hash_first(errorneous_svc_map, env); hi;
- axutil_hash_next(env, hi))
+ for(hi = axutil_hash_first(errorneous_svc_map, env); hi; axutil_hash_next(env, hi))
{
- axutil_hash_this(hi, (const void **) &fsname, NULL, NULL);
+ axutil_hash_this(hi, (const void **)&fsname, NULL, NULL);
ret = axutil_stracat(env, tmp2, "<h3><font color=\"red\">");
AXIS2_FREE(env->allocator, tmp2);
tmp2 = ret;
- ret = axutil_stracat(env, tmp2, (axis2_char_t *) fsname);
+ ret = axutil_stracat(env, tmp2, (axis2_char_t *)fsname);
AXIS2_FREE(env->allocator, tmp2);
tmp2 = ret;
ret = axutil_stracat(env, tmp2, "</font></h3>");
@@ -1794,14 +1690,12 @@
tmp2 = ret;
}
}
- if (AXIS2_FALSE == svcs_exists)
+ if(AXIS2_FALSE == svcs_exists)
{
ret = axutil_strdup(env, "<h2>There are no services deployed</h2>");
}
- ret =
- axutil_stracat(env,
- "<html><head><title>Axis2C :: Services</title></head>"
- "<body><font face=\"courier\">", tmp2);
+ ret = axutil_stracat(env, "<html><head><title>Axis2C :: Services</title></head>"
+ "<body><font face=\"courier\">", tmp2);
tmp2 = ret;
ret = axutil_stracat(env, tmp2, "</font></body></html>\r\n");
@@ -1827,7 +1721,7 @@
AXIS2_PARAM_CHECK(env->error, request_url, NULL);
url_tok = axutil_parse_request_url_for_svc_and_op(env, request_url);
- if (url_tok[0])
+ if(url_tok[0])
{
len = (int)strlen(url_tok[0]);
/* We are sure that the difference lies within the int range */
@@ -1838,30 +1732,24 @@
conf = axis2_conf_ctx_get_conf(conf_ctx, env);
services_map = axis2_conf_get_all_svcs(conf, env);
- if (services_map && 0 != axutil_hash_count(services_map))
+ if(services_map && 0 != axutil_hash_count(services_map))
{
void *service = NULL;
axis2_char_t *sname = NULL;
- for (hi = axutil_hash_first(services_map, env);
- hi; hi = axutil_hash_next(env, hi))
+ for(hi = axutil_hash_first(services_map, env); hi; hi = axutil_hash_next(env, hi))
{
axutil_hash_this(hi, NULL, NULL, &service);
- sname = axutil_qname_get_localpart(axis2_svc_get_qname(((axis2_svc_t
- *)
- service),
- env), env);
- if (!axutil_strcmp(svc_name, sname))
- {
- wsdl_path = (axis2_char_t *) axutil_strdup(env,
- axis2_svc_get_svc_wsdl_path((axis2_svc_t *)
- service, env));
- if (!wsdl_path)
- {
- wsdl_path = axutil_strcat(env,
- axis2_svc_get_svc_folder_path((axis2_svc_t *)
- service, env), AXIS2_PATH_SEP_STR,
- svc_name, ".wsdl", NULL);
+ sname = axutil_qname_get_localpart(axis2_svc_get_qname(((axis2_svc_t *)service), env),
+ env);
+ if(!axutil_strcmp(svc_name, sname))
+ {
+ wsdl_path = (axis2_char_t *)axutil_strdup(env, axis2_svc_get_svc_wsdl_path(
+ (axis2_svc_t *)service, env));
+ if(!wsdl_path)
+ {
+ wsdl_path = axutil_strcat(env, axis2_svc_get_svc_folder_path(
+ (axis2_svc_t *)service, env), AXIS2_PATH_SEP_STR, svc_name, ".wsdl", NULL);
}
break;
}
@@ -1869,7 +1757,7 @@
}
}
- if (wsdl_path)
+ if(wsdl_path)
{
FILE *wsdl_file;
axis2_char_t *content = NULL;
@@ -1878,17 +1766,17 @@
axis2_char_t *tmp;
int i = 0;
- content = (axis2_char_t *) AXIS2_MALLOC(env->allocator, size);
+ content = (axis2_char_t *)AXIS2_MALLOC(env->allocator, size);
wsdl_file = fopen(wsdl_path, "r");
- if (wsdl_file)
+ if(wsdl_file)
{
c = fgetc(wsdl_file);
- while (c != EOF)
+ while(c != EOF)
{
- if (i >= size)
+ if(i >= size)
{
size = size * 3;
- tmp = (axis2_char_t *) AXIS2_MALLOC(env->allocator, size);
+ tmp = (axis2_char_t *)AXIS2_MALLOC(env->allocator, size);
memcpy(tmp, content, i);
AXIS2_FREE(env->allocator, content);
content = tmp;
@@ -1921,32 +1809,30 @@
AXIS2_PARAM_CHECK(env->error, content_type, NULL);
- tmp_content_type = (axis2_char_t *) content_type;
- if (!tmp_content_type)
+ tmp_content_type = (axis2_char_t *)content_type;
+ if(!tmp_content_type)
{
return axutil_string_create_const(env,
- (axis2_char_t **) &
- AXIS2_TRANS_UTIL_DEFAULT_CHAR_ENCODING);
+ (axis2_char_t **)&AXIS2_TRANS_UTIL_DEFAULT_CHAR_ENCODING);
}
tmp = strstr(tmp_content_type, AXIS2_HTTP_CHAR_SET_ENCODING);
- if (tmp)
+ if(tmp)
{
tmp = strchr(tmp, AXIS2_EQ);
- if (tmp)
+ if(tmp)
{
tmp2 = strchr(tmp, AXIS2_SEMI_COLON);
- if (!tmp2)
+ if(!tmp2)
{
- tmp2 = tmp + strlen(tmp);
+ tmp2 = tmp + strlen(tmp);
}
}
- if (tmp2)
+ if(tmp2)
{
- if ('\'' == *(tmp2 - sizeof(axis2_char_t)) ||
- '\"' == *(tmp2 - sizeof(axis2_char_t)))
+ if('\'' == *(tmp2 - sizeof(axis2_char_t)) || '\"' == *(tmp2 - sizeof(axis2_char_t)))
{
tmp2 -= sizeof(axis2_char_t);
}
@@ -1954,7 +1840,7 @@
}
}
- if (tmp)
+ if(tmp)
{
/* Following formats are acceptable
* charset="UTF-8"
@@ -1962,8 +1848,8 @@
* charset=UTF-8
* But for our requirements charset we get should be UTF-8
*/
- if (AXIS2_ESC_SINGLE_QUOTE == *(tmp + sizeof(axis2_char_t)) ||
- AXIS2_ESC_DOUBLE_QUOTE == *(tmp + sizeof(axis2_char_t)))
+ if(AXIS2_ESC_SINGLE_QUOTE == *(tmp + sizeof(axis2_char_t)) || AXIS2_ESC_DOUBLE_QUOTE
+ == *(tmp + sizeof(axis2_char_t)))
{
tmp += 2 * sizeof(axis2_char_t);
}
@@ -1973,16 +1859,14 @@
}
}
- if (tmp)
+ if(tmp)
{
str = axutil_string_create(env, tmp);
}
else
{
- str =
- axutil_string_create_const(env,
- (axis2_char_t **) &
- AXIS2_TRANS_UTIL_DEFAULT_CHAR_ENCODING);
+ str = axutil_string_create_const(env,
+ (axis2_char_t **)&AXIS2_TRANS_UTIL_DEFAULT_CHAR_ENCODING);
}
return str;
}
@@ -1995,24 +1879,23 @@
{
const axutil_env_t *env = NULL;
int len = -1;
- axis2_callback_info_t *cb_ctx = (axis2_callback_info_t *) ctx;
+ axis2_callback_info_t *cb_ctx = (axis2_callback_info_t *)ctx;
- if (!buffer || !ctx)
+ if(!buffer || !ctx)
{
return 0;
}
- env = ((axis2_callback_info_t *) ctx)->env;
- if (cb_ctx->unread_len <= 0 && -1 != cb_ctx->content_length)
+ env = ((axis2_callback_info_t *)ctx)->env;
+ if(cb_ctx->unread_len <= 0 && -1 != cb_ctx->content_length)
{
return 0;
}
- if (cb_ctx->chunked_stream)
+ if(cb_ctx->chunked_stream)
{
- --size;
+ --size;
/* reserve space to insert trailing null */
- len = axutil_http_chunked_stream_read(cb_ctx->chunked_stream, env,
- buffer, size);
- if (len >= 0)
+ len = axutil_http_chunked_stream_read(cb_ctx->chunked_stream, env, buffer, size);
+ if(len >= 0)
{
buffer[len] = AXIS2_ESC_NULL;
}
@@ -2020,18 +1903,17 @@
else
{
axutil_stream_t *in_stream = NULL;
- in_stream =
- (axutil_stream_t *) ((axis2_callback_info_t *) ctx)->in_stream;
- --size; /* reserve space to insert trailing null */
+ in_stream = (axutil_stream_t *)((axis2_callback_info_t *)ctx)->in_stream;
+ --size; /* reserve space to insert trailing null */
len = axutil_stream_read(in_stream, env, buffer, size);
- if (len > 0)
+ if(len > 0)
{
buffer[len] = AXIS2_ESC_NULL;
- ((axis2_callback_info_t *) ctx)->unread_len -= len;
+ ((axis2_callback_info_t *)ctx)->unread_len -= len;
}
else if(len == 0)
{
- ((axis2_callback_info_t *) ctx)->unread_len = 0;
+ ((axis2_callback_info_t *)ctx)->unread_len = 0;
}
}
return len;
@@ -2053,21 +1935,21 @@
axutil_property_t *property = NULL;
axutil_hash_t *binary_data_map = NULL;
axiom_soap_envelope_t *soap_envelope = NULL;
- axutil_stream_t *stream = NULL;
+ axutil_stream_t *stream = NULL;
AXIS2_PARAM_CHECK(env->error, msg_ctx, NULL);
AXIS2_PARAM_CHECK(env->error, soap_ns_uri, NULL);
property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_TRANSPORT_IN);
- if (property)
+ if(property)
{
in_stream = axutil_property_get_value(property, env);
property = NULL;
}
callback_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
/* Note: the memory created above is freed in xml reader free function
- as this is passed on to the reader */
- if (!callback_ctx)
+ as this is passed on to the reader */
+ if(!callback_ctx)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -2078,57 +1960,51 @@
callback_ctx->unread_len = -1;
callback_ctx->chunked_stream = NULL;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- AXIS2_HTTP_HEADER_CONTENT_LENGTH);
- if (property)
+ property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_HTTP_HEADER_CONTENT_LENGTH);
+ if(property)
{
content_length = axutil_property_get_value(property, env);
property = NULL;
}
- if (content_length)
+ if(content_length)
{
callback_ctx->content_length = *content_length;
callback_ctx->unread_len = *content_length;
}
- if (!in_stream)
+ if(!in_stream)
{
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_IN_STREAM_IN_MSG_CTX,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_IN_STREAM_IN_MSG_CTX, AXIS2_FAILURE);
AXIS2_FREE(env->allocator, callback_ctx);
return NULL;
}
trans_enc = axis2_msg_ctx_get_transfer_encoding(msg_ctx, env);
- if (trans_enc && 0 == axutil_strcmp(trans_enc,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(trans_enc && 0 == axutil_strcmp(trans_enc, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
- callback_ctx->chunked_stream = axutil_http_chunked_stream_create(env,
- in_stream);
- if (!callback_ctx->chunked_stream)
+ callback_ctx->chunked_stream = axutil_http_chunked_stream_create(env, in_stream);
+ if(!callback_ctx->chunked_stream)
{
return NULL;
}
}
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
- if (op_ctx)
+ if(op_ctx)
{
axis2_ctx_t *ctx = axis2_op_ctx_get_base(op_ctx, env);
- if (ctx)
+ if(ctx)
{
- property = axis2_ctx_get_property(ctx, env,
- AXIS2_CHARACTER_SET_ENCODING);
- if (property)
+ property = axis2_ctx_get_property(ctx, env, AXIS2_CHARACTER_SET_ENCODING);
+ if(property)
{
char_set_enc = axutil_property_get_value(property, env);
property = NULL;
}
- property = axis2_ctx_get_property(ctx, env,
- MTOM_RECIVED_CONTENT_TYPE);
- if (property)
+ property = axis2_ctx_get_property(ctx, env, MTOM_RECIVED_CONTENT_TYPE);
+ if(property)
{
content_type = axutil_property_get_value(property, env);
property = NULL;
@@ -2137,22 +2013,19 @@
}
}
- if (!char_set_enc)
+ if(!char_set_enc)
{
char_set_enc = AXIS2_DEFAULT_CHAR_SET_ENCODING;
}
- if (content_type)
+ if(content_type)
{
axis2_char_t *mime_boundary = NULL;
axis2_msg_ctx_set_doing_mtom(msg_ctx, env, AXIS2_TRUE);
/* get mime boundry */
- mime_boundary =
- axis2_http_transport_utils_get_value_from_content_type(
- env,
- content_type,
- AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
+ mime_boundary = axis2_http_transport_utils_get_value_from_content_type(env, content_type,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
- if (mime_boundary)
+ if(mime_boundary)
{
axiom_mime_parser_t *mime_parser = NULL;
int soap_body_len = 0;
@@ -2167,20 +2040,15 @@
axis2_char_t *value_callback = NULL;
int size = 0;
int num = 0;
-
+
mime_parser = axiom_mime_parser_create(env);
/* Following are the parameters in the axis2.xml regarding MTOM */
-
- buffer_size_param =
- axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_BUFFER_SIZE);
- if (buffer_size_param)
+ buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
+ if(buffer_size_param)
{
- value_size =
- (axis2_char_t *) axutil_param_get_value (buffer_size_param, env);
+ value_size = (axis2_char_t *)axutil_param_get_value(buffer_size_param, env);
if(value_size)
{
@@ -2189,13 +2057,10 @@
}
}
- max_buffers_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_MAX_BUFFERS);
+ max_buffers_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_MAX_BUFFERS);
if(max_buffers_param)
{
- value_num =
- (axis2_char_t *) axutil_param_get_value (max_buffers_param, env);
+ value_num = (axis2_char_t *)axutil_param_get_value(max_buffers_param, env);
if(value_num)
{
num = atoi(value_num);
@@ -2203,49 +2068,39 @@
}
}
- callback_name_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_MTOM_CACHING_CALLBACK);
+ callback_name_param = axis2_msg_ctx_get_parameter(msg_ctx, env,
+ AXIS2_MTOM_CACHING_CALLBACK);
if(callback_name_param)
{
- value_callback =
- (axis2_char_t *) axutil_param_get_value (callback_name_param, env);
+ value_callback = (axis2_char_t *)axutil_param_get_value(callback_name_param, env);
if(value_callback)
{
axiom_mime_parser_set_caching_callback_name(mime_parser, env, value_callback);
}
}
-
- attachment_dir_param = axis2_msg_ctx_get_parameter (msg_ctx,
- env,
- AXIS2_ATTACHMENT_DIR);
+
+ attachment_dir_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ATTACHMENT_DIR);
if(attachment_dir_param)
{
- value_dir =
- (axis2_char_t *) axutil_param_get_value (attachment_dir_param, env);
+ value_dir = (axis2_char_t *)axutil_param_get_value(attachment_dir_param, env);
if(value_dir)
{
axiom_mime_parser_set_attachment_dir(mime_parser, env, value_dir);
}
}
-
-
- if (mime_parser)
+
+ if(mime_parser)
{
if(axiom_mime_parser_parse_for_soap(mime_parser, env,
- axis2_http_transport_utils_on_data_request,
- (void *) callback_ctx,
- mime_boundary) == AXIS2_FAILURE)
+ axis2_http_transport_utils_on_data_request, (void *)callback_ctx, mime_boundary)
+ == AXIS2_FAILURE)
{
return NULL;
}
- binary_data_map =
- axiom_mime_parser_parse_for_attachments(mime_parser, env,
- axis2_http_transport_utils_on_data_request,
- (void *) callback_ctx,
- mime_boundary,
- NULL);
+ binary_data_map = axiom_mime_parser_parse_for_attachments(mime_parser, env,
+ axis2_http_transport_utils_on_data_request, (void *)callback_ctx,
+ mime_boundary, NULL);
if(!binary_data_map)
{
return NULL;
@@ -2255,11 +2110,9 @@
{
return NULL;
}
-
- soap_body_len =
- axiom_mime_parser_get_soap_body_len(mime_parser, env);
- soap_body_str =
- axiom_mime_parser_get_soap_body_str(mime_parser, env);
+
+ soap_body_len = axiom_mime_parser_get_soap_body_len(mime_parser, env);
+ soap_body_str = axiom_mime_parser_get_soap_body_str(mime_parser, env);
}
if(callback_ctx->chunked_stream)
@@ -2269,7 +2122,7 @@
}
stream = axutil_stream_create_basic(env);
- if (stream)
+ if(stream)
{
axutil_stream_write(stream, env, soap_body_str, soap_body_len);
callback_ctx->in_stream = stream;
@@ -2280,45 +2133,42 @@
axiom_mime_parser_free(mime_parser, env);
mime_parser = NULL;
- if(mime_boundary)
- {
- AXIS2_FREE(env->allocator, mime_boundary);
- }
+ if(mime_boundary)
+ {
+ AXIS2_FREE(env->allocator, mime_boundary);
+ }
- if(soap_body_str)
- {
- AXIS2_FREE(env->allocator, soap_body_str);
- }
+ if(soap_body_str)
+ {
+ AXIS2_FREE(env->allocator, soap_body_str);
+ }
}
}
- if (AXIS2_TRUE != axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+ if(AXIS2_TRUE != axis2_msg_ctx_get_doing_rest(msg_ctx, env))
{
axiom_xml_reader_t *xml_reader = NULL;
axiom_stax_builder_t *om_builder = NULL;
axiom_soap_builder_t *soap_builder = NULL;
-
- xml_reader =
- axiom_xml_reader_create_for_io(env,
- axis2_http_transport_utils_on_data_request,
- NULL, (void *) callback_ctx,
- char_set_enc);
- if (!xml_reader)
+
+ xml_reader = axiom_xml_reader_create_for_io(env,
+ axis2_http_transport_utils_on_data_request, NULL, (void *)callback_ctx, char_set_enc);
+ if(!xml_reader)
{
return NULL;
}
om_builder = axiom_stax_builder_create(env, xml_reader);
- if (!om_builder)
+ if(!om_builder)
{
axiom_xml_reader_free(xml_reader, env);
xml_reader = NULL;
return NULL;
}
soap_builder = axiom_soap_builder_create(env, om_builder, soap_ns_uri);
- if (!soap_builder)
+ if(!soap_builder)
{
/* We should not be freeing om_builder here as it is done by
- axiom_soap_builder_create in case of error - Samisa */
+ axiom_soap_builder_create in case of error - Samisa */
om_builder = NULL;
xml_reader = NULL;
return NULL;
@@ -2326,28 +2176,26 @@
soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
- if (binary_data_map)
+ if(binary_data_map)
{
- axiom_soap_builder_set_mime_body_parts(soap_builder, env,
- binary_data_map);
+ axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
}
- if (soap_envelope)
+ if(soap_envelope)
{
/* hack to get around MTOM problem */
- axiom_soap_body_t *soap_body =
- axiom_soap_envelope_get_body(soap_envelope, env);
+ axiom_soap_body_t *soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
- if (soap_body)
+ if(soap_body)
{
axiom_soap_body_has_fault(soap_body, env);
}
}
- if(stream)
- {
- axutil_stream_free(stream, env);
- callback_ctx->in_stream = NULL;
- }
+ if(stream)
+ {
+ axutil_stream_free(stream, env);
+ callback_ctx->in_stream = NULL;
+ }
if(callback_ctx->chunked_stream)
{
axutil_http_chunked_stream_free(callback_ctx->chunked_stream, env);
@@ -2364,24 +2212,20 @@
axiom_document_t *om_doc = NULL;
axiom_node_t *root_node = NULL;
- xml_reader =
- axiom_xml_reader_create_for_io(env,
- axis2_http_transport_utils_on_data_request,
- NULL, (void *) callback_ctx,
- char_set_enc);
- if (!xml_reader)
+ xml_reader = axiom_xml_reader_create_for_io(env,
+ axis2_http_transport_utils_on_data_request, NULL, (void *)callback_ctx, char_set_enc);
+ if(!xml_reader)
{
return NULL;
}
om_builder = axiom_stax_builder_create(env, xml_reader);
- if (!om_builder)
+ if(!om_builder)
{
axiom_xml_reader_free(xml_reader, env);
xml_reader = NULL;
return NULL;
}
- soap_envelope = axiom_soap_envelope_create_default_soap_envelope
- (env, AXIOM_SOAP11);
+ soap_envelope = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
def_body = axiom_soap_envelope_get_body(soap_envelope, env);
om_doc = axiom_stax_builder_get_document(om_builder, env);
root_node = axiom_document_build_all(om_doc, env);
@@ -2406,12 +2250,12 @@
AXIS2_PARAM_CHECK(env->error, key, NULL);
tmp_content_type = axutil_strdup(env, content_type);
- if (!tmp_content_type)
+ if(!tmp_content_type)
{
return NULL;
}
tmp = strstr(tmp_content_type, key);
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, tmp_content_type);
return NULL;
@@ -2420,11 +2264,11 @@
tmp = strchr(tmp, AXIS2_EQ);
tmp2 = strchr(tmp, AXIS2_SEMI_COLON);
- if (tmp2)
+ if(tmp2)
{
*tmp2 = AXIS2_ESC_NULL;
}
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, tmp_content_type);
return NULL;
@@ -2433,14 +2277,14 @@
tmp2 = axutil_strdup(env, tmp + 1);
AXIS2_FREE(env->allocator, tmp_content_type);
- if (*tmp2 == AXIS2_DOUBLE_QUOTE)
+ if(*tmp2 == AXIS2_DOUBLE_QUOTE)
{
tmp = tmp2;
tmp2 = axutil_strdup(env, tmp + 1);
tmp2[strlen(tmp2) - 1] = AXIS2_ESC_NULL;
if(tmp)
{
- AXIS2_FREE(env->allocator, tmp);
+ AXIS2_FREE(env->allocator, tmp);
tmp = NULL;
}
@@ -2460,7 +2304,6 @@
return tmp2;
}
-
AXIS2_EXTERN axiom_soap_envelope_t *AXIS2_CALL
axis2_http_transport_utils_handle_media_type_url_encoded(
const axutil_env_t * env,
@@ -2479,61 +2322,53 @@
soap_env = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
- if (!soap_env)
+ if(!soap_env)
{
- soap_env = axiom_soap_envelope_create_default_soap_envelope(env,
- AXIOM_SOAP11);
+ soap_env = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
}
soap_body = axiom_soap_envelope_get_body(soap_env, env);
- if (!soap_body)
+ if(!soap_body)
{
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL, AXIS2_FAILURE);
return NULL;
}
body_element_node = axiom_soap_body_get_base_node(soap_body, env);
- if (body_element_node)
+ if(body_element_node)
{
body_child_node = axiom_node_get_first_child(body_element_node, env);
}
- if (!body_child_node)
+ if(!body_child_node)
{
- if (!axis2_msg_ctx_get_op(msg_ctx, env))
+ if(!axis2_msg_ctx_get_op(msg_ctx, env))
{
return NULL;
}
- body_child = axiom_element_create_with_qname(env, NULL,
- axis2_op_get_qname
- (axis2_msg_ctx_get_op
- (msg_ctx, env), env),
- &body_child_node);
+ body_child = axiom_element_create_with_qname(env, NULL, axis2_op_get_qname(
+ axis2_msg_ctx_get_op(msg_ctx, env), env), &body_child_node);
axiom_soap_body_add_child(soap_body, env, body_child_node);
- }
- if (param_map)
+ }
+ if(param_map)
{
axutil_hash_index_t *hi = NULL;
- for (hi = axutil_hash_first(param_map, env); hi;
- hi = axutil_hash_next(env, hi))
+ for(hi = axutil_hash_first(param_map, env); hi; hi = axutil_hash_next(env, hi))
{
void *name = NULL;
void *value = NULL;
axiom_node_t *node = NULL;
axiom_element_t *element = NULL;
- axutil_hash_this(hi, (const void **) &name, NULL, (void **) &value);
- element = axiom_element_create(env, NULL, (axis2_char_t *) name,
- NULL, &node);
- axiom_element_set_text(element, env, (axis2_char_t *) value, node);
+ axutil_hash_this(hi, (const void **)&name, NULL, (void **)&value);
+ element = axiom_element_create(env, NULL, (axis2_char_t *)name, NULL, &node);
+ axiom_element_set_text(element, env, (axis2_char_t *)value, node);
axiom_node_add_child(body_child_node, env, node);
}
}
return soap_env;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_transport_utils_dispatch_and_verify(
const axutil_env_t * env,
@@ -2544,732 +2379,735 @@
[... 1794 lines stripped ...]