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 [18/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/amqp/sender/axis2_amqp_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c Tue Aug 18 10:15:49 2009
@@ -22,296 +22,294 @@
#include <axis2_amqp_receiver.h>
#include <axis2_amqp_sender.h>
-static const axis2_transport_sender_ops_t amqp_sender_ops = {
- axis2_amqp_sender_init,
- axis2_amqp_sender_invoke,
- axis2_amqp_sender_clean_up,
- axis2_amqp_sender_free};
+static const axis2_transport_sender_ops_t amqp_sender_ops =
+{
+ axis2_amqp_sender_init,
+ axis2_amqp_sender_invoke,
+ axis2_amqp_sender_clean_up,
+ axis2_amqp_sender_free
+};
AXIS2_EXTERN axis2_transport_sender_t* AXIS2_CALL
-axis2_amqp_sender_create(const axutil_env_t* env)
+axis2_amqp_sender_create(
+ const axutil_env_t* env)
{
- AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_ENV_CHECK(env, NULL);
- axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
- sender_resource_pack = (axis2_amqp_sender_resource_pack_t*)
- AXIS2_MALLOC(env->allocator,
- sizeof(axis2_amqp_sender_resource_pack_t));
+ sender_resource_pack = (axis2_amqp_sender_resource_pack_t*)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_amqp_sender_resource_pack_t));
- if (!sender_resource_pack)
- {
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
+ if(!sender_resource_pack)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
- sender_resource_pack->sender.ops = &amqp_sender_ops;
- sender_resource_pack->conf_ctx = NULL;
+ sender_resource_pack->sender.ops = &amqp_sender_ops;
+ sender_resource_pack->conf_ctx = NULL;
- return &(sender_resource_pack->sender);
+ return &(sender_resource_pack->sender);
}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_amqp_sender_init(
- axis2_transport_sender_t* sender,
- const axutil_env_t* env,
- axis2_conf_ctx_t* conf_ctx,
- axis2_transport_out_desc_t* out_desc)
+ axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_out_desc_t* out_desc)
{
- axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
axutil_property_t* property = NULL;
- int* request_timeout = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
- *request_timeout = AXIS2_QPID_NULL_CONF_INT;
+ int* request_timeout = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
+ *request_timeout = AXIS2_QPID_NULL_CONF_INT;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(sender);
- sender_resource_pack->conf_ctx = conf_ctx;
+ sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(sender);
+ sender_resource_pack->conf_ctx = conf_ctx;
- /* Set request timeout */
- *request_timeout = axis2_amqp_util_get_out_desc_conf_value_int(
- out_desc, env, AXIS2_AMQP_CONF_QPID_REQUEST_TIMEOUT);
- if (*request_timeout == AXIS2_QPID_NULL_CONF_INT)
+ /* Set request timeout */
+ *request_timeout = axis2_amqp_util_get_out_desc_conf_value_int(out_desc, env,
+ AXIS2_AMQP_CONF_QPID_REQUEST_TIMEOUT);
+ if(*request_timeout == AXIS2_QPID_NULL_CONF_INT)
{
*request_timeout = AXIS2_QPID_DEFAULT_REQUEST_TIMEOUT;
}
- property = axutil_property_create_with_args(
- env, AXIS2_SCOPE_APPLICATION, 0, 0, (void*)request_timeout);
+ property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0,
+ (void*)request_timeout);
axis2_conf_ctx_set_property(sender_resource_pack->conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_REQUEST_TIMEOUT, property);
+ AXIS2_AMQP_CONF_CTX_PROPERTY_REQUEST_TIMEOUT, property);
- return AXIS2_SUCCESS;
+ return AXIS2_SUCCESS;
}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_amqp_sender_invoke(
- axis2_transport_sender_t* sender,
- const axutil_env_t* env,
- axis2_msg_ctx_t* msg_ctx)
+ axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
- axiom_soap_envelope_t* request_soap_envelope = NULL;
- axiom_xml_writer_t* xml_writer = NULL;
- axiom_output_t* request_om_output = NULL;
- axis2_char_t* request_content = NULL;
- axis2_bool_t is_server = AXIS2_TRUE;
- axis2_bool_t is_soap_11 = AXIS2_FALSE;
- axutil_string_t* content_type = NULL;
- const axis2_char_t* soap_action = NULL;
- axis2_bool_t do_mtom = AXIS2_FALSE;
- axis2_bool_t status = AXIS2_FAILURE;
-
- request_soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
-
- xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
- AXIS2_XML_PARSER_TYPE_BUFFER);
- if (!xml_writer)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create XML Writer");
- return AXIS2_FAILURE;
- }
-
- request_om_output = axiom_output_create(env, xml_writer);
- if (!request_om_output)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create OM Output");
- axiom_xml_writer_free(xml_writer, env);
- xml_writer = NULL;
- return AXIS2_FAILURE;
- }
-
- is_soap_11 = axis2_msg_ctx_get_is_soap_11(msg_ctx, env);
-
- /* Set SOAP version */
- axiom_output_set_soap11(request_om_output, env, is_soap_11);
-
- /* Content-Type */
- if (AXIS2_TRUE == is_soap_11)
- {
- /* SOAP1.1 */
- content_type = axutil_string_create(env, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML);
- }
- else
- {
- /* SOAP1.2 */
- content_type = axutil_string_create(env, AXIS2_AMQP_HEADER_ACCEPT_APPL_SOAP);
- }
-
- /* SOAP action */
- soap_action = axutil_string_get_buffer(axis2_msg_ctx_get_soap_action(msg_ctx, env), env);
-
- if (!soap_action)
- soap_action = "";
-
- /* Handle MTOM */
- do_mtom = axis2_msg_ctx_get_doing_mtom(msg_ctx, env);
-
- axiom_output_set_do_optimize(request_om_output, env, do_mtom);
- axiom_soap_envelope_serialize(request_soap_envelope, env, request_om_output, AXIS2_FALSE);
-
- if (do_mtom)
- {
- axis2_status_t mtom_status = AXIS2_FAILURE;
- axutil_array_list_t* mime_parts = NULL;
-
- mtom_status = axiom_output_flush(request_om_output, env);
-
- if (mtom_status == AXIS2_SUCCESS)
- {
- mime_parts = axiom_output_get_mime_parts(request_om_output, env);
- if (!mime_parts)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Unable to create the mime part list from request_om_output");
-
- return AXIS2_FAILURE;
- }
- else
- {
- axis2_msg_ctx_set_mime_parts(msg_ctx, env, mime_parts);
- }
- }
-
- content_type = axutil_string_create(env,
- axiom_output_get_content_type(request_om_output, env));
- }
-
- request_content = (axis2_char_t*)axiom_xml_writer_get_xml(xml_writer, env);
- if (!request_content)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Serialize the SOAP Envelope");
- return AXIS2_FAILURE;
- }
-
- is_server = axis2_amqp_util_msg_ctx_get_server_side(msg_ctx, env);
-
- if (is_server)
- {
- status = axis2_qpid_send(request_content, env,
- axutil_string_get_buffer(content_type, env), soap_action, msg_ctx);
- }
- else
- {
- if (AXIS2_TRUE == axis2_amqp_util_msg_ctx_get_use_separate_listener(
- msg_ctx, env)) /* Dual Channel */
- {
- status = axis2_qpid_send(request_content, env,
- axutil_string_get_buffer(content_type, env), soap_action, msg_ctx);
- }
- else
- {
- axis2_op_t* op = NULL;
- const axis2_char_t* mep = NULL;
-
- op = axis2_msg_ctx_get_op(msg_ctx, env);
-
- if (op)
- {
- mep = axis2_op_get_msg_exchange_pattern(op, env);
- }
-
- axis2_amqp_response_t* response = NULL;
- response = axis2_qpid_send_receive(request_content, env,
- axutil_string_get_buffer(content_type, env), soap_action, msg_ctx);
-
- if (response)
- {
- /* Create in stream */
- if (response->data)
- {
- axutil_stream_t* in_stream = NULL;
- axutil_property_t* property = NULL;
-
- in_stream = axutil_stream_create_basic(env);
- axutil_stream_write(in_stream, env, response->data,
- response->length);
-
- property = axutil_property_create(env);
- axutil_property_set_scope(property, env, AXIS2_SCOPE_REQUEST);
- axutil_property_set_free_func(property, env, axutil_stream_free_void_arg);
- axutil_property_set_value(property, env, in_stream);
-
- axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN, property);
- }
-
- if (mep)
- {
- if (0 == axutil_strcmp(mep, AXIS2_MEP_URI_OUT_IN)) /* Out-In */
- {
- axiom_soap_envelope_t* response_soap_envelope = NULL;
-
- response_soap_envelope = axis2_amqp_util_get_soap_envelope(response, env, msg_ctx);
- if (response_soap_envelope)
- {
- axis2_msg_ctx_set_response_soap_envelope(msg_ctx, env, response_soap_envelope);
- }
- }
- }
-
- status = AXIS2_SUCCESS;
-
- axis2_msg_ctx_set_status_code(msg_ctx, env, status);
-
- axis2_amqp_response_free(response, env);
- }
- else
- {
- if (mep)
- {
- if (axutil_strcmp(mep, AXIS2_MEP_URI_OUT_ONLY) == 0 ||
- axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_OUT_ONLY) == 0) /* One-way */
- {
- status = AXIS2_SUCCESS;
-
- /* Set status code in msg_ctx */
- axis2_msg_ctx_set_status_code(msg_ctx, env, status);
- }
- }
- }
- }
- }
-
- if (content_type)
- axutil_string_free(content_type, env);
-
- return status;
-}
+ axiom_soap_envelope_t* request_soap_envelope = NULL;
+ axiom_xml_writer_t* xml_writer = NULL;
+ axiom_output_t* request_om_output = NULL;
+ axis2_char_t* request_content = NULL;
+ axis2_bool_t is_server = AXIS2_TRUE;
+ axis2_bool_t is_soap_11 = AXIS2_FALSE;
+ axutil_string_t* content_type = NULL;
+ const axis2_char_t* soap_action = NULL;
+ axis2_bool_t do_mtom = AXIS2_FALSE;
+ axis2_bool_t status = AXIS2_FAILURE;
+
+ request_soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
+
+ xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if(!xml_writer)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create XML Writer");
+ return AXIS2_FAILURE;
+ }
+
+ request_om_output = axiom_output_create(env, xml_writer);
+ if(!request_om_output)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create OM Output");
+ axiom_xml_writer_free(xml_writer, env);
+ xml_writer = NULL;
+ return AXIS2_FAILURE;
+ }
+
+ is_soap_11 = axis2_msg_ctx_get_is_soap_11(msg_ctx, env);
+
+ /* Set SOAP version */
+ axiom_output_set_soap11(request_om_output, env, is_soap_11);
+
+ /* Content-Type */
+ if(AXIS2_TRUE == is_soap_11)
+ {
+ /* SOAP1.1 */
+ content_type = axutil_string_create(env, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML);
+ }
+ else
+ {
+ /* SOAP1.2 */
+ content_type = axutil_string_create(env, AXIS2_AMQP_HEADER_ACCEPT_APPL_SOAP);
+ }
+
+ /* SOAP action */
+ soap_action = axutil_string_get_buffer(axis2_msg_ctx_get_soap_action(msg_ctx, env), env);
+ if(!soap_action)
+ soap_action = "";
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ /* Handle MTOM */
+ do_mtom = axis2_msg_ctx_get_doing_mtom(msg_ctx, env);
+
+ axiom_output_set_do_optimize(request_om_output, env, do_mtom);
+ axiom_soap_envelope_serialize(request_soap_envelope, env, request_om_output, AXIS2_FALSE);
+
+ if(do_mtom)
+ {
+ axis2_status_t mtom_status = AXIS2_FAILURE;
+ axutil_array_list_t* mime_parts = NULL;
+
+ mtom_status = axiom_output_flush(request_om_output, env);
+
+ if(mtom_status == AXIS2_SUCCESS)
+ {
+ mime_parts = axiom_output_get_mime_parts(request_om_output, env);
+ if(!mime_parts)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Unable to create the mime part list from request_om_output");
+
+ return AXIS2_FAILURE;
+ }
+ else
+ {
+ axis2_msg_ctx_set_mime_parts(msg_ctx, env, mime_parts);
+ }
+ }
+
+ content_type = axutil_string_create(env, axiom_output_get_content_type(request_om_output,
+ env));
+ }
+
+ request_content = (axis2_char_t*)axiom_xml_writer_get_xml(xml_writer, env);
+ if(!request_content)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Serialize the SOAP Envelope");
+ return AXIS2_FAILURE;
+ }
+
+ is_server = axis2_amqp_util_msg_ctx_get_server_side(msg_ctx, env);
+
+ if(is_server)
+ {
+ status = axis2_qpid_send(request_content, env, axutil_string_get_buffer(content_type, env),
+ soap_action, msg_ctx);
+ }
+ else
+ {
+ if(AXIS2_TRUE == axis2_amqp_util_msg_ctx_get_use_separate_listener(msg_ctx, env)) /* Dual Channel */
+ {
+ status = axis2_qpid_send(request_content, env, axutil_string_get_buffer(content_type,
+ env), soap_action, msg_ctx);
+ }
+ else
+ {
+ axis2_op_t* op = NULL;
+ const axis2_char_t* mep = NULL;
+
+ op = axis2_msg_ctx_get_op(msg_ctx, env);
+
+ if(op)
+ {
+ mep = axis2_op_get_msg_exchange_pattern(op, env);
+ }
+
+ axis2_amqp_response_t* response = NULL;
+ response = axis2_qpid_send_receive(request_content, env, axutil_string_get_buffer(
+ content_type, env), soap_action, msg_ctx);
+
+ if(response)
+ {
+ /* Create in stream */
+ if(response->data)
+ {
+ axutil_stream_t* in_stream = NULL;
+ axutil_property_t* property = NULL;
+
+ in_stream = axutil_stream_create_basic(env);
+ axutil_stream_write(in_stream, env, response->data, response->length);
+
+ property = axutil_property_create(env);
+ axutil_property_set_scope(property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_free_func(property, env, axutil_stream_free_void_arg);
+ axutil_property_set_value(property, env, in_stream);
+
+ axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN, property);
+ }
+
+ if(mep)
+ {
+ if(0 == axutil_strcmp(mep, AXIS2_MEP_URI_OUT_IN)) /* Out-In */
+ {
+ axiom_soap_envelope_t* response_soap_envelope = NULL;
+
+ response_soap_envelope = axis2_amqp_util_get_soap_envelope(response, env,
+ msg_ctx);
+ if(response_soap_envelope)
+ {
+ axis2_msg_ctx_set_response_soap_envelope(msg_ctx, env,
+ response_soap_envelope);
+ }
+ }
+ }
+
+ status = AXIS2_SUCCESS;
+
+ axis2_msg_ctx_set_status_code(msg_ctx, env, status);
+
+ axis2_amqp_response_free(response, env);
+ }
+ else
+ {
+ if(mep)
+ {
+ if(axutil_strcmp(mep, AXIS2_MEP_URI_OUT_ONLY) == 0 || axutil_strcmp(mep,
+ AXIS2_MEP_URI_ROBUST_OUT_ONLY) == 0) /* One-way */
+ {
+ status = AXIS2_SUCCESS;
+
+ /* Set status code in msg_ctx */
+ axis2_msg_ctx_set_status_code(msg_ctx, env, status);
+ }
+ }
+ }
+ }
+ }
+
+ if(content_type)
+ axutil_string_free(content_type, env);
+
+ return status;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_amqp_sender_clean_up(
- axis2_transport_sender_t* sender,
- const axutil_env_t* env,
- axis2_msg_ctx_t* msg_ctx)
+ axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
{
- return AXIS2_SUCCESS;
+ return AXIS2_SUCCESS;
}
-
-AXIS2_EXTERN void AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
axis2_amqp_sender_free(
- axis2_transport_sender_t* sender,
- const axutil_env_t* env)
+ axis2_transport_sender_t* sender,
+ const axutil_env_t* env)
{
- AXIS2_ENV_CHECK(env, void);
+ AXIS2_ENV_CHECK(env, void);
- axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
- sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(sender);
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+ sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(sender);
- AXIS2_FREE(env->allocator, sender_resource_pack);
+ AXIS2_FREE(env->allocator, sender_resource_pack);
}
/* Library Exports */
-AXIS2_EXPORT int
+AXIS2_EXPORT int
#ifndef AXIS2_STATIC_DEPLOY
axis2_get_instance(
#else
-axis2_amqp_sender_get_instance(
+ axis2_amqp_sender_get_instance(
#endif
struct axis2_transport_sender** inst,
const axutil_env_t* env)
@@ -319,7 +317,7 @@
int status = AXIS2_SUCCESS;
*inst = axis2_amqp_sender_create(env);
- if (!(*inst))
+ if(!(*inst))
{
status = AXIS2_FAILURE;
}
@@ -327,17 +325,16 @@
return status;
}
-
AXIS2_EXPORT int
#ifndef AXIS2_STATIC_DEPLOY
axis2_remove_instance(
#else
-axis2_amqp_sender_remove_instance(
+ axis2_amqp_sender_remove_instance(
#endif
axis2_transport_sender_t* inst,
const axutil_env_t* env)
{
- if (inst)
+ if(inst)
{
axis2_transport_sender_free(inst, env);
}
Modified: webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp Tue Aug 18 10:15:49 2009
@@ -29,193 +29,214 @@
using namespace qpid::client;
using namespace qpid::framing;
-Axis2QpidSender::Axis2QpidSender(string qpidBrokerIP, int qpidBrokerPort, const axutil_env_t* env)
+Axis2QpidSender::Axis2QpidSender(
+ string qpidBrokerIP,
+ int qpidBrokerPort,
+ const axutil_env_t* env)
{
- this->qpidBrokerIP = qpidBrokerIP;
- this->qpidBrokerPort = qpidBrokerPort;
- this->env = env;
- this->responseContent = "";
- this->responseContentType = "";
+ this->qpidBrokerIP = qpidBrokerIP;
+ this->qpidBrokerPort = qpidBrokerPort;
+ this->env = env;
+ this->responseContent = "";
+ this->responseContentType = "";
}
+Axis2QpidSender::~Axis2QpidSender(
+ void)
+{
+}
-Axis2QpidSender::~Axis2QpidSender(void)
-{}
+bool
+Axis2QpidSender::SendReceive(
+ string messageContent,
+ string toQueueName,
+ bool isSOAP11,
+ string contentType,
+ string soapAction,
+ axutil_array_list_t* mime_parts,
+ int timeout)
+{
+ bool status = false;
+ this->responseContent = "";
+ this->responseContentType = "";
+ try
+ {
+ Connection connection;
+ connection.open(qpidBrokerIP, qpidBrokerPort);
-bool Axis2QpidSender::SendReceive(string messageContent, string toQueueName, bool isSOAP11,
- string contentType, string soapAction, axutil_array_list_t* mime_parts, int timeout)
-{
- bool status = false;
- this->responseContent = "";
- this->responseContentType = "";
-
- try
- {
- Connection connection;
- connection.open(qpidBrokerIP, qpidBrokerPort);
-
- Session session = connection.newSession();
-
- /* Declare Private Queue */
- string replyToQueueName = AXIS2_AMQP_TEMP_QUEUE_NAME_PREFIX;
- replyToQueueName.append(axutil_uuid_gen(env));
-
- session.queueDeclare(arg::queue = replyToQueueName, arg::autoDelete = true);
- session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
- arg::queue = replyToQueueName,
- arg::bindingKey = replyToQueueName);
-
- /* Create Message */
- Message reqMessage;
-
- reqMessage.getDeliveryProperties().setRoutingKey(toQueueName);
- reqMessage.getMessageProperties().setReplyTo(ReplyTo(AXIS2_AMQP_EXCHANGE_DIRECT, replyToQueueName));
-
- reqMessage.getHeaders().setString(AXIS2_AMQP_HEADER_CONTENT_TYPE, contentType);
- reqMessage.getHeaders().setString(AXIS2_AMQP_HEADER_SOAP_ACTION, soapAction);
-
- if (mime_parts)
- {
- string mimeBody;
- GetMimeBody(mime_parts, mimeBody);
-
- messageContent.clear();/* MIME parts include SOAP envelop */
-
- messageContent.append(mimeBody);
- }
-
- reqMessage.setData(messageContent);
-
- session.messageTransfer(arg::content = reqMessage, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
-
- /* Create subscription manager */
- SubscriptionManager subscriptionManager(session);
-
- Message resMessage;
- qpid::sys::Duration reqTimeout(timeout * AXIS2_AMQP_NANOSEC_PER_MILLISEC);
-
- if (subscriptionManager.get(resMessage, replyToQueueName, reqTimeout))
- {
- responseContent = resMessage.getData();
- responseContentType = resMessage.getHeaders().getAsString(AXIS2_AMQP_HEADER_CONTENT_TYPE);
-
- status = true;
- }
-
- connection.close();
- }
- catch (const std::exception& e)
- {
- }
+ Session session = connection.newSession();
- return status;
-}
+ /* Declare Private Queue */
+ string replyToQueueName = AXIS2_AMQP_TEMP_QUEUE_NAME_PREFIX;
+ replyToQueueName.append(axutil_uuid_gen(env));
+ session.queueDeclare(arg::queue = replyToQueueName, arg::autoDelete = true);
+ session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT, arg::queue
+ = replyToQueueName, arg::bindingKey = replyToQueueName);
-bool Axis2QpidSender::Send(string messageContent, string toQueueName, string replyToQueueName,
- bool isSOAP11, string contentType, string soapAction, axutil_array_list_t* mime_parts)
-{
- bool status = false;
+ /* Create Message */
+ Message reqMessage;
+
+ reqMessage.getDeliveryProperties().setRoutingKey(toQueueName);
+ reqMessage.getMessageProperties().setReplyTo(ReplyTo(AXIS2_AMQP_EXCHANGE_DIRECT,
+ replyToQueueName));
+
+ reqMessage.getHeaders().setString(AXIS2_AMQP_HEADER_CONTENT_TYPE, contentType);
+ reqMessage.getHeaders().setString(AXIS2_AMQP_HEADER_SOAP_ACTION, soapAction);
+
+ if(mime_parts)
+ {
+ string mimeBody;
+ GetMimeBody(mime_parts, mimeBody);
+
+ messageContent.clear();/* MIME parts include SOAP envelop */
+
+ messageContent.append(mimeBody);
+ }
+
+ reqMessage.setData(messageContent);
+
+ session.messageTransfer(arg::content = reqMessage, arg::destination
+ = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ /* Create subscription manager */
+ SubscriptionManager subscriptionManager(session);
+
+ Message resMessage;
+ qpid::sys::Duration reqTimeout(timeout * AXIS2_AMQP_NANOSEC_PER_MILLISEC);
+
+ if(subscriptionManager.get(resMessage, replyToQueueName, reqTimeout))
+ {
+ responseContent = resMessage.getData();
+ responseContentType = resMessage.getHeaders().getAsString(
+ AXIS2_AMQP_HEADER_CONTENT_TYPE);
+
+ status = true;
+ }
- try
- {
- Connection connection;
- connection.open(qpidBrokerIP, qpidBrokerPort);
-
- Session session = connection.newSession();
-
- /* Create Message */
- Message message;
-
- message.getDeliveryProperties().setRoutingKey(toQueueName);
-
- if (!replyToQueueName.empty()) /* Client dual-channel */
- {
- message.getMessageProperties().setReplyTo(ReplyTo(AXIS2_AMQP_EXCHANGE_DIRECT, replyToQueueName));
-
- session.queueDeclare(arg::queue = replyToQueueName);
- session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
- arg::queue = replyToQueueName,
- arg::bindingKey = replyToQueueName);
- }
-
- message.getHeaders().setString(AXIS2_AMQP_HEADER_CONTENT_TYPE, contentType);
- message.getHeaders().setString(AXIS2_AMQP_HEADER_SOAP_ACTION, soapAction);
-
- if (mime_parts)
- {
- string mimeBody;
- GetMimeBody(mime_parts, mimeBody);
-
- messageContent.clear();/* MIME parts include SOAP envelop */
-
- messageContent.append(mimeBody);
- }
-
- message.setData(messageContent);
-
- session.messageTransfer(arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
-
- connection.close();
-
- status = true;
- }
- catch (const std::exception& e)
- {
- }
+ connection.close();
+ }
+ catch(const std::exception& e)
+ {
+ }
- return status;
+ return status;
}
+bool
+Axis2QpidSender::Send(
+ string messageContent,
+ string toQueueName,
+ string replyToQueueName,
+ bool isSOAP11,
+ string contentType,
+ string soapAction,
+ axutil_array_list_t* mime_parts)
+{
+ bool status = false;
+
+ try
+ {
+ Connection connection;
+ connection.open(qpidBrokerIP, qpidBrokerPort);
+
+ Session session = connection.newSession();
+
+ /* Create Message */
+ Message message;
+
+ message.getDeliveryProperties().setRoutingKey(toQueueName);
+
+ if(!replyToQueueName.empty()) /* Client dual-channel */
+ {
+ message.getMessageProperties().setReplyTo(ReplyTo(AXIS2_AMQP_EXCHANGE_DIRECT,
+ replyToQueueName));
+
+ session.queueDeclare(arg::queue = replyToQueueName);
+ session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT, arg::queue
+ = replyToQueueName, arg::bindingKey = replyToQueueName);
+ }
+
+ message.getHeaders().setString(AXIS2_AMQP_HEADER_CONTENT_TYPE, contentType);
+ message.getHeaders().setString(AXIS2_AMQP_HEADER_SOAP_ACTION, soapAction);
+
+ if(mime_parts)
+ {
+ string mimeBody;
+ GetMimeBody(mime_parts, mimeBody);
+
+ messageContent.clear();/* MIME parts include SOAP envelop */
+
+ messageContent.append(mimeBody);
+ }
+
+ message.setData(messageContent);
+
+ session.messageTransfer(arg::content = message, arg::destination
+ = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ connection.close();
+
+ status = true;
+ }
+ catch(const std::exception& e)
+ {
+ }
+
+ return status;
+}
-void Axis2QpidSender::GetMimeBody(axutil_array_list_t* mime_parts, string& mimeBody)
+void
+Axis2QpidSender::GetMimeBody(
+ axutil_array_list_t* mime_parts,
+ string& mimeBody)
{
- int i = 0;
- axiom_mime_part_t *mime_part = NULL;
- axis2_status_t status = AXIS2_SUCCESS;
-
- if (!mime_parts)
- return;
-
- for (i = 0; i < axutil_array_list_size(mime_parts, env); i++)
- {
- mime_part = (axiom_mime_part_t *)axutil_array_list_get(mime_parts, env, i);
-
- if (mime_part->type == AXIOM_MIME_PART_BUFFER)
- {
- mimeBody.append(mime_part->part, mime_part->part_size);
- }
- else if (mime_part->type == AXIOM_MIME_PART_FILE)
- {
- int length;
- char* buffer;
-
- ifstream file;
- file.open(mime_part->file_name, ios::binary);
-
- file.seekg(0, ios::end);
- length = file.tellg();
- file.seekg(0, ios::beg);
-
- buffer = new char[length];
-
- file.read(buffer, length);
- file.close();
-
- mimeBody.append(buffer, length);
-
- delete [] buffer;
- }
- else
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unknown mime type");
- return;
- }
-
- if (status == AXIS2_FAILURE)
- {
- break;
- }
- }
+ int i = 0;
+ axiom_mime_part_t *mime_part = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ if(!mime_parts)
+ return;
+
+ for(i = 0; i < axutil_array_list_size(mime_parts, env); i++)
+ {
+ mime_part = (axiom_mime_part_t *)axutil_array_list_get(mime_parts, env, i);
+
+ if(mime_part->type == AXIOM_MIME_PART_BUFFER)
+ {
+ mimeBody.append(mime_part->part, mime_part->part_size);
+ }
+ else if(mime_part->type == AXIOM_MIME_PART_FILE)
+ {
+ int length;
+ char* buffer;
+
+ ifstream file;
+ file.open(mime_part->file_name, ios::binary);
+
+ file.seekg(0, ios::end);
+ length = file.tellg();
+ file.seekg(0, ios::beg);
+
+ buffer = new char[length];
+
+ file.read(buffer, length);
+ file.close();
+
+ mimeBody.append(buffer, length);
+
+ delete[] buffer;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Unknown mime type");
+ return;
+ }
+
+ if(status == AXIS2_FAILURE)
+ {
+ break;
+ }
+ }
}
Modified: webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c Tue Aug 18 10:15:49 2009
@@ -28,48 +28,49 @@
#include <axis2_amqp_receiver.h>
#include <axis2_qpid_receiver_interface.h>
-axis2_transport_receiver_t* receiver = NULL;
+axis2_transport_receiver_t* receiver = NULL;
axutil_env_t* server_env = NULL;
axutil_env_t*
-init_server_env(axutil_allocator_t* allocator,
- const axis2_char_t* log_file_name)
+init_server_env(
+ axutil_allocator_t* allocator,
+ const axis2_char_t* log_file_name)
{
- axutil_error_t* error = axutil_error_create(allocator);
- axutil_log_t* log = axutil_log_create(allocator, NULL, log_file_name);
- axutil_thread_pool_t* thread_pool = axutil_thread_pool_init(allocator);
- axutil_env_t* env = axutil_env_create_with_error_log_thread_pool(allocator,
- error, log, thread_pool);
-
- axiom_xml_reader_init();
+ axutil_error_t* error = axutil_error_create(allocator);
+ axutil_log_t* log = axutil_log_create(allocator, NULL, log_file_name);
+ axutil_thread_pool_t* thread_pool = axutil_thread_pool_init(allocator);
+ axutil_env_t* env = axutil_env_create_with_error_log_thread_pool(allocator, error, log,
+ thread_pool);
- return env;
-}
+ axiom_xml_reader_init();
+ return env;
+}
void
-server_exit(int status)
+server_exit(
+ int status)
{
- if (receiver)
- {
- axis2_transport_receiver_free(receiver, server_env);
- }
-
- if (server_env)
- {
- axutil_env_free(server_env);
- }
+ if(receiver)
+ {
+ axis2_transport_receiver_free(receiver, server_env);
+ }
+
+ if(server_env)
+ {
+ axutil_env_free(server_env);
+ }
- axiom_xml_reader_cleanup();
+ axiom_xml_reader_cleanup();
- exit(status);
+ exit(status);
}
-
void
-show_usage(axis2_char_t* prog_name)
+show_usage(
+ axis2_char_t* prog_name)
{
- fprintf(stdout, "\n Usage : %s", prog_name);
+ fprintf(stdout, "\n Usage : %s", prog_name);
fprintf(stdout, " [-i QPID_BROKER_IP]");
fprintf(stdout, " [-p QPID_BROKER_PORT]");
fprintf(stdout, " [-r REPO_PATH]");
@@ -78,155 +79,154 @@
fprintf(stdout, " [-s LOG_FILE_SIZE]\n");
fprintf(stdout, " Options :\n");
fprintf(stdout, "\t-i QPID_BROKER_IP \t Qpid broker IP, default is 127.0.0.1\n");
- fprintf(stdout, "\t-p QPID_BROKER_PORT \t the port on which the Qpid broker listens, default is 5672\n");
- fprintf(stdout, "\t-r REPO_PATH \t\t repository path, default is ../\n");
fprintf(stdout,
- "\t-l LOG_LEVEL\t\t log level, available log levels:"
- "\n\t\t\t\t\t 0 - critical 1 - errors 2 - warnings"
- "\n\t\t\t\t\t 3 - information 4 - debug 5- user 6 - trace"
- "\n\t\t\t\t\t Default log level is 4(debug).\n");
+ "\t-p QPID_BROKER_PORT \t the port on which the Qpid broker listens, default is 5672\n");
+ fprintf(stdout, "\t-r REPO_PATH \t\t repository path, default is ../\n");
+ fprintf(stdout, "\t-l LOG_LEVEL\t\t log level, available log levels:"
+ "\n\t\t\t\t\t 0 - critical 1 - errors 2 - warnings"
+ "\n\t\t\t\t\t 3 - information 4 - debug 5- user 6 - trace"
+ "\n\t\t\t\t\t Default log level is 4(debug).\n");
#ifndef WIN32
- fprintf(stdout,
- "\t-f LOG_FILE\t\t log file, default is $AXIS2C_HOME/logs/axis2.log"
- "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+ fprintf(stdout, "\t-f LOG_FILE\t\t log file, default is $AXIS2C_HOME/logs/axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
#else
fprintf(stdout,
- "\t-f LOG_FILE\t\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
- "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+ "\t-f LOG_FILE\t\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
#endif
fprintf(stdout,
- "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
+ "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
fprintf(stdout, " Help :\n\t-h \t\t\t display this help screen.\n\n");
}
#ifndef WIN32
void
-sig_handler(int signal)
+sig_handler(
+ int signal)
{
- switch (signal)
- {
- case SIGINT:
- AXIS2_LOG_INFO(server_env->log, "Received signal SIGINT.Server shutting down");
- axis2_amqp_receiver_stop(receiver, server_env);
+ switch(signal)
+ {
+ case SIGINT:
+ AXIS2_LOG_INFO(server_env->log, "Received signal SIGINT.Server shutting down");
+ axis2_amqp_receiver_stop(receiver, server_env);
AXIS2_LOG_INFO(server_env->log, "Shutdown complete ...");
-
- server_exit(0);
- case SIGPIPE:
- AXIS2_LOG_INFO(server_env->log, "Received signal SIGPIPE.Client request serve aborted");
- return;
-
- case SIGSEGV:
- fprintf(stderr, "Received deadly signal SIGSEGV. Terminating ...\n");
- _exit(-1);
- }
+ server_exit(0);
+
+ case SIGPIPE:
+ AXIS2_LOG_INFO(server_env->log, "Received signal SIGPIPE.Client request serve aborted");
+ return;
+
+ case SIGSEGV:
+ fprintf(stderr, "Received deadly signal SIGSEGV. Terminating ...\n");
+ _exit(-1);
+ }
}
#endif
-int
-main(int argc, char* argv[])
+int
+main(
+ int argc,
+ char* argv[])
{
- axutil_allocator_t* allocator = NULL;
- extern char* optarg;
- extern int optopt;
- int c;
- const axis2_char_t* qpid_broker_ip = NULL;
- int qpid_broker_port = AXIS2_QPID_NULL_CONF_INT;
- const axis2_char_t* repo_path = AXIS2_AMQP_SERVER_REPO_PATH;
- axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
- const axis2_char_t* log_file_name = AXIS2_AMQP_SERVER_LOG_FILE_NAME;
- int log_file_size = AXUTIL_LOG_FILE_SIZE;
-
- while ((c = AXIS2_GETOPT(argc, argv, "i:p:r:l:f:s:h")) != -1)
- {
- switch (c)
- {
- case 'i':
- qpid_broker_ip = optarg;
- break;
-
- case 'p':
- qpid_broker_port = AXIS2_ATOI(optarg);
- break;
-
- case 'r':
- repo_path = optarg;
- break;
-
- case 'l':
- log_level = AXIS2_ATOI(optarg);
- if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
- log_level = AXIS2_LOG_LEVEL_CRITICAL;
- if (log_level > AXIS2_LOG_LEVEL_TRACE)
- log_level = AXIS2_LOG_LEVEL_TRACE;
- break;
-
- case 'f':
- log_file_name = optarg;
- break;
-
- case 's':
- log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg);
- break;
-
- case 'h':
- show_usage(argv[0]);
- return 0;
-
- case ':':
- fprintf(stderr, "\nOption -%c requires an operand\n", optopt);
- show_usage(argv[0]);
- return -1;
-
- case '?':
- if (isprint(optopt))
- fprintf(stderr, "\nUnknown option `-%c'.\n", optopt);
- show_usage(argv[0]);
- return -1;
- }
- }
-
- allocator = axutil_allocator_init(NULL);
- if (!allocator)
- {
- server_exit(-1);
- }
-
- server_env = init_server_env(allocator, log_file_name);
- server_env->log->level = log_level;
- server_env->log->size = log_file_size;
+ axutil_allocator_t* allocator = NULL;
+ extern char* optarg;
+ extern int optopt;
+ int c;
+ const axis2_char_t* qpid_broker_ip = NULL;
+ int qpid_broker_port = AXIS2_QPID_NULL_CONF_INT;
+ const axis2_char_t* repo_path = AXIS2_AMQP_SERVER_REPO_PATH;
+ axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
+ const axis2_char_t* log_file_name = AXIS2_AMQP_SERVER_LOG_FILE_NAME;
+ int log_file_size = AXUTIL_LOG_FILE_SIZE;
+
+ while((c = AXIS2_GETOPT(argc, argv, "i:p:r:l:f:s:h")) != -1)
+ {
+ switch(c)
+ {
+ case 'i':
+ qpid_broker_ip = optarg;
+ break;
+
+ case 'p':
+ qpid_broker_port = AXIS2_ATOI(optarg);
+ break;
+
+ case 'r':
+ repo_path = optarg;
+ break;
+
+ case 'l':
+ log_level = AXIS2_ATOI(optarg);
+ if(log_level < AXIS2_LOG_LEVEL_CRITICAL)
+ log_level = AXIS2_LOG_LEVEL_CRITICAL;
+ if(log_level > AXIS2_LOG_LEVEL_TRACE)
+ log_level = AXIS2_LOG_LEVEL_TRACE;
+ break;
+
+ case 'f':
+ log_file_name = optarg;
+ break;
+
+ case 's':
+ log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg);
+ break;
+
+ case 'h':
+ show_usage(argv[0]);
+ return 0;
+
+ case ':':
+ fprintf(stderr, "\nOption -%c requires an operand\n", optopt);
+ show_usage(argv[0]);
+ return -1;
+
+ case '?':
+ if(isprint(optopt))
+ fprintf(stderr, "\nUnknown option `-%c'.\n", optopt);
+ show_usage(argv[0]);
+ return -1;
+ }
+ }
+
+ allocator = axutil_allocator_init(NULL);
+ if(!allocator)
+ {
+ server_exit(-1);
+ }
+
+ server_env = init_server_env(allocator, log_file_name);
+ server_env->log->level = log_level;
+ server_env->log->size = log_file_size;
- axutil_error_init();
+ axutil_error_init();
#ifndef WIN32
- signal(SIGINT, sig_handler);
- signal(SIGPIPE, sig_handler);
+ signal(SIGINT, sig_handler);
+ signal(SIGPIPE, sig_handler);
#endif
- AXIS2_LOG_INFO(server_env->log, "Starting Axis2 AMQP Server ...");
- AXIS2_LOG_INFO(server_env->log, "Repo Location : %s", repo_path);
+ AXIS2_LOG_INFO(server_env->log, "Starting Axis2 AMQP Server ...");
+ AXIS2_LOG_INFO(server_env->log, "Repo Location : %s", repo_path);
- receiver = axis2_amqp_receiver_create(server_env, repo_path,
- qpid_broker_ip, qpid_broker_port);
- if (!receiver)
- {
- AXIS2_LOG_ERROR(server_env->log, AXIS2_LOG_SI,
- "Server creation failed: Error code:" " %d :: %s",
- server_env->error->error_number,
- AXIS2_ERROR_GET_MESSAGE(server_env->error));
+ receiver = axis2_amqp_receiver_create(server_env, repo_path, qpid_broker_ip, qpid_broker_port);
+ if(!receiver)
+ {
+ AXIS2_LOG_ERROR(server_env->log, AXIS2_LOG_SI,
+ "Server creation failed: Error code:" " %d :: %s", server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(server_env->error));
server_exit(-1);
- }
+ }
- if (axis2_amqp_receiver_start(receiver, server_env) == AXIS2_FAILURE)
- {
- AXIS2_LOG_ERROR(server_env->log, AXIS2_LOG_SI,
- "Server start failed: Error code:" " %d :: %s",
- server_env->error->error_number,
- AXIS2_ERROR_GET_MESSAGE(server_env->error));
+ if(axis2_amqp_receiver_start(receiver, server_env) == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(server_env->log, AXIS2_LOG_SI,
+ "Server start failed: Error code:" " %d :: %s", server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(server_env->error));
server_exit(-1);
- }
+ }
- return 0;
+ return 0;
}
Modified: webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c Tue Aug 18 10:15:49 2009
@@ -25,154 +25,139 @@
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_amqp_util_get_in_desc_conf_value_string(
- axis2_transport_in_desc_t* in_desc,
- const axutil_env_t* env,
- const axis2_char_t* param_name)
+ axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
{
- axutil_param_t* param = NULL;
+ axutil_param_t* param = NULL;
axis2_char_t* value = NULL;
- param = (axutil_param_t*)
- axutil_param_container_get_param(
- axis2_transport_in_desc_param_container(in_desc, env),
- env,
- param_name);
- if (param)
+ param = (axutil_param_t*)axutil_param_container_get_param(
+ axis2_transport_in_desc_param_container(in_desc, env), env, param_name);
+ if(param)
{
- value = axutil_param_get_value(param, env);
+ value = axutil_param_get_value(param, env);
}
- return value;
+ return value;
}
-
AXIS2_EXTERN int AXIS2_CALL
axis2_amqp_util_get_in_desc_conf_value_int(
- axis2_transport_in_desc_t* in_desc,
- const axutil_env_t* env,
- const axis2_char_t* param_name)
-{
- axis2_char_t* value_str = NULL;
- int value = AXIS2_QPID_NULL_CONF_INT;
-
- value_str = axis2_amqp_util_get_in_desc_conf_value_string(
- in_desc, env, param_name);
- if (value_str)
- {
- value = atoi(value_str);
- }
+ axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axis2_char_t* value_str = NULL;
+ int value = AXIS2_QPID_NULL_CONF_INT;
- return value;
-}
+ value_str = axis2_amqp_util_get_in_desc_conf_value_string(in_desc, env, param_name);
+ if(value_str)
+ {
+ value = atoi(value_str);
+ }
+ return value;
+}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_amqp_util_get_out_desc_conf_value_string(
- axis2_transport_out_desc_t* out_desc,
- const axutil_env_t* env,
- const axis2_char_t* param_name)
+ axis2_transport_out_desc_t* out_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
{
- axutil_param_t* param = NULL;
+ axutil_param_t* param = NULL;
axis2_char_t* value = NULL;
- param = (axutil_param_t*)
- axutil_param_container_get_param(
- axis2_transport_out_desc_param_container(out_desc, env),
- env,
- param_name);
- if (param)
+ param = (axutil_param_t*)axutil_param_container_get_param(
+ axis2_transport_out_desc_param_container(out_desc, env), env, param_name);
+ if(param)
{
- value = axutil_param_get_value(param, env);
+ value = axutil_param_get_value(param, env);
}
- return value;
+ return value;
}
-
AXIS2_EXTERN int AXIS2_CALL
axis2_amqp_util_get_out_desc_conf_value_int(
- axis2_transport_out_desc_t* out_desc,
- const axutil_env_t* env,
- const axis2_char_t* param_name)
-{
- axis2_char_t* value_str = NULL;
- int value = AXIS2_QPID_NULL_CONF_INT;
-
- value_str = axis2_amqp_util_get_out_desc_conf_value_string(
- out_desc, env, param_name);
- if (value_str)
- {
- value = atoi(value_str);
- }
+ axis2_transport_out_desc_t* out_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axis2_char_t* value_str = NULL;
+ int value = AXIS2_QPID_NULL_CONF_INT;
- return value;
-}
+ value_str = axis2_amqp_util_get_out_desc_conf_value_string(out_desc, env, param_name);
+ if(value_str)
+ {
+ value = atoi(value_str);
+ }
+ return value;
+}
AXIS2_EXTERN axiom_soap_envelope_t* AXIS2_CALL
axis2_amqp_util_get_soap_envelope(
- axis2_amqp_response_t* response,
- const axutil_env_t* env,
- axis2_msg_ctx_t* msg_ctx)
-{
- axiom_xml_reader_t* xml_reader = NULL;
- axiom_stax_builder_t* stax_builder = NULL;
- axiom_soap_builder_t* soap_builder = NULL;
- axiom_soap_envelope_t* soap_envelope = NULL;
- const axis2_char_t* soap_ns_uri = NULL;
- axis2_char_t *soap_body_str = NULL;
- int soap_body_len = 0;
- axis2_bool_t is_mtom = AXIS2_FALSE;
- axutil_hash_t *binary_data_map = NULL;
- axis2_bool_t is_soap_11 = AXIS2_FALSE;
-
- if (!response || !response->data || !response->content_type)
- {
- return NULL;
- }
-
- is_soap_11 = axis2_msg_ctx_get_is_soap_11(msg_ctx, env);
-
- /* Handle MTOM */
- if (strstr(response->content_type, AXIS2_AMQP_HEADER_ACCEPT_MULTIPART_RELATED))
- {
- axis2_char_t* mime_boundary = axis2_amqp_util_get_value_from_content_type(env,
- response->content_type,
- AXIS2_AMQP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
-
- if (mime_boundary)
- {
- axiom_mime_parser_t *mime_parser = NULL;
- int soap_body_len = 0;
- axutil_param_t *buffer_size_param = NULL;
- axutil_param_t *max_buffers_param = NULL;
- axutil_param_t *attachment_dir_param = NULL;
- axis2_char_t *value_size = NULL;
- axis2_char_t *value_num = NULL;
- axis2_char_t *value_dir = NULL;
- int size = 0;
- int num = 0;
-
- 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)
- {
- 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);
- }
- }
+ axis2_amqp_response_t* response,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
+{
+ axiom_xml_reader_t* xml_reader = NULL;
+ axiom_stax_builder_t* stax_builder = NULL;
+ axiom_soap_builder_t* soap_builder = NULL;
+ axiom_soap_envelope_t* soap_envelope = NULL;
+ const axis2_char_t* soap_ns_uri = NULL;
+ axis2_char_t *soap_body_str = NULL;
+ int soap_body_len = 0;
+ axis2_bool_t is_mtom = AXIS2_FALSE;
+ axutil_hash_t *binary_data_map = NULL;
+ axis2_bool_t is_soap_11 = AXIS2_FALSE;
- max_buffers_param = axis2_msg_ctx_get_parameter(msg_ctx,
- env, AXIS2_MTOM_MAX_BUFFERS);
+ if(!response || !response->data || !response->content_type)
+ {
+ return NULL;
+ }
+
+ is_soap_11 = axis2_msg_ctx_get_is_soap_11(msg_ctx, env);
+
+ /* Handle MTOM */
+ if(strstr(response->content_type, AXIS2_AMQP_HEADER_ACCEPT_MULTIPART_RELATED))
+ {
+ axis2_char_t* mime_boundary = axis2_amqp_util_get_value_from_content_type(env,
+ response->content_type, AXIS2_AMQP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
+
+ if(mime_boundary)
+ {
+ axiom_mime_parser_t *mime_parser = NULL;
+ int soap_body_len = 0;
+ axutil_param_t *buffer_size_param = NULL;
+ axutil_param_t *max_buffers_param = NULL;
+ axutil_param_t *attachment_dir_param = NULL;
+ axis2_char_t *value_size = NULL;
+ axis2_char_t *value_num = NULL;
+ axis2_char_t *value_dir = NULL;
+ int size = 0;
+ int num = 0;
+
+ mime_parser = axiom_mime_parser_create(env);
+
+ buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
- if (max_buffers_param)
+ if(buffer_size_param)
+ {
+ 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);
+ }
+ }
+
+ 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);
@@ -183,140 +168,134 @@
}
}
- 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)
+ if(attachment_dir_param)
{
value_dir = (axis2_char_t*)axutil_param_get_value(attachment_dir_param, env);
- if (value_dir)
+ if(value_dir)
{
axiom_mime_parser_set_attachment_dir(mime_parser, env, value_dir);
}
}
- if (mime_parser)
+ if(mime_parser)
{
- axis2_callback_info_t* callback_ctx = NULL;
- axutil_stream_t* stream = NULL;
+ axis2_callback_info_t* callback_ctx = NULL;
+ axutil_stream_t* stream = NULL;
+
+ callback_ctx = (axis2_callback_info_t*)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_callback_info_t));
- callback_ctx = (axis2_callback_info_t*)
- AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
+ stream = axutil_stream_create_basic(env);
- stream = axutil_stream_create_basic(env);
-
- if (stream)
- {
- axutil_stream_write(stream, env, response->data,
- response->length);
- callback_ctx->env = env;
- callback_ctx->in_stream = stream;
- callback_ctx->content_length = response->length;
- callback_ctx->unread_len = response->length;
- callback_ctx->chunked_stream = NULL;
- }
+ if(stream)
+ {
+ axutil_stream_write(stream, env, response->data, response->length);
+ callback_ctx->env = env;
+ callback_ctx->in_stream = stream;
+ callback_ctx->content_length = response->length;
+ callback_ctx->unread_len = response->length;
+ callback_ctx->chunked_stream = NULL;
+ }
/*binary_data_map =
- axiom_mime_parser_parse(mime_parser, env,
- axis2_amqp_util_on_data_request,
- (void*)callback_ctx,
- mime_boundary);*/
+ axiom_mime_parser_parse(mime_parser, env,
+ axis2_amqp_util_on_data_request,
+ (void*)callback_ctx,
+ mime_boundary);*/
- if (!binary_data_map)
+ if(!binary_data_map)
{
return AXIS2_FAILURE;
}
- soap_body_len =
- axiom_mime_parser_get_soap_body_len(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);
+ soap_body_str = axiom_mime_parser_get_soap_body_str(mime_parser, env);
- axutil_stream_free(stream, env);
- AXIS2_FREE(env->allocator, callback_ctx);
- axiom_mime_parser_free(mime_parser, env);
+ axutil_stream_free(stream, env);
+ AXIS2_FREE(env->allocator, callback_ctx);
+ axiom_mime_parser_free(mime_parser, env);
}
- AXIS2_FREE(env->allocator, mime_boundary);
- }
+ AXIS2_FREE(env->allocator, mime_boundary);
+ }
- is_mtom = AXIS2_TRUE;
- }
- else
- {
- soap_body_str = response->data;
- soap_body_len = axutil_strlen(response->data);
- }
+ is_mtom = AXIS2_TRUE;
+ }
+ else
+ {
+ soap_body_str = response->data;
+ soap_body_len = axutil_strlen(response->data);
+ }
- soap_body_len = axutil_strlen(soap_body_str);
+ soap_body_len = axutil_strlen(soap_body_str);
- xml_reader = axiom_xml_reader_create_for_memory(env, soap_body_str,
- soap_body_len, NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
- if (!xml_reader)
+ xml_reader = axiom_xml_reader_create_for_memory(env, soap_body_str, soap_body_len, NULL,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if(!xml_reader)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
return NULL;
}
stax_builder = axiom_stax_builder_create(env, xml_reader);
- if (!stax_builder)
+ if(!stax_builder)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create StAX Builder");
return NULL;
}
- soap_ns_uri = is_soap_11 ? AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI :
- AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+ soap_ns_uri = is_soap_11 ? AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI
+ : AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
soap_builder = axiom_soap_builder_create(env, stax_builder, soap_ns_uri);
- if (!soap_builder)
+ if(!soap_builder)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create SOAP Builder");
return NULL;
}
- if (binary_data_map)
- {
- axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
- }
-
- soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
-
- if (soap_envelope)
- {
- /* hack to get around MTOM problem */
- axiom_soap_body_t *soap_body =
- axiom_soap_envelope_get_body(soap_envelope, env);
-
- if (soap_body)
- {
- axiom_soap_body_has_fault(soap_body, env);
- }
- }
-
- return soap_envelope;
-}
+ if(binary_data_map)
+ {
+ axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
+ }
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
+
+ if(soap_envelope)
+ {
+ /* hack to get around MTOM problem */
+ axiom_soap_body_t *soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+
+ if(soap_body)
+ {
+ axiom_soap_body_has_fault(soap_body, env);
+ }
+ }
+ return soap_envelope;
+}
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_amqp_util_conf_ctx_get_server_side(
- axis2_conf_ctx_t* conf_ctx,
- const axutil_env_t* env)
+ axis2_conf_ctx_t* conf_ctx,
+ const axutil_env_t* env)
{
- axutil_property_t* property = NULL;
- axis2_char_t* value = NULL;
-
- property = axis2_conf_ctx_get_property(conf_ctx, env, AXIS2_IS_SVR_SIDE);
- if (!property)
- return AXIS2_TRUE;
-
- value = (axis2_char_t*)axutil_property_get_value(property, env);
- if (!value)
- return AXIS2_TRUE;
+ axutil_property_t* property = NULL;
+ axis2_char_t* value = NULL;
+
+ property = axis2_conf_ctx_get_property(conf_ctx, env, AXIS2_IS_SVR_SIDE);
+ if(!property)
+ return AXIS2_TRUE;
+
+ value = (axis2_char_t*)axutil_property_get_value(property, env);
+ if(!value)
+ return AXIS2_TRUE;
- return (axutil_strcmp(value, AXIS2_VALUE_TRUE) == 0) ? AXIS2_TRUE : AXIS2_FALSE;
+ return (axutil_strcmp(value, AXIS2_VALUE_TRUE) == 0) ? AXIS2_TRUE : AXIS2_FALSE;
}
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
@@ -334,14 +313,14 @@
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;
@@ -350,12 +329,12 @@
tmp = strchr(tmp, AXIS2_AMQP_EQ);
tmp2 = strchr(tmp, AXIS2_AMQP_SEMI_COLON);
- if (tmp2)
+ if(tmp2)
{
*tmp2 = AXIS2_AMQP_ESC_NULL;
}
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, tmp_content_type);
return NULL;
@@ -365,15 +344,15 @@
AXIS2_FREE(env->allocator, tmp_content_type);
- if (*tmp2 == AXIS2_AMQP_DOUBLE_QUOTE)
+ if(*tmp2 == AXIS2_AMQP_DOUBLE_QUOTE)
{
tmp = tmp2;
tmp2 = axutil_strdup(env, tmp + 1);
tmp2[strlen(tmp2) - 1] = AXIS2_AMQP_ESC_NULL;
-
- if(tmp)
+
+ if(tmp)
{
- AXIS2_FREE(env->allocator, tmp);
+ AXIS2_FREE(env->allocator, tmp);
tmp = NULL;
}
}
@@ -395,7 +374,6 @@
return tmp2;
}
-
AXIS2_EXTERN int AXIS2_CALL
axis2_amqp_util_on_data_request(
char* buffer,
@@ -407,459 +385,439 @@
axis2_callback_info_t* cb_ctx = (axis2_callback_info_t*)ctx;
axutil_stream_t* in_stream = NULL;
- if (!buffer || !ctx)
+ if(!buffer || !ctx)
{
return 0;
}
- if (cb_ctx->unread_len <= 0 && -1 != cb_ctx->content_length)
+ if(cb_ctx->unread_len <= 0 && -1 != cb_ctx->content_length)
{
return 0;
}
- env = ((axis2_callback_info_t*)ctx)->env;
+ env = ((axis2_callback_info_t*)ctx)->env;
- 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)
- {
- buffer[len] = AXIS2_AMQP_ESC_NULL;
- ((axis2_callback_info_t*)ctx)->unread_len -= len;
+ if(len > 0)
+ {
+ buffer[len] = AXIS2_AMQP_ESC_NULL;
+ ((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;
}
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_amqp_util_conf_ctx_get_dual_channel_queue_name(
- axis2_conf_ctx_t* conf_ctx,
- const axutil_env_t* env)
+ axis2_conf_ctx_t* conf_ctx,
+ const axutil_env_t* env)
{
- axutil_property_t* property = NULL;
- axis2_char_t* queue_name = NULL;
- axis2_char_t* value = NULL;
-
- /* Get property */
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_QUEUE_NAME);
- if (!property) /* Very first call */
- {
- property = axutil_property_create(env);
-
- axis2_conf_ctx_set_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_QUEUE_NAME, property);
- }
-
- /* Get queue name */
- value = (axis2_char_t*)axutil_property_get_value(property, env);
-
- /* AMQP listener and the sender are the two parties that are
- * interested in the queue. Either party can create the queue.
- * If the queue is already created by one party, "value" is
- * not NULL. If "value" is NULL, that mean the caller of
- * this method is supposed to create the queue */
- if (value)
- {
- queue_name = (axis2_char_t*)
- AXIS2_MALLOC(env->allocator, axutil_strlen(value) + 1);
- strcpy(queue_name, value);
-
- /*axutil_property_set_value(property, env, NULL);*/
- }
- else
- {
- /* Create new queue name */
- queue_name = axutil_stracat(env, AXIS2_AMQP_TEMP_QUEUE_NAME_PREFIX,
- axutil_uuid_gen(env));
-
- /* Put queue name in the conf_ctx so that the sender will know */
- axutil_property_set_value(property, env, (void*)queue_name);
- }
+ axutil_property_t* property = NULL;
+ axis2_char_t* queue_name = NULL;
+ axis2_char_t* value = NULL;
- return queue_name;
-}
+ /* Get property */
+ property = axis2_conf_ctx_get_property(conf_ctx, env, AXIS2_AMQP_CONF_CTX_PROPERTY_QUEUE_NAME);
+ if(!property) /* Very first call */
+ {
+ property = axutil_property_create(env);
+
+ axis2_conf_ctx_set_property(conf_ctx, env, AXIS2_AMQP_CONF_CTX_PROPERTY_QUEUE_NAME,
+ property);
+ }
+
+ /* Get queue name */
+ value = (axis2_char_t*)axutil_property_get_value(property, env);
+
+ /* AMQP listener and the sender are the two parties that are
+ * interested in the queue. Either party can create the queue.
+ * If the queue is already created by one party, "value" is
+ * not NULL. If "value" is NULL, that mean the caller of
+ * this method is supposed to create the queue */
+ if(value)
+ {
+ queue_name = (axis2_char_t*)AXIS2_MALLOC(env->allocator, axutil_strlen(value) + 1);
+ strcpy(queue_name, value);
+
+ /*axutil_property_set_value(property, env, NULL);*/
+ }
+ else
+ {
+ /* Create new queue name */
+ queue_name = axutil_stracat(env, AXIS2_AMQP_TEMP_QUEUE_NAME_PREFIX, axutil_uuid_gen(env));
+
+ /* Put queue name in the conf_ctx so that the sender will know */
+ axutil_property_set_value(property, env, (void*)queue_name);
+ }
+ return queue_name;
+}
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
axis2_amqp_util_conf_ctx_get_qpid_broker_ip(
- axis2_conf_ctx_t* conf_ctx,
- const axutil_env_t* env)
+ axis2_conf_ctx_t* conf_ctx,
+ const axutil_env_t* env)
{
- axutil_property_t* property = NULL;
- void* value = NULL;
- axis2_char_t* broker_ip = AXIS2_QPID_DEFAULT_BROKER_IP;
+ axutil_property_t* property = NULL;
+ void* value = NULL;
+ axis2_char_t* broker_ip = AXIS2_QPID_DEFAULT_BROKER_IP;
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP);
+ property = axis2_conf_ctx_get_property(conf_ctx, env, AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP);
- if (property)
- {
- value = axutil_property_get_value(property, env);
+ if(property)
+ {
+ value = axutil_property_get_value(property, env);
- if (value)
- {
- broker_ip = (axis2_char_t*)value;
- }
- }
+ if(value)
+ {
+ broker_ip = (axis2_char_t*)value;
+ }
+ }
- return broker_ip;
+ return broker_ip;
}
-
-AXIS2_EXTERN int AXIS2_CALL
+AXIS2_EXTERN int AXIS2_CALL
axis2_amqp_util_conf_ctx_get_qpid_broker_port(
- axis2_conf_ctx_t* conf_ctx,
- const axutil_env_t* env)
+ axis2_conf_ctx_t* conf_ctx,
+ const axutil_env_t* env)
{
- axutil_property_t* property = NULL;
- void* value = NULL;
- int broker_port = AXIS2_QPID_DEFAULT_BROKER_PORT;
+ axutil_property_t* property = NULL;
+ void* value = NULL;
+ int broker_port = AXIS2_QPID_DEFAULT_BROKER_PORT;
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT);
+ property = axis2_conf_ctx_get_property(conf_ctx, env, AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT);
- if (property)
- {
- value = axutil_property_get_value(property, env);
+ if(property)
+ {
+ value = axutil_property_get_value(property, env);
- if (value)
- {
- broker_port = *(int*)value;
- }
- }
+ if(value)
+ {
+ broker_port = *(int*)value;
+ }
+ }
- return broker_port;
+ return broker_port;
}
-
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_amqp_util_msg_ctx_get_use_separate_listener(
- axis2_msg_ctx_t* msg_ctx,
- const axutil_env_t* env)
+ axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
{
- axutil_property_t* property = NULL;
- axis2_char_t* value = NULL;
- axis2_bool_t use_separate_listener = AXIS2_FALSE;
-
- property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_USE_SEPARATE_LISTENER);
-
- if (property)
- {
- value = (axis2_char_t*)axutil_property_get_value(property, env);
-
- if (value && (axutil_strcmp(AXIS2_VALUE_TRUE, value) == 0))
- {
- use_separate_listener = AXIS2_TRUE;
- }
- }
-
- return use_separate_listener;
-}
+ axutil_property_t* property = NULL;
+ axis2_char_t* value = NULL;
+ axis2_bool_t use_separate_listener = AXIS2_FALSE;
+
+ property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_USE_SEPARATE_LISTENER);
+
+ if(property)
+ {
+ value = (axis2_char_t*)axutil_property_get_value(property, env);
+
+ if(value && (axutil_strcmp(AXIS2_VALUE_TRUE, value) == 0))
+ {
+ use_separate_listener = AXIS2_TRUE;
+ }
+ }
+ return use_separate_listener;
+}
-AXIS2_EXTERN axis2_amqp_destination_info_t* AXIS2_CALL
+AXIS2_EXTERN axis2_amqp_destination_info_t* AXIS2_CALL
axis2_amqp_util_msg_ctx_get_destination_info(
- axis2_msg_ctx_t* msg_ctx,
- const axutil_env_t* env)
+ axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
{
- /* The destination URI that is expected by this method
- * should be of one of the following formats
- * 1. amqp://IP:PORT/services/SERVICE_NAME
- * 2. jms:/SERVICE_NAME?java.naming.provider.url=tcp://IP:PORT...
- * 3. TempQueue... */
-
- axis2_endpoint_ref_t* endpoint_ref = NULL;
- axis2_amqp_destination_info_t* destination_info = NULL;
-
- destination_info = (axis2_amqp_destination_info_t*)
- AXIS2_MALLOC(env->allocator, sizeof(axis2_amqp_destination_info_t));
-
- destination_info->broker_ip = NULL;
- destination_info->broker_port = AXIS2_QPID_NULL_CONF_INT;
- destination_info->queue_name = NULL;
-
- endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
-
- if (endpoint_ref)
- {
- const axis2_char_t* endpoint_address_original = NULL;
- axis2_char_t* endpoint_address = NULL;
- char* substr = NULL;
- char* token = NULL;
- endpoint_address_original = axis2_endpoint_ref_get_address(endpoint_ref, env);
-
- if (!endpoint_address_original)
- return NULL;
-
- endpoint_address = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
- (sizeof(axis2_char_t) * axutil_strlen(endpoint_address_original)) + 1);
- strcpy((char*)endpoint_address, (char*)endpoint_address_original);
-
- if ((substr = strstr(endpoint_address, AXIS2_AMQP_EPR_PREFIX))) /* Start with amqp: */
- {
- if (strstr(endpoint_address, AXIS2_AMQP_EPR_ANON_SERVICE_NAME))
- {
- /* Server reply to dual-channel client */
- axutil_property_t* property = NULL;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
-
- if (property)
- {
- axis2_char_t* queue_name = (axis2_char_t*)
- axutil_property_get_value(property, env);
-
- if (queue_name)
- {
- destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(
- env->allocator, (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
- strcpy(destination_info->queue_name, queue_name);
- }
- }
- }
- else
- {
- substr+= strlen(AXIS2_AMQP_EPR_PREFIX) + 2; /* 2 -> "//" */
- if (substr) /* IP:PORT/services/SERVICE_NAME */
- {
- token = strtok(substr, ":");
- if (token) /* IP */
- {
- axis2_char_t* broker_ip = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
- (sizeof(axis2_char_t) * strlen(token)) + 1);
- strcpy(broker_ip, token);
- destination_info->broker_ip = broker_ip;
-
- token = strtok(NULL, "/"); /* PORT */
- if (token)
- {
- destination_info->broker_port = atoi(token);
-
- token = strtok(NULL, "#"); /* ... services/SERVICE_NAME */
- if (token)
- {
- if ((substr = strstr(token, AXIS2_AMQP_EPR_SERVICE_PREFIX)))
- {
- substr+= strlen(AXIS2_AMQP_EPR_SERVICE_PREFIX) + 1; /* 1 -> "/" */
- if (substr)
- {
- axis2_char_t* queue_name = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
- (sizeof(axis2_char_t) * strlen(substr)) + 1);
- strcpy(queue_name, substr);
- destination_info->queue_name = queue_name;
- }
- }
- }
- }
- }
- }
- }
- }
- else if (0 == strcmp(endpoint_address, AXIS2_WSA_ANONYMOUS_URL)) /* Required to work with Sandesha2 */
- {
- axutil_property_t* property = NULL;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
-
- if (property)
- {
- axis2_char_t* queue_name = (axis2_char_t*)
- axutil_property_get_value(property, env);
-
- if (queue_name)
- {
- destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(
- env->allocator, (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
- strcpy(destination_info->queue_name, queue_name);
- }
- }
- }
- else if ((substr = strstr(endpoint_address, "jms:/")) &&
- (substr == endpoint_address))
- {
-
- }
-
- AXIS2_FREE(env->allocator, endpoint_address);
- }
- else
- {
- /* Single-channel blocking */
- axutil_property_t* property = NULL;
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
-
- if (property)
- {
- axis2_char_t* queue_name = (axis2_char_t*)
- axutil_property_get_value(property, env);
-
- if (queue_name)
- {
- destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(
- env->allocator, (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
- strcpy(destination_info->queue_name, queue_name);
- }
- }
- }
-
- /* Get broker IP/Port from conf_ctx if they are not
- * found in the destination URI */
- if (!destination_info->broker_ip)
- {
- axis2_conf_ctx_t* conf_ctx = NULL;
-
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
- if (conf_ctx)
- {
- axutil_property_t* property = NULL;
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP);
-
- if (property)
- {
- axis2_char_t* broker_ip = (axis2_char_t*)
- axutil_property_get_value(property, env);
-
- if (broker_ip)
- {
- destination_info->broker_ip = (axis2_char_t*)AXIS2_MALLOC(
- env->allocator, (sizeof(axis2_char_t) * strlen(broker_ip)) + 1);
- strcpy(destination_info->broker_ip, broker_ip);
- }
- }
-
- }
- }
-
- if (AXIS2_QPID_NULL_CONF_INT == destination_info->broker_port)
- {
- axis2_conf_ctx_t* conf_ctx = NULL;
-
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
- if (conf_ctx)
- {
- axutil_property_t* property = NULL;
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT);
-
- if (property)
- {
- void* value = axutil_property_get_value(property, env);
-
- if (value)
- {
- destination_info->broker_port = *(int*)value;
- }
- }
- }
- }
+ /* The destination URI that is expected by this method
+ * should be of one of the following formats
+ * 1. amqp://IP:PORT/services/SERVICE_NAME
+ * 2. jms:/SERVICE_NAME?java.naming.provider.url=tcp://IP:PORT...
+ * 3. TempQueue... */
- return destination_info;
-}
+ axis2_endpoint_ref_t* endpoint_ref = NULL;
+ axis2_amqp_destination_info_t* destination_info = NULL;
+
+ destination_info = (axis2_amqp_destination_info_t*)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_amqp_destination_info_t));
+
+ destination_info->broker_ip = NULL;
+ destination_info->broker_port = AXIS2_QPID_NULL_CONF_INT;
+ destination_info->queue_name = NULL;
+ endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
-AXIS2_EXTERN int AXIS2_CALL
+ if(endpoint_ref)
+ {
+ const axis2_char_t* endpoint_address_original = NULL;
+ axis2_char_t* endpoint_address = NULL;
+ char* substr = NULL;
+ char* token = NULL;
+ endpoint_address_original = axis2_endpoint_ref_get_address(endpoint_ref, env);
+
+ if(!endpoint_address_original)
+ return NULL;
+
+ endpoint_address = (axis2_char_t*)AXIS2_MALLOC(env->allocator, (sizeof(axis2_char_t)
+ * axutil_strlen(endpoint_address_original)) + 1);
+ strcpy((char*)endpoint_address, (char*)endpoint_address_original);
+
+ if((substr = strstr(endpoint_address, AXIS2_AMQP_EPR_PREFIX))) /* Start with amqp: */
+ {
+ if(strstr(endpoint_address, AXIS2_AMQP_EPR_ANON_SERVICE_NAME))
+ {
+ /* Server reply to dual-channel client */
+ axutil_property_t* property = NULL;
+ property = axis2_msg_ctx_get_property(msg_ctx, env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
+
+ if(property)
+ {
+ axis2_char_t* queue_name = (axis2_char_t*)axutil_property_get_value(property,
+ env);
+
+ if(queue_name)
+ {
+ destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+ (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
+ strcpy(destination_info->queue_name, queue_name);
+ }
+ }
+ }
+ else
+ {
+ substr += strlen(AXIS2_AMQP_EPR_PREFIX) + 2; /* 2 -> "//" */
+ if(substr) /* IP:PORT/services/SERVICE_NAME */
+ {
+ token = strtok(substr, ":");
+ if(token) /* IP */
+ {
+ axis2_char_t* broker_ip = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+ (sizeof(axis2_char_t) * strlen(token)) + 1);
+ strcpy(broker_ip, token);
+ destination_info->broker_ip = broker_ip;
+
+ token = strtok(NULL, "/"); /* PORT */
+ if(token)
+ {
+ destination_info->broker_port = atoi(token);
+
+ token = strtok(NULL, "#"); /* ... services/SERVICE_NAME */
+ if(token)
+ {
+ if((substr = strstr(token, AXIS2_AMQP_EPR_SERVICE_PREFIX)))
+ {
+ substr += strlen(AXIS2_AMQP_EPR_SERVICE_PREFIX) + 1; /* 1 -> "/" */
+ if(substr)
+ {
+ axis2_char_t* queue_name = (axis2_char_t*)AXIS2_MALLOC(
+ env->allocator, (sizeof(axis2_char_t) * strlen(substr))
+ + 1);
+ strcpy(queue_name, substr);
+ destination_info->queue_name = queue_name;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if(0 == strcmp(endpoint_address, AXIS2_WSA_ANONYMOUS_URL)) /* Required to work with Sandesha2 */
+ {
+ axutil_property_t* property = NULL;
+ property = axis2_msg_ctx_get_property(msg_ctx, env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
+
+ if(property)
+ {
+ axis2_char_t* queue_name = (axis2_char_t*)axutil_property_get_value(property, env);
+
+ if(queue_name)
+ {
+ destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+ (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
+ strcpy(destination_info->queue_name, queue_name);
+ }
+ }
+ }
+ else if((substr = strstr(endpoint_address, "jms:/")) && (substr == endpoint_address))
+ {
+
+ }
+
+ AXIS2_FREE(env->allocator, endpoint_address);
+ }
+ else
+ {
+ /* Single-channel blocking */
+ axutil_property_t* property = NULL;
+ property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
+
+ if(property)
+ {
+ axis2_char_t* queue_name = (axis2_char_t*)axutil_property_get_value(property, env);
+
+ if(queue_name)
+ {
+ destination_info->queue_name = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+ (sizeof(axis2_char_t) * strlen(queue_name)) + 1);
+ strcpy(destination_info->queue_name, queue_name);
+ }
+ }
+ }
+
+ /* Get broker IP/Port from conf_ctx if they are not
+ * found in the destination URI */
+ if(!destination_info->broker_ip)
+ {
+ axis2_conf_ctx_t* conf_ctx = NULL;
+
+ conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+ if(conf_ctx)
+ {
+ axutil_property_t* property = NULL;
+ property = axis2_conf_ctx_get_property(conf_ctx, env,
+ AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP);
+
+ if(property)
+ {
+ axis2_char_t* broker_ip = (axis2_char_t*)axutil_property_get_value(property, env);
+
+ if(broker_ip)
+ {
+ destination_info->broker_ip = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+ (sizeof(axis2_char_t) * strlen(broker_ip)) + 1);
+ strcpy(destination_info->broker_ip, broker_ip);
+ }
+ }
+
+ }
+ }
+
+ if(AXIS2_QPID_NULL_CONF_INT == destination_info->broker_port)
+ {
+ axis2_conf_ctx_t* conf_ctx = NULL;
+
+ conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+ if(conf_ctx)
+ {
+ axutil_property_t* property = NULL;
+ property = axis2_conf_ctx_get_property(conf_ctx, env,
+ AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT);
+
+ if(property)
+ {
+ void* value = axutil_property_get_value(property, env);
+
+ if(value)
+ {
+ destination_info->broker_port = *(int*)value;
+ }
+ }
+ }
+ }
+
+ return destination_info;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
axis2_amqp_util_msg_ctx_get_request_timeout(
- axis2_msg_ctx_t* msg_ctx,
- const axutil_env_t* env)
+ axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
{
- axis2_conf_ctx_t* conf_ctx = NULL;
- axutil_property_t* property = NULL;
- void* value = NULL;
- int request_timeout = AXIS2_QPID_DEFAULT_REQUEST_TIMEOUT;
-
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-
- if (conf_ctx)
- {
- property = axis2_conf_ctx_get_property(conf_ctx, env,
- AXIS2_AMQP_CONF_CTX_PROPERTY_REQUEST_TIMEOUT);
-
- if (property)
- {
- value = axutil_property_get_value(property, env);
-
- if (value)
- {
- request_timeout = *(int*)value;
- }
- }
- }
+ axis2_conf_ctx_t* conf_ctx = NULL;
+ axutil_property_t* property = NULL;
+ void* value = NULL;
+ int request_timeout = AXIS2_QPID_DEFAULT_REQUEST_TIMEOUT;
- return request_timeout;
-}
+ conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+
+ if(conf_ctx)
+ {
+ property = axis2_conf_ctx_get_property(conf_ctx, env,
+ AXIS2_AMQP_CONF_CTX_PROPERTY_REQUEST_TIMEOUT);
+
+ if(property)
+ {
+ value = axutil_property_get_value(property, env);
+
+ if(value)
+ {
+ request_timeout = *(int*)value;
+ }
+ }
+ }
+ return request_timeout;
+}
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_amqp_util_msg_ctx_get_server_side(
- axis2_msg_ctx_t* msg_ctx,
- const axutil_env_t* env)
+ axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
{
- axis2_conf_ctx_t* conf_ctx = NULL;
- axis2_bool_t is_server = AXIS2_FALSE;
+ axis2_conf_ctx_t* conf_ctx = NULL;
+ axis2_bool_t is_server = AXIS2_FALSE;
- 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)
- {
- is_server =
- axis2_amqp_util_conf_ctx_get_server_side(
- conf_ctx, env);
- }
+ if(conf_ctx)
+ {
+ is_server = axis2_amqp_util_conf_ctx_get_server_side(conf_ctx, env);
+ }
- return is_server;
+ return is_server;
}
-
-AXIS2_EXTERN void AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
axis2_amqp_response_free(
- axis2_amqp_response_t* response,
- const axutil_env_t* env)
+ axis2_amqp_response_t* response,
+ const axutil_env_t* env)
{
- if (response)
- {
- if (response->data)
- {
- AXIS2_FREE(env->allocator, response->data);
- }
+ if(response)
+ {
+ if(response->data)
+ {
+ AXIS2_FREE(env->allocator, response->data);
+ }
- if (response->content_type)
- {
- AXIS2_FREE(env->allocator, response->content_type);
- }
+ if(response->content_type)
+ {
+ AXIS2_FREE(env->allocator, response->content_type);
+ }
- AXIS2_FREE(env->allocator, response);
- }
+ AXIS2_FREE(env->allocator, response);
+ }
}
-
-AXIS2_EXTERN void AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
axis2_amqp_destination_info_free(
- axis2_amqp_destination_info_t* destination_info,
- const axutil_env_t* env)
+ axis2_amqp_destination_info_t* destination_info,
+ const axutil_env_t* env)
{
- if (destination_info)
- {
- if (destination_info->broker_ip)
- {
- AXIS2_FREE(env->allocator, destination_info->broker_ip);
- }
-
- if (destination_info->queue_name)
- {
- AXIS2_FREE(env->allocator, destination_info->queue_name);
- }
-
- AXIS2_FREE(env->allocator, destination_info);
- }
+ if(destination_info)
+ {
+ if(destination_info->broker_ip)
+ {
+ AXIS2_FREE(env->allocator, destination_info->broker_ip);
+ }
+
+ if(destination_info->queue_name)
+ {
+ AXIS2_FREE(env->allocator, destination_info->queue_name);
+ }
+
+ AXIS2_FREE(env->allocator, destination_info);
+ }
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_accept_record.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_accept_record.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_accept_record.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_accept_record.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -45,33 +44,32 @@
AXIS2_PARAM_CHECK(env->error, str, NULL);
- tmp_accept_record = (axis2_char_t *) axutil_strdup(env, str);
- if (!tmp_accept_record)
+ tmp_accept_record = (axis2_char_t *)axutil_strdup(env, str);
+ if(!tmp_accept_record)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "unable to strdup string %s", str);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "unable to strdup string %s", str);
return NULL;
}
- accept_record = (axis2_http_accept_record_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_accept_record_t));
+ accept_record = (axis2_http_accept_record_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_accept_record_t));
- if (!accept_record)
+ if(!accept_record)
{
- AXIS2_HANDLE_ERROR (env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)accept_record, 0, sizeof (axis2_http_accept_record_t));
+ memset((void *)accept_record, 0, sizeof(axis2_http_accept_record_t));
accept_record->record = axutil_strtrim(env, tmp_accept_record, AXIS2_SPACE_COMMA);
tmp = strchr(tmp_accept_record, AXIS2_Q);
- if (tmp)
+ if(tmp)
{
*tmp = AXIS2_ESC_NULL;
tmp++;
tmp = axutil_strtrim(env, tmp, AXIS2_EQ_N_SEMICOLON);
- if (tmp)
+ if(tmp)
{
sscanf(tmp, "%f", &quality);
AXIS2_FREE(env->allocator, tmp);
@@ -79,12 +77,12 @@
}
tmp = strstr(tmp_accept_record, AXIS2_LEVEL);
- if (tmp)
+ if(tmp)
{
*tmp = AXIS2_ESC_NULL;
tmp++;
tmp = axutil_strtrim(env, tmp, AXIS2_EQ_N_SEMICOLON);
- if (tmp)
+ if(tmp)
{
sscanf(tmp, "%d", &level);
AXIS2_FREE(env->allocator, tmp);
@@ -92,12 +90,12 @@
}
tmp = axutil_strtrim(env, tmp_accept_record, AXIS2_SPACE_SEMICOLON);
- if (tmp)
+ if(tmp)
{
name = tmp;
}
- if (!name || quality > 1.0 || quality < 0.0)
+ if(!name || quality > 1.0 || quality < 0.0)
{
axis2_http_accept_record_free(accept_record, env);
return NULL;
@@ -117,16 +115,16 @@
const axutil_env_t * env)
{
- if (!accept_record)
+ if(!accept_record)
{
return;
}
- if (accept_record->name)
+ if(accept_record->name)
{
AXIS2_FREE(env->allocator, accept_record->name);
}
- if (accept_record->record)
+ if(accept_record->record)
{
AXIS2_FREE(env->allocator, accept_record->record);
}
@@ -142,7 +140,6 @@
return accept_record->quality;
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axis2_http_accept_record_get_name(
const axis2_http_accept_record_t * accept_record,