axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ruanhuabin" <ruanhua...@gmail.com>
Subject How to add custom http headers in response message In Axis2/C 1.6
Date Wed, 15 Dec 2010 02:39:02 GMT
Hi, all, recently I used axis2/C to develop a web system, I encounter  a problem confusing
a long time, I want to add a custom http header in my response message, I write to following
code hoping to achive it, but I failed,Can someone help me pointing out what's the problem
in my code, thank you!

axis2_op_ctx_t *op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
axis2_msg_ctx_t *out_msg_ctx;
out_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_OUT);
axis2_char_t *header_name = "x_object_name";    /*Custom header name*/
axis2_char_t *header_value = "1234567";    /*Custom header value*/
axis2_http_header_t *http_header =  axis2_http_header_create(env, header_name, header_value);
axutil_array_list_t *http_headers_list = axutil_array_list_create(env, 1);
axutil_array_list_add(http_headers_list, env, http_header);
axis2_msg_ctx_set_http_output_headers(out_msg_ctx, env, http_headers_list);  /*I used this
method to set my custom http header*/

2010-12-15 



ruanhuabin 

Mime
View raw message