You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/02/19 10:16:31 UTC
svn commit: r509137 - in /webservices/axis2/scratch/c/dinesh/532/c: ./
include/ modules/core/transport/http/sender/
Author: dinesh
Date: Mon Feb 19 01:16:30 2007
New Revision: 509137
URL: http://svn.apache.org/viewvc?view=rev&rev=509137
Log:
axis2c-523:transport sender refactoring
Modified:
webservices/axis2/scratch/c/dinesh/532/c/configure.ac
webservices/axis2/scratch/c/dinesh/532/c/include/axis2_soap_over_http_sender.h
webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/Makefile.am
webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_transport_sender.c
webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c
Modified: webservices/axis2/scratch/c/dinesh/532/c/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/configure.ac?view=diff&rev=509137&r1=509136&r2=509137
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/configure.ac (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/configure.ac Mon Feb 19 01:16:30 2007
@@ -279,6 +279,24 @@
CFLAGS="$CFLAGS"
)
+AC_MSG_CHECKING(whether to use libcurl)
+AC_ARG_ENABLE(libcurl, [ --enable-libcurl enable libcurl. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+ libcurl_enabled=false
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DAXIS2_LIBCURL_ENABLED"
+ libcurl_enabled=true
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS"
+)
+
AC_MSG_CHECKING(whether to build dynamic invocation client library)
AC_ARG_ENABLE(diclient, [ --enable-diclient build diclient library wrapper. default=no],
@@ -315,6 +333,7 @@
AC_SUBST(RAMPART_DIR)
AC_SUBST(GUTHTHILA_LIBS)
AM_CONDITIONAL(AXIS2_SSL_ENABLED, test x$ssl_enabled = xtrue)
+AM_CONDITIONAL(AXIS2_LIBCURL_ENABLED, test x$libcurl_enabled = xtrue)
#export PARSER_DIR
export WRAPPER_DIR
export prefix
@@ -333,6 +352,7 @@
modules/core/transport/http/util/Makefile \
modules/core/transport/http/sender/Makefile \
modules/core/transport/http/sender/ssl/Makefile \
+ modules/core/transport/http/sender/libcurl/Makefile \
modules/core/transport/http/receiver/Makefile \
modules/core/transport/http/server/simple_axis2_server/Makefile \
modules/core/transport/http/server/Makefile \
Modified: webservices/axis2/scratch/c/dinesh/532/c/include/axis2_soap_over_http_sender.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/include/axis2_soap_over_http_sender.h?view=diff&rev=509137&r1=509136&r2=509137
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/include/axis2_soap_over_http_sender.h (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/include/axis2_soap_over_http_sender.h Mon Feb 19 01:16:30 2007
@@ -211,3 +211,7 @@
}
#endif
#endif /* AXIS2_SOAP_OVER_HTTP_SENDER_H */
+
+
+
+
Modified: webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/Makefile.am?view=diff&rev=509137&r1=509136&r2=509137
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/Makefile.am (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/Makefile.am Mon Feb 19 01:16:30 2007
@@ -1,13 +1,28 @@
-SUBDIRS=ssl
+SUBDIRS=ssl libcurl
lib_LTLIBRARIES = libaxis2_http_sender.la
libaxis2_http_sender_la_SOURCES = http_transport_sender.c\
soap_over_http_sender.c\
+ http_sender.c\
rest_sender.c\
+ sender_util.c\
http_client.c
libaxis2_http_sender_la_LIBADD = $(top_builddir)/modules/core/transport/http/common/libaxis2_http_common.la\
+ $(top_builddir)/modules/core/transport/http/util/libaxis2_http_util.la\
$(top_builddir)/axiom/src/om/libaxis2_axiom.la\
- $(top_builddir)/util/src/libaxis2_util.la
+ $(top_builddir)/util/src/libaxis2_util.la
+
+
+if AXIS2_LIBCURL_ENABLED
+libaxis2_http_sender_la_SOURCES +=libcurl/axis2_libcurl.c
+
+libaxis2_http_sender_la_LIBADD +=-lssl\
+ -lcrypto\
+ -lcurl\
+ -ldl\
+ -lz
+endif
+
if AXIS2_SSL_ENABLED
libaxis2_http_sender_la_SOURCES += ssl/ssl_stream.c\
@@ -16,9 +31,11 @@
-lcrypto
endif
+
INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/modules/core/transport\
- -I$(top_builddir)/modules/core/transport/http \
+ -I$(top_builddir)/modules/core/transport/http \
+ -I$(top_builddir)/modules/core/transport/http/sender/libcurl \
-I$(top_builddir)/modules/core/description \
-I$(top_builddir)/modules/core/context \
-I$(top_builddir)/modules/core/phaseresolver \
Modified: webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_transport_sender.c?view=diff&rev=509137&r1=509136&r2=509137
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_transport_sender.c Mon Feb 19 01:16:30 2007
@@ -24,7 +24,7 @@
#include <axis2_http_transport_utils.h>
#include <axis2_http_out_transport_info.h>
#include <axis2_http_transport.h>
-#include <axis2_soap_over_http_sender.h>
+#include <axis2_http_sender.h>
#include <axiom_soap_body.h>
#include <axis2_rest_sender.h>
#include <axis2_types.h>
@@ -542,7 +542,7 @@
{
const axis2_char_t *soap_action = NULL;
const axis2_char_t *url = NULL;
- axis2_soap_over_http_sender_t *sender = NULL;
+ axis2_http_sender_t *sender = NULL;
axis2_status_t status = AXIS2_FAILURE;
const axis2_char_t *soap_ns_uri = NULL;
axiom_soap_envelope_t *response_envelope = NULL;
@@ -561,66 +561,28 @@
{
soap_action = "";
}
-
- if (AXIS2_TRUE == AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env))
- {
- axiom_node_t *data_out = NULL;
- axiom_node_t *body_node = NULL;
- axiom_soap_body_t *soap_body = AXIOM_SOAP_ENVELOPE_GET_BODY(out, env);
- axis2_rest_sender_t *sender = NULL;
- if (NULL == soap_body)
- {
- AXIS2_ERROR_SET(env->error,
- AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
- AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s",
- AXIS2_ERROR_GET_MESSAGE(env->error));
- return AXIS2_FAILURE;
- }
- body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(soap_body, env);
- if (NULL == body_node)
- {
- return AXIS2_FAILURE;
- }
- data_out = AXIOM_NODE_GET_FIRST_ELEMENT(body_node, env);
- if (NULL == data_out || AXIOM_NODE_GET_NODE_TYPE(data_out, env)
- != AXIOM_ELEMENT)
- {
- return AXIS2_FAILURE;
- }
- sender = axis2_rest_sender_create(env);
- AXIS2_REST_SENDER_SET_CHUNKED(sender, env,
- AXIS2_INTF_TO_IMPL(transport_sender)->chunked);
- AXIS2_REST_SENDER_SET_OM_OUTPUT(sender, env, om_output);
- AXIS2_REST_SENDER_SET_HTTP_VERSION(sender, env,
- AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
- status = AXIS2_REST_SENDER_SEND(sender, env, msg_ctx, data_out, url);
+ sender = axis2_http_sender_create(env);
- AXIS2_REST_SENDER_FREE(sender, env);
- }
- else
- {
- sender = axis2_soap_over_http_sender_create(env);
+ if (NULL == sender)
+ {
+ return AXIS2_FAILURE;
+ }
- if (NULL == sender)
- {
- return AXIS2_FAILURE;
- }
- AXIS2_SOAP_OVER_HTTP_SENDER_SET_CHUNKED(sender, env,
- AXIS2_INTF_TO_IMPL(transport_sender)->chunked);
- AXIS2_SOAP_OVER_HTTP_SENDER_SET_OM_OUTPUT(sender, env, om_output);
- AXIOM_SOAP_OVER_SENDER_SET_HTTP_VERSION(sender, env,
- AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
- status = AXIS2_SOAP_OVER_HTTP_SENDER_SEND(sender, env, msg_ctx, out, url
- , soap_action);
-
- /*
- * TODO check for errors
- */
- AXIS2_SOAP_OVER_HTTP_SENDER_FREE(sender, env);
- sender = NULL;
- }
+
+
+ AXIS2_HTTP_SENDER_SET_CHUNKED(sender, env,
+ AXIS2_INTF_TO_IMPL(transport_sender)->chunked);
+ AXIS2_HTTP_SENDER_SET_OM_OUTPUT(sender, env, om_output);
+ AXIOM_SENDER_SET_HTTP_VERSION(sender, env,
+ AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
+ status = AXIS2_HTTP_SENDER_SEND(sender, env, msg_ctx, out, url, soap_action);
+
+ /*
+ * TODO check for errors
+ */
+ AXIS2_HTTP_SENDER_FREE(sender, env);
+ sender = NULL;
op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env);
if (op)
Modified: webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c?view=diff&rev=509137&r1=509136&r2=509137
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c Mon Feb 19 01:16:30 2007
@@ -218,8 +218,7 @@
const axis2_char_t *char_set_enc = NULL;
axis2_string_t *char_set_enc_str = NULL;
int status_code = -1;
- axis2_http_header_t *http_header = NULL;
- axis2_http_simple_response_t *response = NULL;
+ axis2_http_simple_response_t *response = NULL;
axis2_char_t *content_type = NULL;
axis2_byte_t *output_stream = NULL;
int output_stream_size = 0;
@@ -335,9 +334,7 @@
request = axis2_http_simple_request_create(env, request_line, NULL, 0,
NULL);
- http_header = axis2_http_header_create(env, AXIS2_HTTP_HEADER_USER_AGENT,
- "Axis2/C");
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_USER_AGENT, "Axis2/C");
if (AXIS2_TRUE == AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
{
if ('\"' != *soap_action)
@@ -346,16 +343,13 @@
tmp_soap_action = AXIS2_MALLOC(env->allocator, (
AXIS2_STRLEN(soap_action) + 5) * sizeof(axis2_char_t));
sprintf(tmp_soap_action, "\"%s\"", soap_action);
- http_header = axis2_http_header_create(env,
- AXIS2_HTTP_HEADER_SOAP_ACTION, tmp_soap_action);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_SOAP_ACTION, tmp_soap_action);
AXIS2_FREE(env->allocator, tmp_soap_action);
}
else
{
- http_header = axis2_http_header_create(env,
- AXIS2_HTTP_HEADER_SOAP_ACTION, soap_action);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_SOAP_ACTION, soap_action);
}
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
}
buffer_size = AXIOM_XML_WRITER_GET_XML_SIZE(xml_writer, env);
@@ -368,16 +362,13 @@
}
sprintf(tmp_buf, "%d", buffer_size);
- http_header = axis2_http_header_create(env,
- AXIS2_HTTP_HEADER_CONTENT_LENGTH, tmp_buf);
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_LENGTH, tmp_buf);
}
else
{
- http_header = axis2_http_header_create(env,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+ axis2_http_sender_util_add_header (env, request,
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED,
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
}
if (doing_mtom)
@@ -430,15 +421,13 @@
content_type = temp_content_type;
}
- http_header = axis2_http_header_create(env, AXIS2_HTTP_HEADER_CONTENT_TYPE,
- content_type);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_TYPE, content_type);
if (content_type)
{
AXIS2_FREE(env->allocator, content_type);
content_type = NULL;
}
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
if (0 == AXIS2_STRCMP(sender_impl->http_version,
AXIS2_HTTP_HEADER_PROTOCOL_11))
@@ -449,12 +438,9 @@
axis2_char_t));
sprintf(header, "%s:%d", AXIS2_URL_GET_SERVER(url, env),
AXIS2_URL_GET_PORT(url, env));
- http_header = axis2_http_header_create(env,
- AXIS2_HTTP_HEADER_HOST,
- header);
+ axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_HOST, header);
AXIS2_FREE(env->allocator, header);
header = NULL;
- AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
}
if (doing_mtom)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org