# Savan_util

## Functions
AXIS2_EXTERN axis2_status_t | savan_util_create_fault_envelope (axis2_msg_ctx_t *msg_ctx, const axutil_env_t *env, axis2_char_t *code, axis2_char_t *subcode, axis2_char_t *reason, axis2_char_t *detail)
AXIS2_EXTERN axiom_node_t * | savan_util_build_fault_msg (const axutil_env_t *env, axis2_char_t *code, axis2_char_t *subcode, axis2_char_t *reason, axis2_char_t *detail)
AXIS2_EXTERN savan_message_types_t | savan_util_get_message_type (axis2_msg_ctx_t *msg_ctx, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | savan_util_get_subscription_id_from_msg (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
AXIS2_EXTERN axutil_hash_t * | savan_util_get_subscriber_store (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
AXIS2_EXTERN axis2_char_t * | savan_util_get_expiry_time (const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | savan_util_get_renewed_expiry_time (const axutil_env_t *env, axis2_char_t *expiry)
AXIS2_EXTERN axis2_status_t | savan_util_set_store (axis2_svc_t *svc, const axutil_env_t *env, axis2_char_t *store_name)
AXIS2_EXTERN axis2_char_t * | savan_util_get_topic_name_from_topic_url (const axutil_env_t *env, axis2_char_t *topic_url)
AXIS2_EXTERN axis2_char_t * | savan_util_get_resource_connection_string (const axutil_env_t *env, axis2_conf_t *conf)
AXIS2_EXTERN axis2_char_t * | savan_util_get_resource_username (const axutil_env_t *env, axis2_conf_t *conf)
AXIS2_EXTERN axis2_char_t * | savan_util_get_resource_password (const axutil_env_t *env, axis2_conf_t *conf)
AXIS2_EXTERN axis2_char_t * | savan_util_get_module_param (const axutil_env_t *env, axis2_conf_t *conf, axis2_char_t *name)
AXIS2_EXTERN void * | savan_util_get_svc_client (const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | savan_util_process_subscriber_node (const axutil_env_t *env, axiom_node_t *sub_node, axiom_element_t *sub_elem, savan_subscriber_t *subscriber)
AXIS2_EXTERN axiom_node_t * | savan_util_create_subscriber_node (const axutil_env_t *env, savan_subscriber_t *subscriber, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | savan_util_create_savan_specific_subscriber_node (const axutil_env_t *env, savan_subscriber_t *subscriber, axiom_node_t *parent_node)
AXIS2_EXTERN savan_filter_mod_t * | savan_util_get_filter_module (const axutil_env_t *env, axis2_conf_t *conf)

## Function Documentation

AXIS2_EXTERN axiom_node_t* savan_util_build_fault_msg | ( | const axutil_env_t * | env,
|  | axis2_char_t * | code,
|  | axis2_char_t * | subcode,
|  | axis2_char_t * | reason,
|  | axis2_char_t * | detail |
| ) |  |  |

Build a savan fault message and send.

Parameters:

  | env,pointer | to the environment
  | code,SOAP12:Sender |
  | subcode,fault | subcode
  | reason,fault | reason
  | detail,details | about fault, and solution to avoid. Build a savan fault message
  | env,pointer | to the environment
  | code,SOAP12:Sender |
  | subcode,fault | subcode
  | reason,fault | reason
  | detail,details | about fault, and solution to avoid.

AXIS2_EXTERN axis2_status_t savan_util_create_fault_envelope | ( | axis2_msg_ctx_t * | msg_ctx,
|  | const axutil_env_t * | env,
|  | axis2_char_t * | code,
|  | axis2_char_t * | subcode,
|  | axis2_char_t * | reason,
|  | axis2_char_t * | detail |
| ) |  |  |

Create the fault envelope, to be sent to the client.

Parameters:

  | msg_ctx | msg context
  | env | environment
  | code,fault | code
  | subcode,fault | sub code
  | reason,fault | reason
  | detail,fault | deails.

AXIS2_EXTERN axis2_char_t* savan_util_get_expiry_time | ( | const axutil_env_t * | env | ) |

Calculate and return an expiry time for the subscription

Parameters:

  | env | pointer to environment struct

Returns:
  the expiry time on success, else NULL

AXIS2_EXTERN savan_filter_mod_t* savan_util_get_filter_module | ( | const axutil_env_t * | env,
|  | axis2_conf_t * | conf |
| ) |  |  |

Retrieve filter handler. If it is already created for this request scope then it should be available as a message context property. Otherwise create it and set as message context property.

Parameters:

  | env | environment object
  | conf | Axis2 main configuration instance

Returns:
  filter handler

AXIS2_EXTERN axis2_char_t* savan_util_get_module_param | ( | const axutil_env_t * | env,
|  | axis2_conf_t * | conf,
|  | axis2_char_t * | name |
| ) |  |  |

Get the module parameter value by passing the module parameter name.

Parameters:

  | env | pointer to environment struct
  | conf | Axis2/C configuration structure
  | name | module parameter name

Returns:
  module parameter value

AXIS2_EXTERN axis2_char_t* savan_util_get_renewed_expiry_time | ( | const axutil_env_t * | env,
|  | axis2_char_t * | expiry |
| ) |  |  |

Calculate and return a new expiry time for the subscription based on the current expiry time.

Parameters:

  | env | pointer to environment struct
  | expiry | current expiry time

Returns:
  the new expiry time on success, else NULL

AXIS2_EXTERN axutil_hash_t* savan_util_get_subscriber_store | ( | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

Get the subscriber store from the service Note that if the subscription manager is a separate service from the publisher service then both SubscriptionMgrName and SubscriptionMgrURL must be set in the publishers services.xml

Parameters:

  | env | pointer to environment struct
  | msg_ctx | pointer to message context

Returns:
  the store on success, else NULL

AXIS2_EXTERN axis2_char_t* savan_util_get_subscription_id_from_msg | ( | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

Extracts the subscription ID from the given messsage context.

Parameters:

  | env | pointer to environment struct
  | msg_ctx | pointer to message context

Returns:
  the ID on success, else NULL

AXIS2_EXTERN axis2_status_t savan_util_set_store | ( | axis2_svc_t * | svc,
|  | const axutil_env_t * | env,
|  | axis2_char_t * | store_name |
| ) |  |  |

Create subs hash and set as a service parameter.

Parameters:

  | env | pointer to environment struct
  | svc | subscription service

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE