axis2_stub_t* AXIS2_CALL
      axis2_stub_create_IIp2Location(const axutil_env_t *env,
                                      const axis2_char_t *client_home,
                                      const axis2_char_t *endpoint_uri)
      {
         axis2_stub_t *stub = NULL;
         axis2_endpoint_ref_t *endpoint_ref = NULL;
         AXIS2_FUNC_PARAM_CHECK (client_home, env, NULL)

         if (NULL == endpoint_uri)
         {
            endpoint_uri = axis2_stub_get_endpoint_uri_of_IIp2Location(env);
         }

         endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);

         stub = axis2_stub_create_with_endpoint_ref_and_client_home (env, endpoint_ref, client_home);

         if (NULL == stub)
         {
            if(NULL != endpoint_ref)
            {
                axis2_endpoint_ref_free(endpoint_ref, env);
            }
            return NULL;
         }


         axis2_stub_populate_services_for_IIp2Location(stub, env);
         return stub;
      }
      axis2_stub_t*
      axis2_stub_create_CallbackServiceUserStubService(const axutil_env_t *env,
                                      axis2_char_t *client_home,
                                      axis2_char_t *endpoint_uri)
      {
         axis2_stub_t *stub = NULL;
         axis2_endpoint_ref_t *endpoint_ref = NULL;
         AXIS2_FUNC_PARAM_CHECK (client_home, env, NULL)

         if (NULL == endpoint_uri)
         {
            endpoint_uri = axis2_stub_get_endpoint_uri_of_CallbackServiceUserStubService(env);
         }

         endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);

         stub = axis2_stub_create_with_endpoint_ref_and_client_home (env, endpoint_ref, client_home);

         if (NULL == stub)
         {
            if(NULL != endpoint_ref)
            {
                axis2_endpoint_ref_free(endpoint_ref, env);
            }
            return NULL;
         }


         axis2_stub_populate_services_for_CallbackServiceUserStubService(stub, env);
         return stub;
      }
示例#3
0
void* AXIS2_CALL 
sandesha2_address_from_om_node(
    sandesha2_address_t *address,
   	const axutil_env_t *env, axiom_node_t *om_node)
{
    axiom_element_t *om_element = NULL;
    axiom_element_t *addr_part = NULL;
    axiom_node_t *addr_node = NULL;
    axutil_qname_t *addr_qname = NULL;
    axis2_char_t *str_address = NULL;

    AXIS2_PARAM_CHECK(env->error, om_node, NULL);
    om_element = axiom_node_get_data_element(om_node, env);
    if(!om_element)
    {
        AXIS2_ERROR_SET(env->error, (axutil_error_codes_t)SANDESHA2_ERROR_NULL_OM_ELEMENT,
           AXIS2_FAILURE);
        return NULL;
    }
    addr_qname = axutil_qname_create(env, SANDESHA2_WSA_ADDRESS, 
           address->ns_val, NULL);
    if(!addr_qname)
    {
        return NULL;
    } 
    addr_part = axiom_element_get_first_child_with_qname(om_element, env, 
            addr_qname, om_node, &addr_node);
    if(addr_qname)
        axutil_qname_free(addr_qname, env);
    if(!addr_part)
    {
        AXIS2_ERROR_SET(env->error, (axutil_error_codes_t)SANDESHA2_ERROR_NULL_OM_ELEMENT,
            AXIS2_FAILURE);
        return NULL;
    }
    str_address = axiom_element_get_text(addr_part, env, addr_node);
    if(!str_address || 0 == axutil_strlen(str_address))
    {
        AXIS2_ERROR_SET(env->error, (axutil_error_codes_t)SANDESHA2_ERROR_EMPTY_OM_ELEMENT,
            AXIS2_FAILURE);
        return NULL;
    }

    if(address->epr)
    {
        axis2_endpoint_ref_free(address->epr, env);
        address->epr = NULL;
    }

    address->epr = axis2_endpoint_ref_create(env, str_address);

    if(!address->epr)
    {
        return NULL;
    }
    return address;
}
示例#4
0
AXIS2_EXTERN void AXIS2_CALL
axis2_msg_info_headers_free(
    struct axis2_msg_info_headers *msg_info_headers,
    const axutil_env_t * env)
{
    if(msg_info_headers->to)
    {
        axis2_endpoint_ref_free(msg_info_headers->to, env);
    }
    if(msg_info_headers->from)
    {
        axis2_endpoint_ref_free(msg_info_headers->from, env);
    }
    if(msg_info_headers->reply_to)
    {
        axis2_endpoint_ref_free(msg_info_headers->reply_to, env);
    }
    if(msg_info_headers->relates_to)
    {
        axis2_relates_to_free(msg_info_headers->relates_to, env);
    }

    if(msg_info_headers->fault_to)
    {
        axis2_endpoint_ref_free(msg_info_headers->fault_to, env);
    }

    if(msg_info_headers->ref_params)
    {
        axutil_array_list_free(msg_info_headers->ref_params, env);
    }
    if(msg_info_headers->action)
    {
        AXIS2_FREE(env->allocator, msg_info_headers->action);
    }
    if(msg_info_headers->message_id)
    {
        AXIS2_FREE(env->allocator, msg_info_headers->message_id);
    }

    AXIS2_FREE(env->allocator, msg_info_headers);

    return;
}
void AXIS2_CALL
axis2_endpoint_ref_free_void_arg(
    void *endpoint_ref,
    const axutil_env_t * env)
{
    axis2_endpoint_ref_t *endpoint_ref_l = NULL;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);

    endpoint_ref_l = (axis2_endpoint_ref_t *) endpoint_ref;
    axis2_endpoint_ref_free(endpoint_ref_l, env);
    return;
}
示例#6
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_msg_info_headers_set_to(
    struct axis2_msg_info_headers * msg_info_headers,
    const axutil_env_t * env,
    axis2_endpoint_ref_t * to)
{
    if(msg_info_headers->to && to) /* if the incoming to is NULL,
     we consider that to be a reset,
     so don't free */
    {
        axis2_endpoint_ref_free(msg_info_headers->to, env);
        msg_info_headers->to = NULL;
    }
    msg_info_headers->to = to;
    return AXIS2_SUCCESS;
}
示例#7
0
axis2_status_t AXIS2_CALL
sandesha2_address_set_epr(
    sandesha2_address_t *address,
   	const axutil_env_t *env, 
    axis2_endpoint_ref_t *epr)
{
    AXIS2_PARAM_CHECK(env->error, epr, AXIS2_FAILURE);
    
    if(address->epr)
    {
        axis2_endpoint_ref_free(address->epr, env);
        address->epr = NULL;
    }

	address->epr = epr;
    return AXIS2_SUCCESS;
}
示例#8
0
axis2_status_t AXIS2_CALL 
sandesha2_address_free (
    sandesha2_address_t *address, 
    const axutil_env_t *env)
{
    if(address->ns_val)
    {
        AXIS2_FREE(env->allocator, address->ns_val);
        address->ns_val = NULL;
    }
    
    if(address->epr)
    {
        axis2_endpoint_ref_free(address->epr, env);
        address->epr = NULL;
    }

	AXIS2_FREE(env->allocator, address);
	return AXIS2_SUCCESS;
}
axis2_endpoint_ref_t *AXIS2_CALL
axis2_endpoint_ref_create(
    const axutil_env_t * env,
    const axis2_char_t * address)
{
    axis2_endpoint_ref_t *endpoint_ref = NULL;

    AXIS2_ENV_CHECK(env, NULL);

    endpoint_ref = AXIS2_MALLOC(env->allocator, sizeof(axis2_endpoint_ref_t));
    if (!endpoint_ref)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }

    endpoint_ref->address = NULL;
    endpoint_ref->interface_qname = NULL;
    endpoint_ref->ref_param_list = NULL;
    endpoint_ref->metadata_list = NULL;
    endpoint_ref->ref_attribute_list = NULL;
    endpoint_ref->meta_attribute_list = NULL;
    endpoint_ref->extension_list = NULL;
    endpoint_ref->svc_name = NULL;

    if (address)
    {
        endpoint_ref->address = axutil_strdup(env, address);
        if (!(endpoint_ref->address))
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
            axis2_endpoint_ref_free(endpoint_ref, env);
            return NULL;
        }
    }

    return endpoint_ref;
}
示例#10
0
/**
 * Create a new create_seq_msg
 * @param env
 * @param application_rm_msg
 * @param internal_seq_id
 * @param acks_to
 * @param seq_prop_mgr
 * @return sandesha2_msg_ctx_t
 */
sandesha2_msg_ctx_t *AXIS2_CALL
sandesha2_msg_creator_create_create_seq_msg(
    const axutil_env_t *env,
    sandesha2_msg_ctx_t *application_rm_msg, 
    axis2_char_t *internal_seq_id,
    axis2_char_t *acks_to,
    sandesha2_seq_property_mgr_t *seq_prop_mgr)
{
    axis2_msg_ctx_t *application_msg_ctx = NULL;
    axis2_msg_ctx_t *create_seq_msg_ctx = NULL;
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_op_t *app_msg_op_desc = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
    axis2_char_t *create_seq_msg_id = NULL;
    axis2_char_t *rm_version = NULL;
    axis2_char_t *rm_ns_value = NULL;
    axis2_char_t *addressing_ns_value = NULL;
    axis2_char_t *anonymous_uri = NULL;
    axis2_char_t *temp_value = NULL;
    axis2_char_t *temp_action = NULL;
    axutil_string_t *temp_soap_action = NULL;
    axis2_endpoint_ref_t *to_epr = NULL;
    axis2_endpoint_ref_t *temp_to = NULL;
    axis2_endpoint_ref_t *acks_to_epr = NULL;
    axis2_endpoint_ref_t *temp_reply_to = NULL;
    sandesha2_create_seq_t *create_seq_part = NULL;
    sandesha2_seq_property_bean_t *reply_to_bean = NULL;
    sandesha2_seq_property_bean_t *to_bean = NULL;
    sandesha2_msg_ctx_t *create_seq_rm_msg = NULL;
    sandesha2_address_t *temp_address = NULL;
    sandesha2_acks_to_t *temp_acks_to = NULL;
    axutil_property_t *property = NULL;
    const axis2_char_t *reply_to_address = NULL;

    application_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(application_rm_msg, env);
    if(!application_msg_ctx)
    {
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_APPLICATION_MSG_NULL, AXIS2_FAILURE);
        return NULL;
    }

    conf_ctx = axis2_msg_ctx_get_conf_ctx(application_msg_ctx, env);
    if(!conf_ctx)
    {
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
        return NULL;
    }

    /* Creating by copying common contents.
     */
    create_seq_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, application_rm_msg);

    sandesha2_msg_creator_init_creation(env, application_msg_ctx, create_seq_msg_ctx);

    create_seq_msg_id = axutil_uuid_gen(env);
    axis2_msg_ctx_set_message_id(create_seq_msg_ctx, env, create_seq_msg_id);
    AXIS2_FREE(env->allocator, create_seq_msg_id);

    app_msg_op_desc = axis2_msg_ctx_get_op(application_msg_ctx, env);

    property = axis2_msg_ctx_get_property(application_msg_ctx, env, AXIS2_TARGET_EPR);
    if(property)
    {
        temp_to = axutil_property_get_value(property, env);
        to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_to, env));
    }

    if (!to_epr)
    {
        temp_to = sandesha2_msg_ctx_get_to(application_rm_msg, env); 
        if (temp_to)
        {
            to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_to, env));
        }
    }

    if (to_epr)
    {
        axis2_msg_ctx_set_to(create_seq_msg_ctx, env, to_epr);
        to_epr = NULL;
    }
    
    temp_reply_to = sandesha2_msg_ctx_get_reply_to(application_rm_msg, env); 
    if(temp_reply_to)
    {
        axis2_endpoint_ref_t *reply_to_epr = NULL;

        reply_to_address = axis2_endpoint_ref_get_address(temp_reply_to, env);
        reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
        if(reply_to_epr)
        {
            axis2_msg_ctx_set_reply_to(create_seq_msg_ctx, env, reply_to_epr);
        }
    }

    create_seq_rm_msg = sandesha2_msg_ctx_create(env, create_seq_msg_ctx);

        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "create_seq_internal_seq_id:%s", internal_seq_id);
    rm_version = sandesha2_utils_get_rm_version(env, application_msg_ctx);

    if(!rm_version)
    {
        AXIS2_ERROR_SET(env->error, 
                SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, AXIS2_FAILURE);
        return NULL;
    }

    rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);

    addressing_ns_value = sandesha2_utils_get_seq_property(env, internal_seq_id, 
        SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);

    create_seq_part = sandesha2_create_seq_create(env, addressing_ns_value, rm_ns_value);
    if(!create_seq_part)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] creating create sequence message failed");
        return NULL;
    }

    /* Adding sequence offer if present */
    op_ctx = axis2_msg_ctx_get_op_ctx(application_msg_ctx, env);
    if(op_ctx)
    {
        axis2_op_t *operation = NULL;
        int mep = -1;
        axis2_char_t *offered_seq_id = NULL;
        /*axutil_property_t *property = NULL;
        axis2_ctx_t *ctx = NULL;

        ctx = axis2_msg_ctx_get_base(application_msg_ctx, env);
        property = axis2_ctx_get_property(ctx, env, SANDESHA2_CLIENT_OFFERED_SEQ_ID);
        if(property)
        {
            offered_seq_id = axutil_property_get_value(property, env);
        }*/
        operation = axis2_op_ctx_get_op(op_ctx, env);
        mep = axis2_op_get_axis_specific_mep_const(operation, env);
        if(mep == AXIS2_MEP_CONSTANT_OUT_IN)
        {
            offered_seq_id = axutil_uuid_gen(env);
        }

        /*if(offered_seq_id && 0 != axutil_strcmp("", offered_seq_id))*/
        if(offered_seq_id)
        {
            sandesha2_seq_offer_t *offer_part = NULL;
            sandesha2_identifier_t *identifier = NULL;
            sandesha2_endpoint_t *endpoint = NULL;

            offer_part = sandesha2_seq_offer_create(env, rm_ns_value, addressing_ns_value);
            identifier = sandesha2_identifier_create(env, rm_ns_value);
            sandesha2_identifier_set_identifier(identifier, env, offered_seq_id);
            sandesha2_seq_offer_set_identifier(offer_part, env, identifier);

            if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_version))
            {
                axis2_endpoint_ref_t *reply_to_epr = NULL;
                sandesha2_address_t *address = NULL;

                reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
                address = sandesha2_address_create(env, addressing_ns_value, reply_to_epr);
                endpoint = sandesha2_endpoint_create(env, address, rm_ns_value, 
                        addressing_ns_value);

                sandesha2_seq_offer_set_endpoint(offer_part, env, endpoint);
            }

            sandesha2_create_seq_set_seq_offer(create_seq_part, env, offer_part);
        }
    }

    reply_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_seq_id, 
            SANDESHA2_SEQ_PROP_REPLY_TO_EPR);

    to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_seq_id, 
            SANDESHA2_SEQ_PROP_TO_EPR);
    if (to_bean)
    {
        temp_value = sandesha2_seq_property_bean_get_value(to_bean, env);
    
        if (temp_value)
        {
            to_epr = axis2_endpoint_ref_create(env, temp_value);
        }

        sandesha2_seq_property_bean_free(to_bean, env);
    }

    anonymous_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addressing_ns_value);
    if(reply_to_bean)
    {
        axis2_endpoint_ref_t *reply_to_epr = NULL;

        temp_value = sandesha2_seq_property_bean_get_value(reply_to_bean, env);
        if(temp_value)
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_reply_to:%s", temp_value);
            reply_to_epr = axis2_endpoint_ref_create(env, temp_value);
            acks_to = axutil_strdup(env, temp_value);
        }

        if(reply_to_epr)
        {
            sandesha2_msg_ctx_set_reply_to(create_seq_rm_msg, env, reply_to_epr);
        }
        
        sandesha2_seq_property_bean_free(reply_to_bean, env);
    }
    
    if(!acks_to || !axutil_strcmp("", acks_to))
    {
        acks_to = axutil_strdup(env, anonymous_uri);
    }

    acks_to_epr = axis2_endpoint_ref_create(env, acks_to);

    temp_to = sandesha2_msg_ctx_get_to(create_seq_rm_msg, env);
    if(!temp_to && to_epr)
    {
        sandesha2_msg_ctx_set_to(create_seq_rm_msg, env, to_epr);
    }
    else
    {
        axis2_endpoint_ref_free(to_epr, env);
    }


    temp_address = sandesha2_address_create(env, addressing_ns_value, acks_to_epr);
    temp_acks_to = sandesha2_acks_to_create(env, temp_address, rm_ns_value, addressing_ns_value);

    if(addressing_ns_value)
    {
        AXIS2_FREE(env->allocator, addressing_ns_value);
    }

    sandesha2_create_seq_set_acks_to(create_seq_part, env,  temp_acks_to);
    sandesha2_msg_ctx_set_create_seq(create_seq_rm_msg, env, create_seq_part);
    sandesha2_msg_ctx_add_soap_envelope(create_seq_rm_msg, env);
    temp_action = sandesha2_spec_specific_consts_get_create_seq_action(env, rm_version);

    sandesha2_msg_ctx_set_wsa_action(create_seq_rm_msg, env, temp_action);

    temp_soap_action = axutil_string_create(env, temp_action);
    if(temp_soap_action)
    {
        sandesha2_msg_ctx_set_soap_action(create_seq_rm_msg, env, temp_soap_action);
        axutil_string_free(temp_soap_action, env);
    }

    /*sandesha2_msg_creator_finalize_creation(env, application_msg_ctx, create_seq_msg_ctx);*/

    return create_seq_rm_msg;
}