axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavani J <jpavan...@gmail.com>
Subject How to get Cookie information from HTTP Header
Date Fri, 22 Feb 2013 06:45:26 GMT
Hi,

I am using axis2c-1.7.0 to deploy web services for WSDL generated C stubs.

Below is my code snippets that I tried to get access to HTTP header and it
is returning NULL. Actually I need to get COOKIE information from header.
Please let me know if there is anything wrong with the following code.
Is there a better way to get COOKIE information from HTTP header?

1)  First Method
   axutil_property_t* property = NULL;
    axis2_char_t* prop_val = NULL;
    property = axis2_msg_ctx_get_property(msg_ctx, env,
AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL
    if (property == NULL)
    {
        printf("property is NULL\n\n");
    }
    else
    {
        prop_val = (axis2_char_t*)axutil_property_get_value(property, env);
        if (prop_val == NULL)
        {
            printf(" prop_val is NULL\n\n");
        }
        else
        {
            printf("prop_val: %s\n\n", prop_val);
        }
    }

2) Second Method

    axutil_hash_t* header = NULL;
    header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   // <---
This is returning NULL
    if (header)
    {
        axis2_http_header_t* test = NULL;
        test = (axis2_http_header_t*) axutil_hash_get(header,
AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);
        if (test)
        {
            axis2_char_t* val = NULL;
            val = axis2_http_header_get_value(test, env);
            if (val)
            {
                printf (" axis2_http_header_get_value, val: %s\n\n", val);
            }
            else
            {
                printf("axis2_http_header_get_value returned NULL\n\n");
            }
        }
        else
        {
            printf("axutil_hash_get returned NULL\n\n");
        }
    }
    else
    {
        printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");
    }


Any help is appreciated.

Thanks,
Pavani

Mime
View raw message