示例#1
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
savan_client_unsubscribe(
    savan_client_t *client,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client)
{
    axis2_options_t *wsa_options = NULL;
    const axis2_char_t *old_action = NULL;
    axiom_namespace_t *ns = NULL;
    axiom_node_t *reply = NULL;
    axiom_node_t *unsub_node = NULL;
    axiom_element_t *unsub_elem = NULL;
    axis2_status_t status = AXIS2_FAILURE;
    
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_unsubscribe");
    
    /* set wsa action as Unsub. remember the old action */
    wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env);
    old_action = axis2_options_get_action(wsa_options, env);
    axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_UNSUB);
    
    /* create the body of the Unsub request */
    ns = axiom_namespace_create (env, EVENTING_NAMESPACE, EVENTING_NS_PREFIX);
    unsub_elem = axiom_element_create(env, NULL, ELEM_NAME_UNSUB, ns, &unsub_node);
        
    savan_client_add_sub_id_to_soap_header(client, env, svc_client);

    /* send the Unsub request and wait for the response */
    reply = axis2_svc_client_send_receive(svc_client, env, unsub_node);
    
    /* reset the old action */
    axis2_options_set_action(wsa_options, env, old_action);
    
    if (!reply)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to send unsubscribe "
            "request. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        status = AXIS2_FAILURE;
    }
    else
        status = AXIS2_SUCCESS;
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_unsubscribe");
    return status;
}
示例#2
0
WSF_WSDL_EXTERN axis2_bool_t WSF_WSDL_CALL 
wsf_wsdl_request(
    const axutil_env_t* env,
    axis2_char_t* wsdl_file_name,
    const axis2_char_t* operation_name,	
    wsf_wsdl_data_t* parameters,
    axis2_char_t* script_binding_home,
    axis2_svc_client_t* svc_client,
    axutil_hash_t* svc_client_user_options,
    axis2_char_t* service_name,
    axis2_char_t* port_name,
    wsf_wsdl_data_t** response)
{
    int soap_version = 2; 
    int has_fault = AXIS2_FALSE;
    int binding_style = WSDL_BINDING_STYLE_DOC_LIT_W;
    axis2_char_t* payload = NULL;	
    axiom_node_t* payload_node = NULL;
    axis2_char_t* request_buffer = NULL;	
    axiom_node_t* type_map = NULL;	
    axis2_char_t *res_text = NULL;	
    axiom_node_t* sig_axiom = NULL;	
    axiom_node_t *fault_node = NULL;	
    axiom_node_t* wsdl_axiom = NULL;	
    axiom_node_t* params_node = NULL;	
    axiom_node_t* returns_node = NULL;	
    axiom_soap_body_t *soap_body = NULL;	
    axiom_node_t *body_base_node = NULL;	
    /*axis2_char_t *wrapper_element = NULL;*/	
    axiom_node_t* operation_axiom = NULL;	
    axiom_soap_fault_t *soap_fault = NULL;	
    axis2_options_t *client_options = NULL;	
    /*axis2_char_t *wrapper_element_ns = NULL;*/	
    /*axiom_node_t *axiom_soap_base_node = NULL;	*/
    axiom_soap_envelope_t *response_envelope = NULL;	
    wsf_wsdl_data_template_t* input_template = NULL;	
    wsf_wsdl_data_template_t* output_template = NULL;	
    axis2_bool_t is_version1_wsdl = AXIS2_FALSE;
    axis2_char_t* xslt_location = NULL;
    axis2_char_t* type_map_file = NULL;

    AXIS2_LOG_TRACE_MSG(env->log, "Starting execution of wsf_wsdl_request..."); 

    xslt_location = axutil_strcat(env, script_binding_home, WSF_WSDL_XSLT_LOCATION_POSTFIX, NULL);
    type_map_file = axutil_strcat(env, script_binding_home, WSF_WSDL_TYPE_MAP_POSTFIX, NULL);

    client_options = (axis2_options_t *)axis2_svc_client_get_options(svc_client, env);

    axis2_options_set_xml_parser_reset(client_options, env, AXIS2_FALSE);

    if (!wsf_wsdl_parser_load_wsdl(env, wsdl_file_name, xslt_location, &wsdl_axiom, &sig_axiom, &is_version1_wsdl, AXIS2_FALSE))
        return AXIS2_FALSE;

    wsdl_util_create_type_map(env, type_map_file, &type_map);

    wsdl_util_manage_client_options(env, 
        svc_client, 
        svc_client_user_options, 
        client_options, 
        operation_name, 
        wsdl_axiom, 
        is_version1_wsdl, 
        sig_axiom, 
        service_name,
        port_name,
        &operation_axiom, 
        &soap_version);

    wsdl_util_identify_binding_style(env, operation_axiom, &binding_style);

    if (!operation_axiom)
    {
        AXIS2_LOG_ERROR_MSG(env->log, "Operation axiom is NULL");

        if (wsdl_axiom) 
            axiom_node_free_tree(wsdl_axiom, env);
        if (sig_axiom)
            axiom_node_free_tree(sig_axiom, env);
        if (type_map)
            axiom_node_free_tree(type_map, env);
        return AXIS2_FALSE;
    }

    wsdl_util_get_params_node(env, operation_axiom, &params_node);
    wsdl_util_get_returns_node(env, operation_axiom, &returns_node);

    wsdl_data_util_axiom_to_template(env, params_node, &input_template);
    wsdl_data_util_axiom_to_template(env, returns_node, &output_template);

#ifdef WSDL_DEBUG_MODE
    {
        axis2_char_t* buffer = NULL;
        wsdl_data_util_serialize_data(env, parameters, &buffer);
        AXIS2_LOG_DEBUG_MSG(env->log, buffer);
        AXIS2_FREE(env->allocator, buffer);
        wsdl_data_util_serialize_template(env, input_template, &buffer);
        AXIS2_LOG_DEBUG_MSG(env->log, buffer);
        AXIS2_FREE(env->allocator, buffer);
        buffer = NULL;
    }
#endif

    if (wsdl_data_util_validate_data(env, type_map, input_template, parameters, VALIDATION_CRITERIA_REQUEST_MODE_TYPE) == AXIS2_TRUE)
    {
        payload_node = wsdl_data_util_create_payload(env, parameters, binding_style);
        payload = payload_node? axiom_node_to_string(payload_node, env) : NULL;
        // axiom_node_free_tree(payload_node, env);
    }
    else
    {
        AXIS2_LOG_ERROR_MSG(env->log, "User data is not valid or not in proper format");

        if (input_template)
            wsdl_data_template_free(env, input_template);
        if (output_template)
            wsdl_data_template_free(env, output_template);

        if (wsdl_axiom) 
            axiom_node_free_tree(wsdl_axiom, env);
        if (sig_axiom)
            axiom_node_free_tree(sig_axiom, env);
        if (type_map)
            axiom_node_free_tree(type_map, env);
        return AXIS2_FALSE;
    }

    if (!payload_node)
    {
        AXIS2_LOG_ERROR_MSG(env->log, "Request payload is not found");

        if (input_template)
            wsdl_data_template_free(env, input_template);
        if (output_template)
            wsdl_data_template_free(env, output_template);

        if (wsdl_axiom) 
            axiom_node_free_tree(wsdl_axiom, env);
        if (sig_axiom)
            axiom_node_free_tree(sig_axiom, env);
        if (type_map)
            axiom_node_free_tree(type_map, env);
        return AXIS2_FALSE; 
    }

    request_buffer = (axis2_char_t*)wsdl_util_create_request_envelope(env, payload_node, soap_version);

    if (!request_buffer)
    {
        AXIS2_LOG_ERROR_MSG(env->log, "Error in creating request payload dom");

        if (input_template)
            wsdl_data_template_free(env, input_template);
        if (output_template)
            wsdl_data_template_free(env, output_template);

        if (wsdl_axiom) 
            axiom_node_free_tree(wsdl_axiom, env);
        if (sig_axiom)
            axiom_node_free_tree(sig_axiom, env);
        if (type_map)
            axiom_node_free_tree(type_map, env);

        return AXIS2_FALSE;
    }

    response_envelope = (axiom_soap_envelope_t*)wsdl_util_send_receive_soap_envelope_with_op_client(env, 
        svc_client, 
        client_options, 
        request_buffer);
    if (response_envelope) 
    {
        has_fault = AXIS2_TRUE;
        soap_body = axiom_soap_envelope_get_body (response_envelope, env);

        if (soap_body)
        {
            soap_fault = axiom_soap_body_get_fault (soap_body, env);
        }

        if (soap_fault) 
        {
            soap_version = axis2_options_get_soap_version(client_options, env);
            fault_node = axiom_soap_fault_get_base_node(soap_fault, env);
            if (fault_node)
            {
                res_text = axiom_node_to_string(fault_node, env);
                AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI, "Fault payload is %s", res_text);

                if (input_template)
                    wsdl_data_template_free(env, input_template);
                if (output_template)
                    wsdl_data_template_free(env, output_template);
                if (wsdl_axiom) 
                    axiom_node_free_tree(wsdl_axiom, env);
                if (sig_axiom)
                    axiom_node_free_tree(sig_axiom, env);
                if (type_map)
                    axiom_node_free_tree(type_map, env);

                return AXIS2_FALSE;
            }    
        }

        if (soap_body)
        {
            body_base_node = axiom_soap_body_get_base_node(soap_body, env);
        }

        if (body_base_node && !soap_fault)
        {
            axis2_char_t *response_buffer = NULL;	
            wsf_wsdl_data_t *response_data = NULL;

            response_buffer = axiom_node_to_string(body_base_node, env);
            AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                "Response buffer is %s", response_buffer);

            AXIS2_FREE(env->allocator, response_buffer);

            wsdl_data_util_axiom_to_data(env, body_base_node, &response_data);

#ifdef WSDL_DEBUG_MODE
            {
                axis2_char_t* buffer = NULL;
                wsdl_data_util_serialize_data(env, response_data, &buffer);
                AXIS2_LOG_DEBUG_MSG(env->log, buffer);
                AXIS2_FREE(env->allocator, buffer);
                wsdl_data_util_serialize_template(env, output_template, &buffer);
                AXIS2_LOG_DEBUG_MSG(env->log, buffer);
                AXIS2_FREE(env->allocator, buffer);
                buffer = NULL;
            }
#endif

            if (wsdl_data_util_validate_data(env, type_map, output_template, response_data, VALIDATION_CRITERIA_RESPONSE_MODE) == AXIS2_TRUE)
            {
                AXIS2_LOG_DEBUG_MSG(env->log, "Valid response!!!");
                *response = response_data;

                if (input_template)
                    wsdl_data_template_free(env, input_template);
                if (output_template)
                    wsdl_data_template_free(env, output_template);
                if (wsdl_axiom) 
                    axiom_node_free_tree(wsdl_axiom, env);
                if (sig_axiom)
                    axiom_node_free_tree(sig_axiom, env);
                if (type_map)
                    axiom_node_free_tree(type_map, env);

                return AXIS2_TRUE;
            }
            else
            {
                AXIS2_LOG_ERROR_MSG(env->log, "Response data is not valid or not in proper format");

                if (input_template)
                    wsdl_data_template_free(env, input_template);
                if (output_template)
                    wsdl_data_template_free(env, output_template);
                if (wsdl_axiom) 
                    axiom_node_free_tree(wsdl_axiom, env);
                if (sig_axiom)
                    axiom_node_free_tree(sig_axiom, env);
                if (type_map)
                    axiom_node_free_tree(type_map, env);

                return AXIS2_FALSE;
            }
        }
    }
    else  /* response_envelope == NULL */
    {
        AXIS2_LOG_ERROR_MSG(env->log, "Response envelope not found");
    }

    if (input_template)
        wsdl_data_template_free(env, input_template);
    if (output_template)
        wsdl_data_template_free(env, output_template);

    if (wsdl_axiom) 
        axiom_node_free_tree(wsdl_axiom, env);
    if (sig_axiom)
        axiom_node_free_tree(sig_axiom, env);
    if (type_map)
        axiom_node_free_tree(type_map, env);

    return AXIS2_FALSE;
}
示例#3
0
static axis2_status_t
savan_default_publisher_publish_to_subscriber(
    savan_publisher_t *publishermod,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client,
    savan_subscriber_t *subscriber,
    savan_filter_mod_t *filtermod,
    axiom_node_t *payload)
{
    axis2_options_t *options = NULL;
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_endpoint_ref_t *to = NULL;
    const axis2_char_t *address = NULL;
    axis2_bool_t filter_apply = AXIS2_TRUE;
    axis2_endpoint_ref_t *notifyto = NULL;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_default_publisher_publish_to_subscriber");

    options = (axis2_options_t *) axis2_svc_client_get_options(svc_client, env);
    if(!options)
    {
        options = axis2_options_create(env);
        axis2_svc_client_set_options(svc_client, env, options);
    }
    axis2_options_set_action(options, env, "http://ws.apache.org/ws/2007/05/eventing-extended/Publish");
    axis2_svc_client_engage_module(svc_client, env, AXIS2_MODULE_ADDRESSING);

    notifyto = savan_subscriber_get_notify_to(subscriber, env);
    if(notifyto)
    {
        address = axis2_endpoint_ref_get_address(notifyto, env);
        if(address)
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Publishing to:%s", address);
            to = axis2_endpoint_ref_create(env, address);
            axis2_options_set_to(options, env, to);
        }
    }
    axis2_options_set_xml_parser_reset(options, env, AXIS2_FALSE);

#ifdef SAVAN_FILTERING
    /* If this is a filtering request and filter module is defined then filter the request.
     */
    {
        axis2_char_t *filter_dialect = NULL;
        filter_dialect = savan_subscriber_get_filter_dialect(subscriber, env);
        if(!axutil_strcmp(filter_dialect, SYNAPSE_FILTER_DIALECT))
        {
            /* Do nothing */
        }
        else if(filtermod && savan_subscriber_get_filter(subscriber, env))
        {
            /* Apply the filter, and check whether it evaluates to success */
            filter_apply = savan_filter_mod_apply(filtermod ,env, subscriber, payload);
            if(!filter_apply)
            {
                status = axutil_error_get_status_code(env->error);
                if(AXIS2_SUCCESS != status)
                {
                    axiom_node_detach(payload, env);
                    return status;
                }
            }
        }
        else
        {
            AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_MODULE_COULD_NOT_BE_RETRIEVED, 
                    AXIS2_FAILURE);
            return AXIS2_FAILURE;
        }
    }
#endif

    if(filter_apply)
    {
        axis2_svc_client_fire_and_forget(svc_client, env, payload);
    }

    axiom_node_detach(payload, env); /*insert this to prevent payload corruption in subsequent 
                                       "publish" calls with some payload.*/

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_default_publisher_publish_to_subscriber");

    return status;
}
示例#4
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
savan_client_subscribe(
    savan_client_t *client,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client,
    axutil_hash_t *options)
{
    axis2_options_t *wsa_options = NULL;
    const axis2_char_t *old_action = NULL;
    axiom_node_t *reply = NULL;
    axiom_node_t *sub_node = NULL;
    axiom_element_t *body_elem = NULL;
    axis2_char_t *sub_id = NULL;
    axis2_char_t *sub_url = NULL;
    axis2_char_t *sub_elem_local_name = NULL;
    savan_subscriber_t *subscriber = NULL;
    /*axis2_char_t *endto = NULL;*/
    axis2_char_t *notify = NULL;
    axis2_char_t *filter = NULL;
    axis2_char_t *filter_dialect = NULL;
    axis2_char_t *expires = NULL;
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_endpoint_ref_t *endpoint_ref = NULL;

    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_subscribe");
    
    /* set wsa action as Subscribe. remember the old action */
    wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env);
    old_action = axis2_options_get_action(wsa_options, env);
    axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_SUB);
    
    /* extract the values from the options map */
    /* endto endpoint reference is used by the event source to send a subscription end message. Default is not
     * to send this message by the event source. How this should be provided by the client?
     */
    /*endto = axutil_hash_get(options, SAVAN_OP_KEY_ENDTO_EPR, AXIS2_HASH_KEY_STRING);*/
    notify = axutil_hash_get(options, SAVAN_OP_KEY_NOTIFY_EPR, AXIS2_HASH_KEY_STRING);
    filter = axutil_hash_get(options, SAVAN_OP_KEY_FILTER, AXIS2_HASH_KEY_STRING);
    filter_dialect = axutil_hash_get(options, SAVAN_OP_KEY_FILTER_DIALECT, AXIS2_HASH_KEY_STRING);
    expires = axutil_hash_get(options, SAVAN_OP_KEY_EXPIRES, AXIS2_HASH_KEY_STRING);

    subscriber = savan_subscriber_create(env);
    /*endpoint_ref = axis2_endpoint_ref_create(env, endto);
    savan_subscriber_set_end_to(subscriber, env, endpoint_ref);*/
    endpoint_ref = axis2_endpoint_ref_create(env, notify);
    savan_subscriber_set_notify_to(subscriber, env, endpoint_ref);
    savan_subscriber_set_filter(subscriber, env, filter);
    savan_subscriber_set_filter_dialect(subscriber, env, filter_dialect);
    if(expires)
    {
        savan_subscriber_set_expires(subscriber, env, expires);
    }

    /* Create the Subscriber node */
    sub_node = savan_util_create_subscriber_node(env, subscriber, NULL);
    if(!sub_node)
    {
        status = axutil_error_get_status_code(env->error);
        savan_subscriber_free(subscriber, env);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Could not create the subscriber node");
        return status;
    }

    /* send the Subscription and wait for the response */
    reply = axis2_svc_client_send_receive(svc_client, env, sub_node);
    
    /* reset the old action */
    axis2_options_set_action(wsa_options, env, old_action);
    
    if (!reply)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                "[savan] Failed to send subscription request. Error: %d Reason: %s", 
                env->error->error_number,
        AXIS2_ERROR_GET_MESSAGE(env->error));
        return AXIS2_FAILURE;
    }

    /* Extract the subscription id from the response and store for future
     * requests */
    
    /* Get Body element from body node */
    body_elem = (axiom_element_t*)axiom_node_get_data_element(reply, env);
    
    /* Check whether we have received a SubscribeResponse */
    sub_elem_local_name = axiom_element_get_localname(body_elem, env);

    if (axutil_strcmp(ELEM_NAME_SUB_RESPONSE, sub_elem_local_name))
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Subscription failed");
        return AXIS2_FAILURE;
    }

    sub_id = savan_client_get_sub_id_from_response(body_elem, reply, env);
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sub_id3:%s", sub_id); 
    client->sub_id = axutil_strdup(env, sub_id);
    sub_url = savan_client_get_sub_url_from_response(body_elem, reply, env);
    client->sub_url = axutil_strdup(env, sub_url);

    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_subscribe");
    return AXIS2_SUCCESS;
}
示例#5
0
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
savan_client_get_status(
    savan_client_t *client,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client)
{
    axis2_options_t *wsa_options = NULL;
    const axis2_char_t *old_action = NULL;
    axutil_qname_t *qname = NULL;
    axiom_namespace_t *ns = NULL;
    axiom_node_t *reply = NULL;
    axiom_node_t *status_node = NULL;
    axiom_node_t *expires_node = NULL;
    axiom_element_t *status_elem = NULL;
    axiom_element_t *expires_elem = NULL;
    axis2_char_t *expires = NULL;
    axis2_char_t *status_elem_localname = NULL;

    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_get_status");
    
    /* Set wsa action as GetStatus. remember the old action */
    wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env);
    old_action = axis2_options_get_action(wsa_options, env);
    axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_GET_STATUS);
    
    /* Create the body of the GetStatus request */
    ns = axiom_namespace_create (env, EVENTING_NAMESPACE, EVENTING_NS_PREFIX);
    status_elem = axiom_element_create(env, NULL, ELEM_NAME_GETSTATUS, ns, &status_node);
    
    savan_client_add_sub_id_to_soap_header(client, env, svc_client);

    /* Send the GetStatus request and wait for the response */
    reply = axis2_svc_client_send_receive(svc_client, env, status_node);
    
    /* Reset the old action */
    axis2_options_set_action(wsa_options, env, old_action);
    
    if (!reply)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to send get status "
            "request. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }
    
    status_elem = (axiom_element_t*)axiom_node_get_data_element(reply, env);
    
    /* Check whether we have received a GetStatusResponse */
    status_elem_localname = axiom_element_get_localname(status_elem, env);

    if (axutil_strcmp(ELEM_NAME_GETSTATUS_RESPONSE, status_elem_localname))
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve GetStatusResponse"\
            "element. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }
    
    /* Now read Expires sub element */
    qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, NULL);
    expires_elem = axiom_element_get_first_child_with_qname(status_elem, env, qname, reply, 
            &expires_node);
    axutil_qname_free(qname, env);
    if(!expires_node)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve Expires"\
            "element. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }
   
    expires_elem = (axiom_element_t *) axiom_node_get_data_element(expires_node, env);

    expires = axiom_element_get_text(expires_elem, env, expires_node);
    
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_get_status");
    return expires;
}
示例#6
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
savan_client_renew(
    savan_client_t *client,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client,
    axutil_hash_t *options)
{
    axis2_options_t *wsa_options = NULL;
    const axis2_char_t *old_action = NULL;
    axiom_namespace_t *ns = NULL;
    axiom_node_t *reply = NULL;
    axiom_node_t *renew_node = NULL;
    axiom_node_t *expires_node = NULL;
    axiom_element_t *renew_elem = NULL;
    axiom_element_t *expires_elem = NULL;
    axis2_char_t *expires = NULL;
    axis2_char_t *renew_elem_localname = NULL;
    axutil_qname_t *qname = NULL;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Entry:savan_client_renew");
    
    /* Set wsa action as Renew. remember the old action */
    wsa_options = (axis2_options_t*)axis2_svc_client_get_options(svc_client, env);
    old_action = axis2_options_get_action(wsa_options, env);
    axis2_options_set_action(wsa_options, env, SAVAN_ACTIONS_RENEW);
     
    /* Create the body of the Renew request */
    ns = axiom_namespace_create (env, EVENTING_NAMESPACE, EVENTING_NS_PREFIX);
    renew_elem = axiom_element_create(env, NULL, ELEM_NAME_RENEW, ns, &renew_node);
        
    /* Extract the values from the options map */
    expires = axutil_hash_get(options, SAVAN_OP_KEY_EXPIRES, AXIS2_HASH_KEY_STRING);
    if(expires)
    {
        /* Expires element */
        expires_elem = axiom_element_create(env, renew_node, ELEM_NAME_EXPIRES, ns,
            &expires_node);
        axiom_element_set_text(expires_elem, env, expires, expires_node);
    }

    savan_client_add_sub_id_to_soap_header(client, env, svc_client);

    /* send the Renew request and wait for the response */
    reply = axis2_svc_client_send_receive(svc_client, env, renew_node);
    
    /* reset the old action */
    axis2_options_set_action(wsa_options, env, old_action);
   
    if (!reply)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                "[savan] Failed to send renew request. Error: %d Reason: %s", 
                env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }
   
    renew_elem = (axiom_element_t*)axiom_node_get_data_element(reply, env);
    /* Check whether we have received a RenewResponse */
    renew_elem_localname = axiom_element_get_localname(renew_elem, env);

    if (axutil_strcmp(ELEM_NAME_RENEW_RESPONSE, renew_elem_localname))
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve RenewResponse"\
            "element. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }

    /* Get Expires element from RenewResponse element */
    qname = axutil_qname_create(env, ELEM_NAME_EXPIRES, EVENTING_NAMESPACE, NULL);
    expires_elem = axiom_element_get_first_child_with_qname(renew_elem, env, qname, reply, 
            &expires_node);
    axutil_qname_free(qname, env);
    if(!expires_node)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to retrieve Expires"\
            "element. Error: %d Reason: %s", env->error->error_number,
            AXIS2_ERROR_GET_MESSAGE(env->error));
        return NULL;
    }
   
    expires = axiom_element_get_text(expires_elem, env, expires_node);
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_renew");
    return expires;
}