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/04/02 16:54:16 UTC
svn commit: r524801 - in /webservices/axis2/trunk/c:
include/axis2_svc_client.h modules/core/clientapi/svc_client.c
modules/core/transport/http/sender/http_sender.c
Author: dinesh
Date: Mon Apr 2 07:54:14 2007
New Revision: 524801
URL: http://svn.apache.org/viewvc?view=rev&rev=524801
Log:
fixed:axis2c-574, api for proxy support axis2_svc_client_set_proxy
Modified:
webservices/axis2/trunk/c/include/axis2_svc_client.h
webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
webservices/axis2/trunk/c/modules/core/transport/http/sender/http_sender.c
Modified: webservices/axis2/trunk/c/include/axis2_svc_client.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_svc_client.h?view=diff&rev=524801&r1=524800&r2=524801
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_svc_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_svc_client.h Mon Apr 2 07:54:14 2007
@@ -52,6 +52,7 @@
#include <axis2_svc_ctx.h>
#include <axis2_conf_ctx.h>
#include <axis2_op_client.h>
+#include <axutil_string.h>
/** Name of anonymous service */
#define AXIS2_ANON_SERVICE "__ANONYMOUS_SERVICE__"
@@ -65,7 +66,9 @@
/** out-in MEP operation name */
#define AXIS2_ANON_OUT_IN_OP "__OPERATION_OUT_IN__"
-
+#define AXIS2_HTTP_PROXY_API "PROXY_API"
+#define AXIS2_HTTP_PROXY_HOST "proxy_host"
+#define AXIS2_HTTP_PROXY_PORT "proxy_port"
#ifdef __cplusplus
extern "C"
{
@@ -383,6 +386,24 @@
axis2_svc_client_set_target_endpoint_ref(axis2_svc_client_t *svc_client,
const axutil_env_t *env,
axis2_endpoint_ref_t *target_epr);
+
+
+ /**
+ * Sets the proxy.
+ * @param svc_client pointer to service client struct
+ * @param env pointer to environment struct
+ * @param proxy_host pointer to the proxy_host settings to be set
+ * as
+ * @param proxy_port pointer to the proxy_port settings to be set
+ * as
+ * target. service client takes over the ownership of the struct.
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_svc_client_set_proxy(axis2_svc_client_t *svc_client,
+ const axutil_env_t *env,
+ axis2_char_t *proxy_host,
+ axis2_char_t *proxy_port);
/**
* Gets the service context.
Modified: webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c?view=diff&rev=524801&r1=524800&r2=524801
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Mon Apr 2 07:54:14 2007
@@ -1274,3 +1274,43 @@
return svc_client->last_response_has_fault;
}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_svc_client_set_proxy(axis2_svc_client_t *svc_client,
+ const axutil_env_t *env,
+ axis2_char_t *proxy_host,
+ axis2_char_t *proxy_port)
+{
+ AXIS2_PARAM_CHECK(env->error, proxy_host, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, proxy_port, AXIS2_FAILURE);
+ axis2_transport_out_desc_t *trans_desc = NULL;
+ axis2_conf_t *conf = NULL;
+ axutil_param_container_t *param_container;
+ axutil_param_t *param;
+ axis2_char_t *proxy = AXIS2_HTTP_PROXY_API;
+ axutil_hash_t *attribute;
+
+ if (svc_client->conf)
+ {
+ conf = svc_client->conf;
+ trans_desc = axis2_conf_get_transport_out(conf, env, AXIS2_TRANSPORT_ENUM_HTTP);
+ if (! trans_desc)
+ {
+ return AXIS2_FAILURE;
+ }
+ param_container = axis2_transport_out_desc_param_container (trans_desc, env);
+ param = axutil_param_create (env, proxy, (void *)NULL);
+
+ if (!param)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ attribute = axutil_hash_make (env);
+ axutil_hash_set (attribute, AXIS2_HTTP_PROXY_HOST, AXIS2_HASH_KEY_STRING, proxy_host);
+ axutil_hash_set (attribute, AXIS2_HTTP_PROXY_PORT, AXIS2_HASH_KEY_STRING, proxy_port);
+ axutil_param_set_attributes (param, env, attribute);
+ axutil_param_container_add_param (param_container, env, param);
+
+ }
+ return AXIS2_SUCCESS;
+}
Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_sender.c?view=diff&rev=524801&r1=524800&r2=524801
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_sender.c Mon Apr 2 07:54:14 2007
@@ -16,6 +16,7 @@
*/
#include <axis2_http_sender.h>
+#include <axis2_svc_client.h>
#include <axutil_string.h>
#include <axis2_http_transport.h>
#include <string.h>
@@ -809,6 +810,9 @@
axis2_transport_out_desc_t *trans_desc = NULL;
axutil_param_t *proxy_param = NULL;
axutil_hash_t *transport_attrs = NULL;
+ axis2_char_t *proxy_host = NULL;
+ axis2_char_t *proxy_port = NULL;
+
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
@@ -841,8 +845,6 @@
axutil_generic_obj_t *obj = NULL;
axiom_attribute_t *host_attr = NULL;
axiom_attribute_t *port_attr = NULL;
- axis2_char_t *proxy_host = NULL;
- axis2_char_t *proxy_port = NULL;
obj = axutil_hash_get(transport_attrs, AXIS2_PROXY_HOST_NAME,
AXIS2_HASH_KEY_STRING);
@@ -877,13 +879,41 @@
{
return AXIS2_FAILURE;
}
- if (proxy_host && NULL != proxy_port)
+ }
+ }
+ else
+ {
+ proxy_param = axutil_param_container_get_param(
+ axis2_transport_out_desc_param_container(trans_desc, env),
+ env, AXIS2_HTTP_PROXY_API);
+ if (proxy_param)
+ {
+ transport_attrs = axutil_param_get_attributes(proxy_param, env);
+ if (transport_attrs)
{
- AXIS2_HTTP_CLIENT_SET_PROXY(sender->client, env, proxy_host,
- AXIS2_ATOI(proxy_port));
- return AXIS2_SUCCESS;
+
+ proxy_host = (axis2_char_t *)axutil_hash_get(transport_attrs, AXIS2_PROXY_HOST_NAME,
+ AXIS2_HASH_KEY_STRING);
+ if (!proxy_host)
+ {
+ return AXIS2_FAILURE;
+ }
+ /* Now we get the port */
+
+ proxy_port = (axis2_char_t *)axutil_hash_get(transport_attrs, AXIS2_PROXY_HOST_PORT,
+ AXIS2_HASH_KEY_STRING);
+ if (!proxy_port)
+ {
+ return AXIS2_FAILURE;
+ }
}
}
+
+ }
+ if (proxy_port && proxy_host)
+ {
+ AXIS2_HTTP_CLIENT_SET_PROXY(sender->client, env, proxy_host,
+ AXIS2_ATOI(proxy_port));
}
return AXIS2_SUCCESS;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org