/************************* Function Implmentations ********************************/
        adb_removeServicePoliciesByNamespace_t* AXIS2_CALL
        adb_removeServicePoliciesByNamespace_create(
            const axutil_env_t *env)
        {
            adb_removeServicePoliciesByNamespace_t *_removeServicePoliciesByNamespace = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _removeServicePoliciesByNamespace = (adb_removeServicePoliciesByNamespace_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_removeServicePoliciesByNamespace_t));

            if(NULL == _removeServicePoliciesByNamespace)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_removeServicePoliciesByNamespace, 0, sizeof(adb_removeServicePoliciesByNamespace_t));

            _removeServicePoliciesByNamespace->property_Type = axutil_strdup(env, "adb_removeServicePoliciesByNamespace");
            _removeServicePoliciesByNamespace->property_serviceName  = NULL;
                  _removeServicePoliciesByNamespace->is_valid_serviceName  = AXIS2_FALSE;
            _removeServicePoliciesByNamespace->property_namesapce  = NULL;
                  _removeServicePoliciesByNamespace->is_valid_namesapce  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "removeServicePoliciesByNamespace",
                        "http://org.apache.axis2/xsd",
                        NULL);
                _removeServicePoliciesByNamespace->qname = qname;
            

            return _removeServicePoliciesByNamespace;
        }
       /************************* Function Implmentations ********************************/
        adb_removeTransportBinding_t* AXIS2_CALL
        adb_removeTransportBinding_create(
            const axutil_env_t *env)
        {
            adb_removeTransportBinding_t *_removeTransportBinding = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _removeTransportBinding = (adb_removeTransportBinding_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_removeTransportBinding_t));

            if(NULL == _removeTransportBinding)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_removeTransportBinding, 0, sizeof(adb_removeTransportBinding_t));

            _removeTransportBinding->property_Type = axutil_strdup(env, "adb_removeTransportBinding");
            _removeTransportBinding->property_serviceId  = NULL;
                  _removeTransportBinding->is_valid_serviceId  = AXIS2_FALSE;
            _removeTransportBinding->property_transportProtocol  = NULL;
                  _removeTransportBinding->is_valid_transportProtocol  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "removeTransportBinding",
                        "http://org.apache.axis2/xsd",
                        NULL);
                _removeTransportBinding->qname = qname;
            

            return _removeTransportBinding;
        }
       /************************* Function Implmentations ********************************/
        adb_getSecurityConfigData_t* AXIS2_CALL
        adb_getSecurityConfigData_create(
            const axutil_env_t *env)
        {
            adb_getSecurityConfigData_t *_getSecurityConfigData = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _getSecurityConfigData = (adb_getSecurityConfigData_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_getSecurityConfigData_t));

            if(NULL == _getSecurityConfigData)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_getSecurityConfigData, 0, sizeof(adb_getSecurityConfigData_t));

            _getSecurityConfigData->property_Type = axutil_strdup(env, "adb_getSecurityConfigData");
            _getSecurityConfigData->property_serviceName  = NULL;
                  _getSecurityConfigData->is_valid_serviceName  = AXIS2_FALSE;
            _getSecurityConfigData->property_scenarioId  = NULL;
                  _getSecurityConfigData->is_valid_scenarioId  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "getSecurityConfigData",
                        "http://service.config.security.carbon.wso2.org",
                        NULL);
                _getSecurityConfigData->qname = qname;
            

            return _getSecurityConfigData;
        }
AXIS2_EXTERN axutil_http_chunked_stream_t *AXIS2_CALL
axutil_http_chunked_stream_create(
    const axutil_env_t *env,
    axutil_stream_t *stream)
{
    axutil_http_chunked_stream_t *chunked_stream = NULL;
    AXIS2_PARAM_CHECK(env->error, stream, NULL);

    chunked_stream = (axutil_http_chunked_stream_t *)AXIS2_MALLOC(env->allocator,
        sizeof(axutil_http_chunked_stream_t));
    if(!chunked_stream)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
        return NULL;
    }
    chunked_stream->stream = stream;
    chunked_stream->current_chunk_size = -1;
    chunked_stream->unread_len = -1;
    chunked_stream->end_of_chunks = AXIS2_FALSE;
    chunked_stream->chunk_started = AXIS2_FALSE;

    return chunked_stream;
}
Beispiel #5
0
int AXIS2_CALL
axutil_stream_write_file(
    axutil_stream_t *stream,
    const axutil_env_t *env,
    const void *buffer,
    size_t count)
{
    int len = 0;
    FILE *fp = NULL;

    if(!(stream->fp))
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_FD, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Trying to do operation on invalid file descriptor");

        return -1;
    }
    fp = stream->fp;
    if(!buffer)
        return -1;
    len = (int)fwrite(buffer, sizeof(axis2_char_t), count, fp);
    /* We are sure that the difference lies within the int range */
    return len;
}
AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
rp_rampart_config_create(
    const axutil_env_t * env)
{
    rp_rampart_config_t *rampart_config = NULL;

    AXIS2_ENV_CHECK(env, NULL);

    rampart_config = (rp_rampart_config_t *) AXIS2_MALLOC(env->allocator,
                                                          sizeof
                                                          (rp_rampart_config_t));

    if (rampart_config == NULL)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }
    rampart_config->user = NULL;
    rampart_config->encryption_user = NULL;
    rampart_config->password_callback_class = NULL;
    rampart_config->private_key_file = NULL;
    rampart_config->receiver_certificate_file = NULL;
    rampart_config->certificate_file = NULL;
    rampart_config->authenticate_module = NULL;
    rampart_config->replay_detector = NULL;
    rampart_config->sct_provider = NULL;
    rampart_config->password_type = NULL;
    rampart_config->time_to_live = NULL;
    rampart_config->clock_skew_buffer = NULL;
    rampart_config->need_millisecond_precision = NULL;
	rampart_config->pkcs12_file = NULL;
    rampart_config->rd_val = NULL;
    rampart_config->ref = 0;

    return rampart_config;
}
axis2_http_out_transport_info_t *AXIS2_CALL
axis2_apache2_out_transport_info_create(
    const axutil_env_t * env,
    request_rec * request)
{
    axis2_apache2_out_transport_info_t *info = NULL;
    axis2_http_out_transport_info_t *out_transport_info = NULL;

    AXIS2_ENV_CHECK(env, NULL);

    info = (axis2_apache2_out_transport_info_t *)AXIS2_MALLOC(env->allocator,
        sizeof(axis2_apache2_out_transport_info_t));

    if(!info)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }
    info->request = request;
    info->encoding = NULL;

    out_transport_info = &(info->out_transport_info);
    out_transport_info->encoding = NULL;
    out_transport_info->response = NULL;

    axis2_http_out_transport_info_set_char_encoding_func(out_transport_info, env,
        axis2_apache_out_transport_info_set_char_encoding);
    axis2_http_out_transport_info_set_content_type_func(out_transport_info, env,
        axis2_apache_out_transport_info_set_content_type);
    axis2_http_out_transport_info_set_cookie_header_func(out_transport_info, env,
        axis2_apache_out_transport_info_set_cookie_header);
    axis2_http_out_transport_info_set_session_func(out_transport_info, env,
        axis2_apache_out_transport_info_set_session);

    return out_transport_info;
}
       /************************* Function Implmentations ********************************/
        adb_disengageModuleForServiceGroup_t* AXIS2_CALL
        adb_disengageModuleForServiceGroup_create(
            const axutil_env_t *env)
        {
            adb_disengageModuleForServiceGroup_t *_disengageModuleForServiceGroup = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _disengageModuleForServiceGroup = (adb_disengageModuleForServiceGroup_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_disengageModuleForServiceGroup_t));

            if(NULL == _disengageModuleForServiceGroup)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_disengageModuleForServiceGroup, 0, sizeof(adb_disengageModuleForServiceGroup_t));

            _disengageModuleForServiceGroup->property_Type = axutil_strdup(env, "adb_disengageModuleForServiceGroup");
            _disengageModuleForServiceGroup->property_moduleId  = NULL;
                  _disengageModuleForServiceGroup->is_valid_moduleId  = AXIS2_FALSE;
            _disengageModuleForServiceGroup->property_serviceGroupName  = NULL;
                  _disengageModuleForServiceGroup->is_valid_serviceGroupName  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "disengageModuleForServiceGroup",
                        "http://service.mgt.module.carbon.wso2.org",
                        NULL);
                _disengageModuleForServiceGroup->qname = qname;
            

            return _disengageModuleForServiceGroup;
        }
       /************************* Function Implmentations ********************************/
        adb_getOperationStatistics_t* AXIS2_CALL
        adb_getOperationStatistics_create(
            const axutil_env_t *env)
        {
            adb_getOperationStatistics_t *_getOperationStatistics = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _getOperationStatistics = (adb_getOperationStatistics_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_getOperationStatistics_t));

            if(NULL == _getOperationStatistics)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_getOperationStatistics, 0, sizeof(adb_getOperationStatistics_t));

            _getOperationStatistics->property_Type = axutil_strdup(env, "adb_getOperationStatistics");
            _getOperationStatistics->property_serviceName  = NULL;
                  _getOperationStatistics->is_valid_serviceName  = AXIS2_FALSE;
            _getOperationStatistics->property_operationName  = NULL;
                  _getOperationStatistics->is_valid_operationName  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "getOperationStatistics",
                        "http://org.apache.axis2/xsd",
                        NULL);
                _getOperationStatistics->qname = qname;
            

            return _getOperationStatistics;
        }
       /************************* Function Implmentations ********************************/
        adb_getServiceGroupParameter_t* AXIS2_CALL
        adb_getServiceGroupParameter_create(
            const axutil_env_t *env)
        {
            adb_getServiceGroupParameter_t *_getServiceGroupParameter = NULL;
            
                axutil_qname_t* qname = NULL;
            
            AXIS2_ENV_CHECK(env, NULL);

            _getServiceGroupParameter = (adb_getServiceGroupParameter_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_getServiceGroupParameter_t));

            if(NULL == _getServiceGroupParameter)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                return NULL;
            }

            memset(_getServiceGroupParameter, 0, sizeof(adb_getServiceGroupParameter_t));

            _getServiceGroupParameter->property_Type = axutil_strdup(env, "adb_getServiceGroupParameter");
            _getServiceGroupParameter->property_serviceGroupName  = NULL;
                  _getServiceGroupParameter->is_valid_serviceGroupName  = AXIS2_FALSE;
            _getServiceGroupParameter->property_paramName  = NULL;
                  _getServiceGroupParameter->is_valid_paramName  = AXIS2_FALSE;
            
                  qname =  axutil_qname_create (env,
                        "getServiceGroupParameter",
                        "http://org.apache.axis2/xsd",
                        NULL);
                _getServiceGroupParameter->qname = qname;
            

            return _getServiceGroupParameter;
        }
axis2_status_t
axis2_addr_in_extract_addr_params(
    const axutil_env_t * env,
    axiom_soap_header_t * soap_header,
    axis2_msg_info_headers_t ** msg_info_headers_p,
    axutil_array_list_t * addr_headers,
    const axis2_char_t * addr_ns_str,
    axis2_msg_ctx_t * msg_ctx)
{
    axutil_hash_t *header_block_ht = NULL;
    axutil_hash_index_t *hash_index = NULL;
    axis2_msg_info_headers_t *msg_info_headers = *(msg_info_headers_p);
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_bool_t to_found = AXIS2_FALSE;
    axis2_bool_t reply_to_found = AXIS2_FALSE;
    axis2_bool_t fault_to_found = AXIS2_FALSE;
    axis2_bool_t action_found = AXIS2_FALSE;
    axis2_bool_t msg_id_found = AXIS2_FALSE;

    AXIS2_PARAM_CHECK(env->error, soap_header, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, msg_info_headers_p, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, addr_headers, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE);

    if (!msg_info_headers)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No messgae info header. Creating new");
        msg_info_headers = axis2_msg_info_headers_create(env, NULL, NULL);
        if (!msg_info_headers)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MSG_INFO_HEADERS, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                        "No message information headers available");
            return AXIS2_FAILURE;
        }
    }

    header_block_ht = axiom_soap_header_get_all_header_blocks(soap_header, env);
    if (!header_block_ht)
    {
        return AXIS2_FAILURE;
    }

    /* Iterate thru header blocks */
    for (hash_index = axutil_hash_first(header_block_ht, env); hash_index;
         hash_index = axutil_hash_next(env, hash_index))
    {
        void *hb = NULL;
        axiom_soap_header_block_t *header_block = NULL;
        axiom_node_t *header_block_node = NULL;
        axiom_element_t *header_block_ele = NULL;
        axis2_char_t *ele_localname = NULL;
        axis2_endpoint_ref_t *epr = NULL;
        axis2_char_t *role = NULL;

        axutil_hash_this(hash_index, NULL, NULL, &hb);

        header_block = (axiom_soap_header_block_t *) hb;
        header_block_node =
            axiom_soap_header_block_get_base_node(header_block, env);
        header_block_ele =
            (axiom_element_t *) axiom_node_get_data_element(header_block_node,
                                                            env);
        ele_localname = axiom_element_get_localname(header_block_ele, env);

        role = axiom_soap_header_block_get_role(header_block, env);
        if (role && !axutil_strcmp(role, AXIOM_SOAP12_SOAP_ROLE_NONE))
        {
            /* Role is none, no need of processing */
            continue;
        }

        if (!axutil_strcmp(ele_localname, AXIS2_WSA_TO))
        {
            /* Here the addressing epr overidde what ever already there in the message context */

            epr =
                axis2_endpoint_ref_create(env,
                                          axiom_element_get_text
                                          (header_block_ele, env,
                                           header_block_node));
            if (AXIS2_TRUE == to_found)
            {
                /* Duplicate To */
                axis2_addr_in_create_fault_envelope(env,
                                                    AXIS2_WSA_PREFIX_TO, addr_ns_str,
                                                    msg_ctx);
                status = AXIS2_FAILURE;
                continue;
            }
            axis2_msg_info_headers_set_to(msg_info_headers, env, epr);

            axis2_addr_in_extract_to_epr_ref_params(env, epr, soap_header,
                                                    addr_ns_str);
            axiom_soap_header_block_set_processed(header_block, env);
            to_found = AXIS2_TRUE;
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_FROM))
        {
            epr = axis2_msg_info_headers_get_from(msg_info_headers, env);
            if (!epr)
            {
                /* The address is not known now. Pass the empty
                   string and fill this once the element 
                   under this is processed. */

                epr = axis2_endpoint_ref_create(env, "");
                axis2_msg_info_headers_set_from(msg_info_headers, env, epr);
            }
            axis2_addr_in_extract_epr_information(env, header_block, epr,
                                                  addr_ns_str);
            axiom_soap_header_block_set_processed(header_block, env);
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_REPLY_TO))
        {
            epr = axis2_msg_info_headers_get_reply_to(msg_info_headers, env);

            if (reply_to_found == AXIS2_TRUE)
            {
                /* Duplicate Reply To */
                axis2_addr_in_create_fault_envelope(env,
                                                    AXIS2_WSA_PREFIX_REPLY_TO, addr_ns_str,
                                                    msg_ctx);
                status = AXIS2_FAILURE;
                continue;
            }

            if (!epr)
            {
                epr = axis2_endpoint_ref_create(env, "");
                axis2_msg_info_headers_set_reply_to(msg_info_headers, env, epr);
            }
            axis2_addr_in_extract_epr_information(env, header_block, epr,
                                                  addr_ns_str);
            axiom_soap_header_block_set_processed(header_block, env);
            reply_to_found = AXIS2_TRUE;
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_FAULT_TO))
        {
            epr = axis2_msg_info_headers_get_fault_to(msg_info_headers, env);

            if (fault_to_found == AXIS2_TRUE)
            {
                /* Duplicate Fault To */
                axis2_addr_in_create_fault_envelope(env,
                                                    AXIS2_WSA_PREFIX_FAULT_TO, addr_ns_str,
                                                    msg_ctx);
                status = AXIS2_FAILURE;
                axis2_msg_info_headers_set_fault_to(msg_info_headers, env,
                                                    NULL);
                continue;
            }

            if (!epr)
            {
                epr = axis2_endpoint_ref_create(env, "");
                axis2_msg_info_headers_set_fault_to(msg_info_headers, env, epr);
            }
            axis2_addr_in_extract_epr_information(env, header_block, epr,
                                                  addr_ns_str);
            axiom_soap_header_block_set_processed(header_block, env);
            fault_to_found = AXIS2_TRUE;
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_MESSAGE_ID))
        {
            axis2_char_t *text = NULL;

            if (msg_id_found == AXIS2_TRUE)
            {
                /* Duplicate Message ID */
                axis2_addr_in_create_fault_envelope(env,
                                                    AXIS2_WSA_PREFIX_MESSAGE_ID,
                                                    addr_ns_str, msg_ctx);
                status = AXIS2_FAILURE;
                continue;
            }

            text =
                axiom_element_get_text(header_block_ele, env,
                                       header_block_node);
            axis2_msg_info_headers_set_in_message_id(msg_info_headers, env, text);
            axiom_soap_header_block_set_processed(header_block, env);
            msg_id_found = AXIS2_TRUE;
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_ACTION))
        {
            axis2_char_t *text = NULL;

            if (action_found == AXIS2_TRUE)
            {
                /* Duplicate Action */
                axis2_addr_in_create_fault_envelope(env,
                                                    AXIS2_WSA_PREFIX_ACTION, addr_ns_str,
                                                    msg_ctx);
                status = AXIS2_FAILURE;
                continue;
            }

            text =
                axiom_element_get_text(header_block_ele, env,
                                       header_block_node);
            axis2_msg_info_headers_set_action(msg_info_headers, env, text);
            axiom_soap_header_block_set_processed(header_block, env);
            action_found = AXIS2_TRUE;
        }
        else if (!axutil_strcmp(ele_localname, AXIS2_WSA_RELATES_TO))
        {
            axis2_char_t *address = NULL;
            axutil_qname_t *rqn = NULL;
            axiom_attribute_t *relationship_type = NULL;
            const axis2_char_t *relationship_type_default_value = NULL;
            const axis2_char_t *relationship_type_value = NULL;
            axis2_relates_to_t *relates_to = NULL;
            if (!axutil_strcmp(AXIS2_WSA_NAMESPACE_SUBMISSION, addr_ns_str))
            {
                relationship_type_default_value =
                    AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE_SUBMISSION;
            }
            else
            {
                relationship_type_default_value =
                    AXIS2_WSA_ANONYMOUS_URL_SUBMISSION;
            }
            rqn =
                axutil_qname_create(env, AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE,
                                    NULL, NULL);

            relationship_type =
                axiom_element_get_attribute(header_block_ele, env, rqn);

            if (!relationship_type)
            {
                relationship_type_value =
                    AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE_SUBMISSION;
            }
            else
            {
                relationship_type_value =
                    axiom_attribute_get_value(relationship_type, env);
            }

            address =
                axiom_element_get_text(header_block_ele, env,
                                       header_block_node);
            relates_to =
                axis2_relates_to_create(env, address, relationship_type_value);

            axis2_msg_info_headers_set_relates_to(msg_info_headers, env,
                                                  relates_to);
            axiom_soap_header_block_set_processed(header_block, env);

            axutil_qname_free(rqn, env);
        }
    }

    /* If an action is not found, it's a false*/
    if (action_found == AXIS2_FALSE)   
    {
        axis2_addr_in_create_fault_envelope(env,
                                            AXIS2_WSA_PREFIX_ACTION, addr_ns_str, msg_ctx);
        status = AXIS2_FAILURE;
    }

    return status;
}
Beispiel #12
0
static axis2_status_t AXIS2_CALL
axis2_msg_recv_load_and_init_svc_impl(
    axis2_msg_recv_t *msg_recv,
    const axutil_env_t *env,
    struct axis2_svc *svc)
{
    axutil_param_t *impl_info_param = NULL;
    void *impl_class = NULL;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);

    if(!svc)
    {
        return AXIS2_FAILURE;
    }

    impl_class = axis2_svc_get_impl_class(svc, env);
    if(impl_class)
    {
        return AXIS2_SUCCESS;
    }
    /* When we load the DLL we have to make sure that only one thread will load it */
    axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
    /* If more than one thread tries to acquires the lock, first thread loads the DLL.
     Others should not load the DLL */
    impl_class = axis2_svc_get_impl_class(svc, env);
    if(impl_class)
    {
        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
        return AXIS2_SUCCESS;
    }
    impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
    if(!impl_info_param)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
        return AXIS2_FAILURE;
    }

    axutil_allocator_switch_to_global_pool(env->allocator);

    axutil_class_loader_init(env);

    impl_class = axutil_class_loader_create_dll(env, impl_info_param);
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "loading the services from msg_recv_load_and_init_svc");

    if(impl_class)
    {
        axis2_svc_skeleton_t *skel = (axis2_svc_skeleton_t *)impl_class;
        axis2_conf_t *conf = NULL;
        conf = axis2_conf_ctx_get_conf(msg_recv->conf_ctx, env);
        if (skel->ops->init)
        {
            AXIS2_SVC_SKELETON_INIT(skel, env);
        }
        if (skel->ops->init_with_conf)
        {
            AXIS2_SVC_SKELETON_INIT_WITH_CONF(skel, env, conf);
        }
    }

    axis2_svc_set_impl_class(svc, env, impl_class);

    axutil_allocator_switch_to_local_pool(env->allocator);
    axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
    return AXIS2_SUCCESS;
}
Beispiel #13
0
AXIS2_EXTERN axutil_url_t *AXIS2_CALL
axutil_url_parse_string(
    const axutil_env_t *env,
    const axis2_char_t *str_url)
{
    /**
     * Only accepted format is : 
     * protocol://host:port/path
     * Added file:///path
     * port is optional and the default port is assumed
     * if path is not present / (root) is assumed
     */
    axis2_char_t *tmp_url_str = NULL;
    axutil_url_t *ret = NULL;
    const axis2_char_t *protocol = NULL;
    axis2_char_t *path = NULL;
    axis2_char_t *port_str = NULL;
    axis2_char_t *host = NULL;
    int port = 0;

    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, str_url, NULL);

    tmp_url_str = axutil_strdup(env, str_url);
    if(!tmp_url_str)
    {
        return NULL;
    }
    protocol = tmp_url_str;
    host = strstr(tmp_url_str, "://");
    if(!host)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_ADDRESS, AXIS2_FAILURE);

        AXIS2_FREE(env->allocator, tmp_url_str);
        return NULL;
    }
    if(axutil_strlen(host) < 3 * sizeof(axis2_char_t))
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_ADDRESS, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invalid IP or hostname");
        AXIS2_FREE(env->allocator, tmp_url_str);
        return NULL;
    }
    *host = '\0';
    host += 3 * sizeof(axis2_char_t); /* skip "://" part */
    if(axutil_strlen(host) <= 0)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_ADDRESS, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invalid IP or hostname");
        AXIS2_FREE(env->allocator, tmp_url_str);
        return NULL;
    }
    /* if the url is file:// thing we need the protocol and
     * path only
     */
    if(0 == axutil_strcasecmp(protocol, (const axis2_char_t *)"file"))
    {
        ret = axutil_url_create(env, protocol, NULL, 0, host);
        AXIS2_FREE(env->allocator, tmp_url_str);
        return ret;
    }

    port_str = strchr(host, ':');
    if(!port_str)
    {
        path = strchr(host, '/');
        if(!path)
        {
            path = strchr(host, '?');
        }
        else
        {
            *path++ = '\0';
        }
        if(!path)
        {
            path = strchr(host, '#');
        }
        if(!path)
        {
            /* No path - assume def path ('/') */
            /* here we have protocol + host + def port + def path */
            ret = axutil_url_create(env, protocol, host, port, "/");
            AXIS2_FREE(env->allocator, tmp_url_str);
            return ret;
        }
        else
        {
            axis2_char_t *path_temp = NULL;

            path_temp = axutil_strdup(env, path);
            *path = '\0';
            /* here we have protocol + host + def port + path */
            ret = axutil_url_create(env, protocol, host, port, path_temp);
            AXIS2_FREE(env->allocator, tmp_url_str);
            AXIS2_FREE(env->allocator, path_temp);
            return ret;
        }
    }
    else
    {
        *port_str++ = '\0';
        path = strchr(port_str, '/');
        if(!path)
        {
            path = strchr(port_str, '?');
            if(path)
            {
                *path = '\0';
                port = AXIS2_ATOI(port_str);
                *path = '?';
            }
        }
        else
        {
            *path++ = '\0';
            port = AXIS2_ATOI(port_str);
        }
        if(!path)
        {
            path = strchr(port_str, '#');
            if(path)
            {
                *path = '\0';
                port = AXIS2_ATOI(port_str);
                *path = '#';
            }
        }
        if(!path)
        {
            port = AXIS2_ATOI(port_str);
            /* here we have protocol + host + port + def path */
            ret = axutil_url_create(env, protocol, host, port, "/");
            AXIS2_FREE(env->allocator, tmp_url_str);
            return ret;
        }
        else
        {
            if(axutil_strlen(path) > 0)
            {
                axis2_char_t *path_temp = NULL;

                path_temp = axutil_strdup(env, path);
                *path = '\0';
                /* here we have protocol + host + port + path */
                ret = axutil_url_create(env, protocol, host, port, path_temp);
                AXIS2_FREE(env->allocator, tmp_url_str);
                AXIS2_FREE(env->allocator, path_temp);
                return ret;
            }
            else
            {
                /* here we have protocol + host + port + def path */
                ret = axutil_url_create(env, protocol, host, port, "/");
                AXIS2_FREE(env->allocator, tmp_url_str);
                return ret;
            }
        }
    }
}
	/*
	 * This method invokes the right service method
	 */
	axiom_node_t* AXIS2_CALL
	axis2_svc_skel_IIp2Location_invoke(axis2_svc_skeleton_t *svc_skeleton,
				const axutil_env_t *env,
				axiom_node_t *content_node,
				axis2_msg_ctx_t *msg_ctx)
	{
         /* depending on the function name invoke the
          * corresponding  method
          */

          axis2_op_ctx_t *operation_ctx = NULL;
          axis2_op_t *operation = NULL;
          axutil_qname_t *op_qname = NULL;
          axis2_char_t *op_name = NULL;
          axis2_msg_ctx_t *in_msg_ctx = NULL;
          
          axiom_soap_envelope_t *req_soap_env = NULL;
          axiom_soap_header_t *req_soap_header = NULL;
          axiom_soap_envelope_t *res_soap_env = NULL;
          axiom_soap_header_t *res_soap_header = NULL;

          axiom_node_t *ret_node = NULL;
          axiom_node_t *input_header = NULL;
          axiom_node_t *output_header = NULL;
          axiom_node_t *header_base_node = NULL;
	    
          axis2_svc_skel_IIp2Location_t *svc_skeleton_wrapper = NULL;

          
            adb_getResponse_t* ret_val1;
            adb_get_t* input_val1;
            
            axis2_status_t ret_val2;
            adb_add_t* input_val2;
            

          svc_skeleton_wrapper = (axis2_svc_skel_IIp2Location_t*)svc_skeleton;
          operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
          operation = axis2_op_ctx_get_op(operation_ctx, env);
          op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env);
          op_name = axutil_qname_get_localpart(op_qname, env);

          if (op_name)
          {
               

                if ( axutil_strcmp(op_name, "get") == 0 )
                {

                    
                    input_val1 = adb_get_create( env);
                        if( AXIS2_FAILURE == adb_get_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_get_free(input_val1, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_get_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val1 =  axis2_skel_IIp2Location_get(env, msg_ctx,input_val1);
                    
                        if ( NULL == ret_val1 )
                        {
                            adb_get_free(input_val1, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getResponse_free(ret_val1, env);
                                   adb_get_free(input_val1, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "add") == 0 )
                {

                    
                    input_val2 = adb_add_create( env);
                        if( AXIS2_FAILURE == adb_add_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_add_free(input_val2, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_add_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val2 =  axis2_skel_IIp2Location_add(env, msg_ctx,input_val2);
                    
                        if( AXIS2_FAILURE == ret_val2 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from add ");
                        }
                        adb_add_free(input_val2, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             
             }
            
          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_IIp2Location service ERROR: invalid OM parameters in request\n");
          return NULL;
    }
         void AXIS2_CALL
         axis2_stub_start_op_IIp2Location_get( axis2_stub_t *stub, const axutil_env_t *env,
                                              adb_get_t* _get,
                                                  void *user_data,
                                                  axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, adb_getResponse_t* _getResponse, void *data) ,
                                                  axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data) )
         {

            axis2_callback_t *callback = NULL;

            axis2_svc_client_t *svc_client = NULL;
            axis2_options_t *options = NULL;

            const axis2_char_t *soap_action = NULL;
            axiom_node_t *payload = NULL;

            axis2_bool_t is_soap_act_set = AXIS2_TRUE;
            axutil_string_t *soap_act = NULL;

            
            
            struct axis2_stub_IIp2Location_get_callback_data *callback_data;

            callback_data = (struct axis2_stub_IIp2Location_get_callback_data*) AXIS2_MALLOC(env->allocator, 
                                    sizeof(struct axis2_stub_IIp2Location_get_callback_data));
            if(NULL == callback_data)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Can not allocate memeory for the callback data structures");
                return;
            }
            

            
                                payload = adb_get_serialize(_get, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                           


            svc_client = axis2_stub_get_svc_client(stub, env );
            
           
            
            

            options = axis2_stub_get_options( stub, env);
            if (NULL == options)
            {
              AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
              AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "options is null in stub");
              return;
            }

            soap_act =axis2_options_get_soap_action (options, env);
            if (NULL == soap_act)
            {
              is_soap_act_set = AXIS2_FALSE;
              soap_action = "urn:get";
              soap_act = axutil_string_create(env, "urn:get");
              axis2_options_set_soap_action(options, env, soap_act);
            }
            
            axis2_options_set_soap_version(options, env, AXIOM_SOAP12);
             

            callback = axis2_callback_create(env);
            /* Set our on_complete fucntion pointer to the callback object */
            axis2_callback_set_on_complete(callback, axis2_stub_on_complete_IIp2Location_get);
            /* Set our on_error function pointer to the callback object */
            axis2_callback_set_on_error(callback, axis2_stub_on_error_IIp2Location_get);

            callback_data-> data = user_data;
            callback_data-> on_complete = on_complete;
            callback_data-> on_error = on_error;

            axis2_callback_set_data(callback, (void*)callback_data);

            /* Send request */
            axis2_svc_client_send_receive_non_blocking(svc_client, env, payload, callback);
            
            if (!is_soap_act_set)
            {
              
              axis2_options_set_soap_action(options, env, NULL);
              
              axis2_options_set_action(options, env, NULL);
            }
         }
	/*
	 * This method invokes the right service method
	 */
	axiom_node_t* AXIS2_CALL
	axis2_svc_skel_LoggingAdmin_invoke(axis2_svc_skeleton_t *svc_skeleton,
				const axutil_env_t *env,
				axiom_node_t *content_node,
				axis2_msg_ctx_t *msg_ctx)
	{
         /* depending on the function name invoke the
          * corresponding  method
          */

          axis2_op_ctx_t *operation_ctx = NULL;
          axis2_op_t *operation = NULL;
          axutil_qname_t *op_qname = NULL;
          axis2_char_t *op_name = NULL;
          axis2_msg_ctx_t *in_msg_ctx = NULL;
          
          axiom_soap_envelope_t *req_soap_env = NULL;
          axiom_soap_header_t *req_soap_header = NULL;
          axiom_soap_envelope_t *res_soap_env = NULL;
          axiom_soap_header_t *res_soap_header = NULL;

          axiom_node_t *ret_node = NULL;
          axiom_node_t *input_header = NULL;
          axiom_node_t *output_header = NULL;
          axiom_node_t *header_base_node = NULL;
	    
          axis2_svc_skel_LoggingAdmin_t *svc_skeleton_wrapper = NULL;

          
            adb_getAllLoggerDataResponse_t* ret_val1;
            adb_getAllLoggerData_t* input_val1;
            
            axis2_status_t ret_val2;
            
            axis2_status_t ret_val3;
            adb_updateSystemLog_t* input_val3;
            
            adb_getSystemLogResponse_t* ret_val4;
            
            adb_getAppenderDataResponse_t* ret_val5;
            adb_getAppenderData_t* input_val5;
            
            axis2_status_t ret_val6;
            adb_updateAllAppenderData_t* input_val6;
            
            adb_getLoggerDataResponse_t* ret_val7;
            adb_getLoggerData_t* input_val7;
            
            axis2_status_t ret_val8;
            adb_updateLoggerData_t* input_val8;
            

          svc_skeleton_wrapper = (axis2_svc_skel_LoggingAdmin_t*)svc_skeleton;
          operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
          operation = axis2_op_ctx_get_op(operation_ctx, env);
          op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env);
          op_name = axutil_qname_get_localpart(op_qname, env);

          if (op_name)
          {
               

                if ( axutil_strcmp(op_name, "getAllLoggerData") == 0 )
                {

                    
                    input_val1 = adb_getAllLoggerData_create( env);
                        if( AXIS2_FAILURE == adb_getAllLoggerData_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getAllLoggerData_free(input_val1, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAllLoggerData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val1 =  axis2_skel_LoggingAdmin_getAllLoggerData(env, msg_ctx,input_val1);
                    
                        if ( NULL == ret_val1 )
                        {
                            adb_getAllLoggerData_free(input_val1, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getAllLoggerDataResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getAllLoggerDataResponse_free(ret_val1, env);
                                   adb_getAllLoggerData_free(input_val1, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "restoreDefaults") == 0 )
                {

                    
                        ret_val2 =  axis2_skel_LoggingAdmin_restoreDefaults(env, msg_ctx,
                                                (axis2_skel_LoggingAdmin_restoreDefaults_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val2 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from restoreDefaults ");
                        }
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "updateSystemLog") == 0 )
                {

                    
                    input_val3 = adb_updateSystemLog_create( env);
                        if( AXIS2_FAILURE == adb_updateSystemLog_deserialize(input_val3, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_updateSystemLog_free(input_val3, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateSystemLog_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val3 =  axis2_skel_LoggingAdmin_updateSystemLog(env, msg_ctx,input_val3,
                                                (axis2_skel_LoggingAdmin_updateSystemLog_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val3 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateSystemLog ");
                        }
                        adb_updateSystemLog_free(input_val3, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "getSystemLog") == 0 )
                {

                    
                        ret_val4 =  axis2_skel_LoggingAdmin_getSystemLog(env, msg_ctx,
                                                (axis2_skel_LoggingAdmin_getSystemLog_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if ( NULL == ret_val4 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getSystemLogResponse_serialize(ret_val4, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSystemLogResponse_free(ret_val4, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getAppenderData") == 0 )
                {

                    
                    input_val5 = adb_getAppenderData_create( env);
                        if( AXIS2_FAILURE == adb_getAppenderData_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getAppenderData_free(input_val5, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAppenderData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val5 =  axis2_skel_LoggingAdmin_getAppenderData(env, msg_ctx,input_val5);
                    
                        if ( NULL == ret_val5 )
                        {
                            adb_getAppenderData_free(input_val5, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getAppenderDataResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getAppenderDataResponse_free(ret_val5, env);
                                   adb_getAppenderData_free(input_val5, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "updateAllAppenderData") == 0 )
                {

                    
                    input_val6 = adb_updateAllAppenderData_create( env);
                        if( AXIS2_FAILURE == adb_updateAllAppenderData_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_updateAllAppenderData_free(input_val6, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateAllAppenderData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val6 =  axis2_skel_LoggingAdmin_updateAllAppenderData(env, msg_ctx,input_val6,
                                                (axis2_skel_LoggingAdmin_updateAllAppenderData_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val6 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateAllAppenderData ");
                        }
                        adb_updateAllAppenderData_free(input_val6, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "getLoggerData") == 0 )
                {

                    
                    input_val7 = adb_getLoggerData_create( env);
                        if( AXIS2_FAILURE == adb_getLoggerData_deserialize(input_val7, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getLoggerData_free(input_val7, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getLoggerData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val7 =  axis2_skel_LoggingAdmin_getLoggerData(env, msg_ctx,input_val7);
                    
                        if ( NULL == ret_val7 )
                        {
                            adb_getLoggerData_free(input_val7, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getLoggerDataResponse_serialize(ret_val7, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getLoggerDataResponse_free(ret_val7, env);
                                   adb_getLoggerData_free(input_val7, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "updateLoggerData") == 0 )
                {

                    
                    input_val8 = adb_updateLoggerData_create( env);
                        if( AXIS2_FAILURE == adb_updateLoggerData_deserialize(input_val8, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_updateLoggerData_free(input_val8, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_updateLoggerData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val8 =  axis2_skel_LoggingAdmin_updateLoggerData(env, msg_ctx,input_val8,
                                                (axis2_skel_LoggingAdmin_updateLoggerData_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val8 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from updateLoggerData ");
                        }
                        adb_updateLoggerData_free(input_val8, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             
             }
            
          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_LoggingAdmin service ERROR: invalid OM parameters in request\n");
          return NULL;
    }
Beispiel #17
0
neethi_assertion_t *AXIS2_CALL
neethi_assertion_create_with_args(
    const axutil_env_t *env,
    AXIS2_FREE_VOID_ARG free_func,
    void *value,
    neethi_assertion_type_t type)
{
    neethi_assertion_t *neethi_assertion = NULL;
    neethi_assertion = (neethi_assertion_t *)AXIS2_MALLOC(env->allocator,
        sizeof(neethi_assertion_t));

    if(!neethi_assertion)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi assertion creation failed. Out of memory");
        return NULL;
    }

    neethi_assertion->policy_components = NULL;
    neethi_assertion->policy_components = axutil_array_list_create(env, 0);
    if(!(neethi_assertion->policy_components))
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Neethi assertion policy components creation failed.");
        return NULL;
    }

    /* This ref count is for asertions which are represented from a struct.
     * These assertion structs are more probably referenced from some other
     * struct. So we need to increment the ref count in order to prevent
     * unnecessary memory freeing */

    if(type == ASSERTION_TYPE_X509_TOKEN)
    {
        rp_x509_token_increment_ref((rp_x509_token_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
    {
        rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_INITIATOR_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_RECIPIENT_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_PROTECTION_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_ENCRYPTION_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_TRANSPORT_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SIGNATURE_TOKEN)
    {
        rp_property_increment_ref((rp_property_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_LAYOUT)
    {
        rp_layout_increment_ref((rp_layout_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
    {
        rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_WSS10)
    {
        rp_wss10_increment_ref((rp_wss10_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_WSS11)
    {
        rp_wss11_increment_ref((rp_wss11_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_TRUST10)
    {
        rp_trust10_increment_ref((rp_trust10_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
    {
        rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_USERNAME_TOKEN)
    {
        rp_username_token_increment_ref((rp_username_token_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_ASSYMMETRIC_BINDING)
    {
        rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SYMMETRIC_BINDING)
    {
        rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_TRANSPORT_BINDING)
    {
        rp_transport_binding_increment_ref((rp_transport_binding_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS)
    {
        rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_RAMPART_CONFIG)
    {
        rp_rampart_config_increment_ref((rp_rampart_config_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
    {
        rp_issued_token_increment_ref((rp_issued_token_t *)value, env);
    }
    else if(type == ASSERTION_TYPE_SAML_TOKEN)
    {
        rp_saml_token_increment_ref((rp_saml_token_t *)value, env);
    }

    neethi_assertion->value = value;
    neethi_assertion->type = type;
    neethi_assertion->element = NULL;
    neethi_assertion->is_optional = AXIS2_FALSE;
    neethi_assertion->node = NULL;
    neethi_assertion->free_func = free_func;

    return neethi_assertion;
}
axis2_status_t
axis2_addr_in_extract_to_epr_ref_params(
    const axutil_env_t * env,
    axis2_endpoint_ref_t * to_epr,
    axiom_soap_header_t * soap_header,
    const axis2_char_t * addr_ns_str)
{
    axutil_hash_t *header_blocks_ht = NULL;
    axutil_hash_index_t *hash_index = NULL;
    axutil_qname_t *is_ref_qn = NULL;

    AXIS2_PARAM_CHECK(env->error, to_epr, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, soap_header, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, addr_ns_str, AXIS2_FAILURE);

    header_blocks_ht =
        axiom_soap_header_get_all_header_blocks(soap_header, env);
    if (!header_blocks_ht)
    {
        return AXIS2_FAILURE;
    }

    is_ref_qn =
        axutil_qname_create(env, "IsReferenceParameter", addr_ns_str, NULL);
    
    if (!is_ref_qn)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                        "No memory. Cannot create qname for %s", addr_ns_str);
        return AXIS2_FAILURE;
    }

    for (hash_index = axutil_hash_first(header_blocks_ht, env); hash_index;
         hash_index = axutil_hash_next(env, hash_index))
    {
        axiom_element_t *header_block_ele = NULL;
        axiom_node_t *header_block_node = NULL;
        axiom_soap_header_block_t *header_block = NULL;
        void *hb = NULL;
        axiom_attribute_t *is_ref_param_attr = NULL;
        axis2_char_t *attr_value = NULL;

        axutil_hash_this(hash_index, NULL, NULL, &hb);
        if (hb)
        {
            header_block = (axiom_soap_header_block_t *) hb;
            header_block_node =
                axiom_soap_header_block_get_base_node(header_block, env);
            header_block_ele =
                (axiom_element_t *)
                axiom_node_get_data_element(header_block_node, env);
            is_ref_param_attr =
                axiom_element_get_attribute(header_block_ele, env, is_ref_qn);
            if (is_ref_param_attr)
            {
                attr_value =
                    axiom_attribute_get_localname(is_ref_param_attr, env);
                if (!axutil_strcmp("true", attr_value))
                {
                    axis2_endpoint_ref_add_ref_param(to_epr, env,
                                                     header_block_node);
                }
            }
        }
    }

    axutil_qname_free(is_ref_qn, env);
    return AXIS2_SUCCESS;
}
	/*
	 * This method invokes the right service method
	 */
	axiom_node_t* AXIS2_CALL
	axis2_svc_skel_StatisticsAdmin_invoke(axis2_svc_skeleton_t *svc_skeleton,
				const axutil_env_t *env,
				axiom_node_t *content_node,
				axis2_msg_ctx_t *msg_ctx)
	{
         /* depending on the function name invoke the
          * corresponding  method
          */

          axis2_op_ctx_t *operation_ctx = NULL;
          axis2_op_t *operation = NULL;
          axutil_qname_t *op_qname = NULL;
          axis2_char_t *op_name = NULL;
          axis2_msg_ctx_t *in_msg_ctx = NULL;
          
          axiom_soap_envelope_t *req_soap_env = NULL;
          axiom_soap_header_t *req_soap_header = NULL;
          axiom_soap_envelope_t *res_soap_env = NULL;
          axiom_soap_header_t *res_soap_header = NULL;

          axiom_node_t *ret_node = NULL;
          axiom_node_t *input_header = NULL;
          axiom_node_t *output_header = NULL;
          axiom_node_t *header_base_node = NULL;
	    
          axis2_svc_skel_StatisticsAdmin_t *svc_skeleton_wrapper = NULL;

          
            adb_getMaxServiceResponseTimeResponse_t* ret_val1;
            adb_getMaxServiceResponseTime_t* input_val1;
            
            adb_getServiceRequestCountResponse_t* ret_val2;
            adb_getServiceRequestCount_t* input_val2;
            
            adb_getSystemResponseCountResponse_t* ret_val3;
            
            adb_getOperationResponseCountResponse_t* ret_val4;
            adb_getOperationResponseCount_t* input_val4;
            
            adb_getAvgOperationResponseTimeResponse_t* ret_val5;
            adb_getAvgOperationResponseTime_t* input_val5;
            
            adb_getOperationStatisticsResponse_t* ret_val6;
            adb_getOperationStatistics_t* input_val6;
            
            adb_getMinSystemResponseTimeResponse_t* ret_val7;
            
            adb_getSystemFaultCountResponse_t* ret_val8;
            
            adb_getMaxSystemResponseTimeResponse_t* ret_val9;
            
            adb_getServiceFaultCountResponse_t* ret_val10;
            adb_getServiceFaultCount_t* input_val10;
            
            adb_getMinServiceResponseTimeResponse_t* ret_val11;
            adb_getMinServiceResponseTime_t* input_val11;
            
            adb_getMaxOperationResponseTimeResponse_t* ret_val12;
            adb_getMaxOperationResponseTime_t* input_val12;
            
            adb_getServiceStatisticsResponse_t* ret_val13;
            adb_getServiceStatistics_t* input_val13;
            
            adb_getOperationFaultCountResponse_t* ret_val14;
            adb_getOperationFaultCount_t* input_val14;
            
            adb_getAvgServiceResponseTimeResponse_t* ret_val15;
            adb_getAvgServiceResponseTime_t* input_val15;
            
            adb_getServiceResponseCountResponse_t* ret_val16;
            adb_getServiceResponseCount_t* input_val16;
            
            adb_getSystemRequestCountResponse_t* ret_val17;
            
            adb_getMinOperationResponseTimeResponse_t* ret_val18;
            adb_getMinOperationResponseTime_t* input_val18;
            
            adb_getAvgSystemResponseTimeResponse_t* ret_val19;
            
            adb_getSystemStatisticsResponse_t* ret_val20;
            
            adb_getOperationRequestCountResponse_t* ret_val21;
            adb_getOperationRequestCount_t* input_val21;
            

          svc_skeleton_wrapper = (axis2_svc_skel_StatisticsAdmin_t*)svc_skeleton;
          operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
          operation = axis2_op_ctx_get_op(operation_ctx, env);
          op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env);
          op_name = axutil_qname_get_localpart(op_qname, env);

          if (op_name)
          {
               

                if ( axutil_strcmp(op_name, "getMaxServiceResponseTime") == 0 )
                {

                    
                    input_val1 = adb_getMaxServiceResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getMaxServiceResponseTime_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getMaxServiceResponseTime_free(input_val1, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMaxServiceResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val1 =  axis2_skel_StatisticsAdmin_getMaxServiceResponseTime(env, msg_ctx,input_val1);
                    
                        if ( NULL == ret_val1 )
                        {
                            adb_getMaxServiceResponseTime_free(input_val1, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getMaxServiceResponseTimeResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMaxServiceResponseTimeResponse_free(ret_val1, env);
                                   adb_getMaxServiceResponseTime_free(input_val1, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getServiceRequestCount") == 0 )
                {

                    
                    input_val2 = adb_getServiceRequestCount_create( env);
                        if( AXIS2_FAILURE == adb_getServiceRequestCount_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getServiceRequestCount_free(input_val2, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceRequestCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val2 =  axis2_skel_StatisticsAdmin_getServiceRequestCount(env, msg_ctx,input_val2);
                    
                        if ( NULL == ret_val2 )
                        {
                            adb_getServiceRequestCount_free(input_val2, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getServiceRequestCountResponse_serialize(ret_val2, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getServiceRequestCountResponse_free(ret_val2, env);
                                   adb_getServiceRequestCount_free(input_val2, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getSystemResponseCount") == 0 )
                {

                    
                        ret_val3 =  axis2_skel_StatisticsAdmin_getSystemResponseCount(env, msg_ctx);
                    
                        if ( NULL == ret_val3 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getSystemResponseCountResponse_serialize(ret_val3, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSystemResponseCountResponse_free(ret_val3, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getOperationResponseCount") == 0 )
                {

                    
                    input_val4 = adb_getOperationResponseCount_create( env);
                        if( AXIS2_FAILURE == adb_getOperationResponseCount_deserialize(input_val4, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getOperationResponseCount_free(input_val4, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationResponseCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val4 =  axis2_skel_StatisticsAdmin_getOperationResponseCount(env, msg_ctx,input_val4);
                    
                        if ( NULL == ret_val4 )
                        {
                            adb_getOperationResponseCount_free(input_val4, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getOperationResponseCountResponse_serialize(ret_val4, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getOperationResponseCountResponse_free(ret_val4, env);
                                   adb_getOperationResponseCount_free(input_val4, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getAvgOperationResponseTime") == 0 )
                {

                    
                    input_val5 = adb_getAvgOperationResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getAvgOperationResponseTime_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getAvgOperationResponseTime_free(input_val5, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAvgOperationResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val5 =  axis2_skel_StatisticsAdmin_getAvgOperationResponseTime(env, msg_ctx,input_val5);
                    
                        if ( NULL == ret_val5 )
                        {
                            adb_getAvgOperationResponseTime_free(input_val5, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getAvgOperationResponseTimeResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getAvgOperationResponseTimeResponse_free(ret_val5, env);
                                   adb_getAvgOperationResponseTime_free(input_val5, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getOperationStatistics") == 0 )
                {

                    
                    input_val6 = adb_getOperationStatistics_create( env);
                        if( AXIS2_FAILURE == adb_getOperationStatistics_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getOperationStatistics_free(input_val6, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationStatistics_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val6 =  axis2_skel_StatisticsAdmin_getOperationStatistics(env, msg_ctx,input_val6);
                    
                        if ( NULL == ret_val6 )
                        {
                            adb_getOperationStatistics_free(input_val6, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getOperationStatisticsResponse_serialize(ret_val6, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getOperationStatisticsResponse_free(ret_val6, env);
                                   adb_getOperationStatistics_free(input_val6, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getMinSystemResponseTime") == 0 )
                {

                    
                        ret_val7 =  axis2_skel_StatisticsAdmin_getMinSystemResponseTime(env, msg_ctx);
                    
                        if ( NULL == ret_val7 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getMinSystemResponseTimeResponse_serialize(ret_val7, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMinSystemResponseTimeResponse_free(ret_val7, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getSystemFaultCount") == 0 )
                {

                    
                        ret_val8 =  axis2_skel_StatisticsAdmin_getSystemFaultCount(env, msg_ctx);
                    
                        if ( NULL == ret_val8 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getSystemFaultCountResponse_serialize(ret_val8, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSystemFaultCountResponse_free(ret_val8, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getMaxSystemResponseTime") == 0 )
                {

                    
                        ret_val9 =  axis2_skel_StatisticsAdmin_getMaxSystemResponseTime(env, msg_ctx);
                    
                        if ( NULL == ret_val9 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getMaxSystemResponseTimeResponse_serialize(ret_val9, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMaxSystemResponseTimeResponse_free(ret_val9, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getServiceFaultCount") == 0 )
                {

                    
                    input_val10 = adb_getServiceFaultCount_create( env);
                        if( AXIS2_FAILURE == adb_getServiceFaultCount_deserialize(input_val10, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getServiceFaultCount_free(input_val10, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceFaultCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val10 =  axis2_skel_StatisticsAdmin_getServiceFaultCount(env, msg_ctx,input_val10);
                    
                        if ( NULL == ret_val10 )
                        {
                            adb_getServiceFaultCount_free(input_val10, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getServiceFaultCountResponse_serialize(ret_val10, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getServiceFaultCountResponse_free(ret_val10, env);
                                   adb_getServiceFaultCount_free(input_val10, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getMinServiceResponseTime") == 0 )
                {

                    
                    input_val11 = adb_getMinServiceResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getMinServiceResponseTime_deserialize(input_val11, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getMinServiceResponseTime_free(input_val11, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMinServiceResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val11 =  axis2_skel_StatisticsAdmin_getMinServiceResponseTime(env, msg_ctx,input_val11);
                    
                        if ( NULL == ret_val11 )
                        {
                            adb_getMinServiceResponseTime_free(input_val11, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getMinServiceResponseTimeResponse_serialize(ret_val11, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMinServiceResponseTimeResponse_free(ret_val11, env);
                                   adb_getMinServiceResponseTime_free(input_val11, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getMaxOperationResponseTime") == 0 )
                {

                    
                    input_val12 = adb_getMaxOperationResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getMaxOperationResponseTime_deserialize(input_val12, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getMaxOperationResponseTime_free(input_val12, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMaxOperationResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val12 =  axis2_skel_StatisticsAdmin_getMaxOperationResponseTime(env, msg_ctx,input_val12);
                    
                        if ( NULL == ret_val12 )
                        {
                            adb_getMaxOperationResponseTime_free(input_val12, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getMaxOperationResponseTimeResponse_serialize(ret_val12, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMaxOperationResponseTimeResponse_free(ret_val12, env);
                                   adb_getMaxOperationResponseTime_free(input_val12, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getServiceStatistics") == 0 )
                {

                    
                    input_val13 = adb_getServiceStatistics_create( env);
                        if( AXIS2_FAILURE == adb_getServiceStatistics_deserialize(input_val13, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getServiceStatistics_free(input_val13, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceStatistics_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val13 =  axis2_skel_StatisticsAdmin_getServiceStatistics(env, msg_ctx,input_val13);
                    
                        if ( NULL == ret_val13 )
                        {
                            adb_getServiceStatistics_free(input_val13, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getServiceStatisticsResponse_serialize(ret_val13, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getServiceStatisticsResponse_free(ret_val13, env);
                                   adb_getServiceStatistics_free(input_val13, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getOperationFaultCount") == 0 )
                {

                    
                    input_val14 = adb_getOperationFaultCount_create( env);
                        if( AXIS2_FAILURE == adb_getOperationFaultCount_deserialize(input_val14, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getOperationFaultCount_free(input_val14, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationFaultCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val14 =  axis2_skel_StatisticsAdmin_getOperationFaultCount(env, msg_ctx,input_val14);
                    
                        if ( NULL == ret_val14 )
                        {
                            adb_getOperationFaultCount_free(input_val14, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getOperationFaultCountResponse_serialize(ret_val14, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getOperationFaultCountResponse_free(ret_val14, env);
                                   adb_getOperationFaultCount_free(input_val14, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getAvgServiceResponseTime") == 0 )
                {

                    
                    input_val15 = adb_getAvgServiceResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getAvgServiceResponseTime_deserialize(input_val15, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getAvgServiceResponseTime_free(input_val15, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getAvgServiceResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val15 =  axis2_skel_StatisticsAdmin_getAvgServiceResponseTime(env, msg_ctx,input_val15);
                    
                        if ( NULL == ret_val15 )
                        {
                            adb_getAvgServiceResponseTime_free(input_val15, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getAvgServiceResponseTimeResponse_serialize(ret_val15, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getAvgServiceResponseTimeResponse_free(ret_val15, env);
                                   adb_getAvgServiceResponseTime_free(input_val15, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getServiceResponseCount") == 0 )
                {

                    
                    input_val16 = adb_getServiceResponseCount_create( env);
                        if( AXIS2_FAILURE == adb_getServiceResponseCount_deserialize(input_val16, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getServiceResponseCount_free(input_val16, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getServiceResponseCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val16 =  axis2_skel_StatisticsAdmin_getServiceResponseCount(env, msg_ctx,input_val16);
                    
                        if ( NULL == ret_val16 )
                        {
                            adb_getServiceResponseCount_free(input_val16, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getServiceResponseCountResponse_serialize(ret_val16, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getServiceResponseCountResponse_free(ret_val16, env);
                                   adb_getServiceResponseCount_free(input_val16, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getSystemRequestCount") == 0 )
                {

                    
                        ret_val17 =  axis2_skel_StatisticsAdmin_getSystemRequestCount(env, msg_ctx);
                    
                        if ( NULL == ret_val17 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getSystemRequestCountResponse_serialize(ret_val17, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSystemRequestCountResponse_free(ret_val17, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getMinOperationResponseTime") == 0 )
                {

                    
                    input_val18 = adb_getMinOperationResponseTime_create( env);
                        if( AXIS2_FAILURE == adb_getMinOperationResponseTime_deserialize(input_val18, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getMinOperationResponseTime_free(input_val18, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getMinOperationResponseTime_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val18 =  axis2_skel_StatisticsAdmin_getMinOperationResponseTime(env, msg_ctx,input_val18);
                    
                        if ( NULL == ret_val18 )
                        {
                            adb_getMinOperationResponseTime_free(input_val18, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getMinOperationResponseTimeResponse_serialize(ret_val18, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getMinOperationResponseTimeResponse_free(ret_val18, env);
                                   adb_getMinOperationResponseTime_free(input_val18, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getAvgSystemResponseTime") == 0 )
                {

                    
                        ret_val19 =  axis2_skel_StatisticsAdmin_getAvgSystemResponseTime(env, msg_ctx);
                    
                        if ( NULL == ret_val19 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getAvgSystemResponseTimeResponse_serialize(ret_val19, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getAvgSystemResponseTimeResponse_free(ret_val19, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getSystemStatistics") == 0 )
                {

                    
                        ret_val20 =  axis2_skel_StatisticsAdmin_getSystemStatistics(env, msg_ctx);
                    
                        if ( NULL == ret_val20 )
                        {
                            
                            return NULL; 
                        }
                        ret_node = adb_getSystemStatisticsResponse_serialize(ret_val20, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSystemStatisticsResponse_free(ret_val20, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getOperationRequestCount") == 0 )
                {

                    
                    input_val21 = adb_getOperationRequestCount_create( env);
                        if( AXIS2_FAILURE == adb_getOperationRequestCount_deserialize(input_val21, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getOperationRequestCount_free(input_val21, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getOperationRequestCount_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val21 =  axis2_skel_StatisticsAdmin_getOperationRequestCount(env, msg_ctx,input_val21);
                    
                        if ( NULL == ret_val21 )
                        {
                            adb_getOperationRequestCount_free(input_val21, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getOperationRequestCountResponse_serialize(ret_val21, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getOperationRequestCountResponse_free(ret_val21, env);
                                   adb_getOperationRequestCount_free(input_val21, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             
             }
            
          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_StatisticsAdmin service ERROR: invalid OM parameters in request\n");
          return NULL;
    }
Beispiel #20
0
axiom_node_t*
axis2_mtom_mtom(
    const axutil_env_t * env,
    axiom_node_t * node,
    axis2_msg_ctx_t *msg_ctx)
{
    axiom_node_t *file_name_node = NULL;
    axiom_node_t *file_text_node = NULL;
    axiom_node_t *ret_node = NULL;

    AXIS2_ENV_CHECK(env, NULL);

    /* Expected request format is :-
     * <ns1:mtomSample xmlns:ns1="http://ws.apache.org/axis2/c/samples">
     <ns1:fileName>test.jpg</ns1:fileName>
     <ns1:image>
     <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:[email protected]"></xop:Include>
     </ns1:image>
     </ns1:mtomSample>
     */
    if (!node)                  /* 'mtomSample' node */
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL,
                        AXIS2_FAILURE);
        printf("Echo client ERROR: input parameter NULL\n");
        return NULL;
    }

    file_name_node = axiom_node_get_first_child(node, env);
    if (!file_name_node)        /* 'text' node */
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Echo client ERROR: invalid XML in request\n");
        return NULL;
    }

    file_text_node = axiom_node_get_first_child(file_name_node, env);
    if (!file_text_node)        /* actual text to mtom */
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Echo client ERROR: invalid XML in request\n");
        return NULL;
    }

    if (axiom_node_get_node_type(file_text_node, env) == AXIOM_TEXT)
    {
        axiom_text_t *text =
            (axiom_text_t *) axiom_node_get_data_element(file_text_node, env);
        if (text && axiom_text_get_value(text, env))
        {
            axiom_node_t *image_node = NULL;
            axis2_char_t *text_str =
                (axis2_char_t *) axiom_text_get_value(text, env);
            printf("File Name  %s \n", text_str);

            image_node = axiom_node_get_next_sibling(file_name_node, env);
            if (image_node)
            {
                /* axiom_node_t *inc_node = NULL;
                   inc_node = axiom_node_get_first_child(image_node, env);
                   if (inc_node)
                   { */
                axiom_node_t *binary_node = NULL;
                binary_node = axiom_node_get_first_child(image_node, env);
                if (binary_node)
                {
                    axiom_data_handler_t *data_handler = NULL;
                    axiom_text_t *bin_text = (axiom_text_t *)
                        axiom_node_get_data_element(binary_node, env);
                    data_handler = axiom_text_get_data_handler(bin_text, env);
                    if (data_handler)
                    {
                        axiom_data_handler_t *data_handler_res = NULL;
                        axis2_byte_t *input_buff = NULL;
                        axis2_byte_t *buff = NULL;
                        int buff_len = 0;


                        axiom_data_handler_set_file_name(data_handler, env,
                                                         text_str);
                        axiom_data_handler_write_to(data_handler, env);
                        
                        input_buff = axiom_data_handler_get_input_stream(data_handler, env);
                        buff_len = axiom_data_handler_get_input_stream_len(data_handler, env);
                        
                        data_handler_res = axiom_data_handler_create(env, NULL, NULL);
                        
                        buff = AXIS2_MALLOC(env->allocator, sizeof(axis2_byte_t)*buff_len);
                        memcpy(buff, input_buff, buff_len);

                        axiom_data_handler_set_binary_data(data_handler_res, env, buff, buff_len);

                        axis2_msg_ctx_set_doing_mtom (msg_ctx, env, AXIS2_TRUE);
                        ret_node = build_response2(env, data_handler_res);
                    }
                    else        /* attachment has come by value, as non-optimized binary */
                    {
                        int plain_binary_len = 0;
                        int ret_len = 0;
                        axiom_text_t *bin_text = (axiom_text_t *)
                            axiom_node_get_data_element(binary_node, env);
                        axis2_byte_t *plain_binary = NULL;
                        axiom_data_handler_t *data_handler = NULL;

                        axis2_char_t *base64text =
                            (axis2_char_t *) axiom_text_get_value(bin_text,
                                                                  env);
                        printf("base64text = %s\n", base64text);
                        plain_binary_len = axutil_base64_decode_len(base64text);
                        plain_binary = AXIS2_MALLOC(env->
                                                    allocator,
                                                    sizeof(unsigned char) *
                                                    plain_binary_len);
                        ret_len =
                            axutil_base64_decode_binary((unsigned char *)
                                                        plain_binary,
                                                        base64text);
                        data_handler =
                            axiom_data_handler_create(env, text_str, NULL);
                        axiom_data_handler_set_binary_data(data_handler, env,
                                                           plain_binary,
                                                           ret_len);
                        axiom_data_handler_write_to(data_handler, env);
                        ret_node = build_response1(env, base64text);
                    }
                    /* } */
                }
            }

        }
    }
    else
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Echo client ERROR: invalid XML in request\n");
        return NULL;
    }

    return ret_node;
}
Beispiel #21
0
axis2_status_t AXIS2_CALL
sandesha2_out_handler_invoke(
    struct axis2_handler *handler, 
    const axutil_env_t *env,
    struct axis2_msg_ctx *msg_ctx)
{
    axutil_property_t *temp_prop = NULL;
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_conf_t *conf = NULL;
    axis2_char_t *str_done = NULL;
    axis2_char_t *dummy_msg_str = NULL;
    axis2_bool_t dummy_msg = AXIS2_FALSE;
    axis2_svc_t *svc = NULL;
    axutil_qname_t *module_qname = NULL;
    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
    sandesha2_msg_processor_t *msg_processor = NULL;
    int msg_type = -1;

    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Entry:sandesha2_out_handler_invoke");
            
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_SEQ_PROP_MAKE_CONNECTION_OUT_PATH);
    if (temp_prop)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
            "[sandesha2] In make connection out path. So return here.");
        return AXIS2_SUCCESS;
        temp_prop = NULL;
    }

    if(sandesha2_util_is_rstr_msg(env, msg_ctx))
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
            "[sandesha2] A RSTR message. Sandesha don't process.");
        return AXIS2_SUCCESS;
    }

    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    if(!conf_ctx)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[sandesha2] Configuration Context is NULL");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
    if(!svc)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Axis2 Service is NULL");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    module_qname = axutil_qname_create(env, SANDESHA2_MODULE, NULL, NULL);
    if(!axis2_svc_is_module_engaged(svc, env, module_qname))
    {
        if(module_qname)
        {
            axutil_qname_free(module_qname, env);
        }

        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]RM is not engaged. So return here");
        return AXIS2_SUCCESS;
    }

    if(module_qname)
    {
        axutil_qname_free(module_qname, env);
    }

    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);
    if(temp_prop)
    {
        str_done = (axis2_char_t *) axutil_property_get_value(temp_prop, env); 
    }

    if(str_done && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, str_done))
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
            "[sandesha2]Application Processing Done. So return here.");
        return AXIS2_SUCCESS; 
    }

    temp_prop = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
    axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, temp_prop);
    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
    if(!sandesha2_permanent_storage_mgr_create_db(env, conf_ctx))
    {
        return AXIS2_FAILURE;
    }

    /* Getting rm message */ 
    rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_DUMMY_MESSAGE);
    if(NULL != temp_prop)
    {
        dummy_msg_str = (axis2_char_t *) axutil_property_get_value(temp_prop, env); 
    }

    if(dummy_msg_str && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, dummy_msg_str))
    {
        dummy_msg = AXIS2_TRUE;
    }

    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_SVC_CLIENT_CLOSED);
    if(temp_prop)
    {
        axis2_char_t *spec_version = NULL;

        axis2_endpoint_ref_t *reply_to = axis2_msg_ctx_get_reply_to(msg_ctx, env);
        if(reply_to)
        {
            axis2_char_t *address = axis2_endpoint_ref_get_address(reply_to, env);
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_reply_to_address:%s", address);
        }
        spec_version = sandesha2_utils_get_rm_version(env, msg_ctx);

        if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, spec_version))
        {
            axis2_char_t *action = NULL;
            axutil_string_t *str_action = NULL;

            action = sandesha2_spec_specific_consts_get_terminate_seq_action(env, spec_version);
            str_action = axutil_string_create(env, action);
            axis2_msg_ctx_set_soap_action(msg_ctx, env, str_action);
            axutil_string_free(str_action, env);
            /*axis2_msg_ctx_set_reply_to(msg_ctx, env, NULL);*/
            msg_type = sandesha2_msg_ctx_set_msg_type(rm_msg_ctx, env, 
                SANDESHA2_MSG_TYPE_CLOSE_SEQ);
        }
        else if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_0, spec_version))
        {
            axutil_property_t *property = NULL;
            axutil_string_t *str_action = NULL;
            
            /*axis2_msg_info_headers_set_action(axis2_msg_ctx_get_msg_info_headers(msg_ctx, env), 
             * env, SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE); */
            str_action = axutil_string_create(env, SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
            axis2_msg_ctx_set_soap_action(msg_ctx, env, str_action);
            axutil_string_free(str_action, env);
            property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
            axis2_msg_ctx_set_property(msg_ctx, env, "Sandesha2LastMessage", property);
            /*axis2_msg_ctx_set_reply_to(msg_ctx, env, NULL);*/
        }
    }

    msg_type = sandesha2_msg_ctx_get_msg_type(rm_msg_ctx, env);
    if(msg_type == SANDESHA2_MSG_TYPE_UNKNOWN)
    {
        axis2_msg_ctx_t *req_msg_ctx = NULL;
        axis2_op_ctx_t *op_ctx = NULL;

        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        req_msg_ctx =  axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
        if(req_msg_ctx) /* For the server side */
        {
            sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
            sandesha2_seq_t *seq_part = NULL;

            req_rm_msg_ctx = sandesha2_msg_init_init_msg(env, req_msg_ctx);
            seq_part = sandesha2_msg_ctx_get_sequence(req_rm_msg_ctx, env);
            if(seq_part)
            {
                msg_processor = (sandesha2_msg_processor_t *) 
                sandesha2_app_msg_processor_create(env); /* rm intended msg */
            }
            if(req_rm_msg_ctx)
                sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
        }
        else if(!axis2_msg_ctx_get_server_side(msg_ctx, env))
        {
            msg_processor = (sandesha2_msg_processor_t *) sandesha2_app_msg_processor_create(env);
        }
    }
    else
    {
        msg_processor = sandesha2_msg_processor_create_msg_processor(env, rm_msg_ctx);
    }
    if(msg_processor)
    {
        sandesha2_msg_processor_process_out_msg(msg_processor, env, rm_msg_ctx);
        sandesha2_msg_processor_free(msg_processor, env);
    }
    if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
    {
        /* Message should not be sent in an exception situation */

        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Pausing message context");
        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
        if(rm_msg_ctx)
        {
            sandesha2_msg_ctx_free(rm_msg_ctx, env);
        }
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Error in processing the message");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_PROCESS_MSG, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);
    if(temp_prop)
    {
        axutil_property_set_value(temp_prop, env, AXIS2_VALUE_FALSE);
    }

    if(rm_msg_ctx)
    {
        sandesha2_msg_ctx_free(rm_msg_ctx, env);
    }

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:sandesha2_out_handler_invoke");

    return AXIS2_SUCCESS;
}
static axis2_status_t AXIS2_CALL
axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync(
    axis2_msg_recv_t * msg_recv,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx,
    axis2_msg_ctx_t * new_msg_ctx)
{
    axis2_svc_skeleton_t *svc_obj = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
    axis2_op_t *op_desc = NULL;
    const axis2_char_t *style = NULL;
    axiom_node_t *om_node = NULL;
    axiom_element_t *om_element = NULL;
    axis2_char_t *local_name = NULL;
    axiom_node_t *result_node = NULL;
    axiom_node_t *body_content_node = NULL;
    axiom_element_t *body_content_element = NULL;
    axiom_soap_envelope_t *default_envelope = NULL;
    axiom_soap_body_t *out_body = NULL;
    axiom_soap_header_t *out_header = NULL;
    axiom_soap_fault_t *soap_fault = NULL;
    axiom_node_t *out_node = NULL;
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_bool_t skel_invoked = AXIS2_FALSE;
    const axis2_char_t *soap_ns = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
    int soap_version = AXIOM_SOAP12;
    axiom_namespace_t *env_ns = NULL;
    axiom_node_t *fault_node = NULL;
    axiom_soap_fault_detail_t *fault_detail;
    axis2_bool_t is_fault = AXIS2_FALSE;

    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, new_msg_ctx, AXIS2_FAILURE);

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
        "[axis2]Entry:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");

    /* get the implementation class for the Web Service */
    svc_obj = axis2_msg_recv_make_new_svc_obj(msg_recv, env, msg_ctx);

    if(!svc_obj)
    {
        const axis2_char_t *svc_name = NULL;
        axis2_svc_t *svc = axis2_msg_ctx_get_svc(msg_ctx, env);

        if(svc)
        {
            svc_name = axis2_svc_get_name(svc, env);
        }
        else
        {
            svc_name = "unknown";
        }

        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Impl object for service '%s' not set in message receiver. %d :: %s", svc_name,
            env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));

        status = AXIS2_FAILURE;
    }
    else
    {
        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        op_desc = axis2_op_ctx_get_op(op_ctx, env);

        style = axis2_op_get_style(op_desc, env);
        if(0 == axutil_strcmp(AXIS2_STYLE_DOC, style))
        {
            axiom_soap_envelope_t *envelope = NULL;
            axiom_soap_body_t *body = NULL;

            envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
            body = axiom_soap_envelope_get_body(envelope, env);
            om_node = axiom_soap_body_get_base_node(body, env);
            om_element = axiom_node_get_data_element(om_node, env);
            om_node = axiom_node_get_first_element(om_node, env);
        }
        else if(0 == axutil_strcmp(AXIS2_STYLE_RPC, style))
        {
            axiom_soap_envelope_t *envelope = NULL;
            axiom_soap_body_t *body = NULL;
            axiom_node_t *op_node = NULL;
            axiom_element_t *op_element = NULL;

            envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
            body = axiom_soap_envelope_get_body(envelope, env);
            op_node = axiom_soap_body_get_base_node(body, env);
            op_element = axiom_node_get_data_element(op_node, env);
            if(op_element)
            {
                local_name = axiom_element_get_localname(op_element, env);
                if(local_name)
                {
                    axutil_array_list_t *function_arr = NULL;
                    int i = 0;
                    int size = 0;
                    axis2_bool_t matches = AXIS2_FALSE;

                    function_arr = svc_obj->func_array;
                    if(function_arr)
                    {
                        size = axutil_array_list_size(function_arr, env);
                    }

                    for(i = 0; i < size; i++)
                    {
                        axis2_char_t *function_name = NULL;

                        function_name = (axis2_char_t *)axutil_array_list_get(function_arr, env, i);
                        if(!axutil_strcmp(function_name, local_name))
                        {
                            matches = AXIS2_TRUE;

                        }
                    }

                    if(matches)
                    {
                        om_node = axiom_node_get_first_child(op_node, env);
                        om_element = axiom_node_get_data_element(om_node, env);
                    }
                    else
                    {
                        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_OM_ELEMENT_MISMATCH, AXIS2_FAILURE);
                        status = AXIS2_FAILURE;
                    }
                }
                else
                {
                    AXIS2_ERROR_SET(env->error, AXIS2_ERROR_OM_ELEMENT_INVALID_STATE, AXIS2_FAILURE);
                    status = AXIS2_FAILURE;
                }
            }
            else
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_RPC_NEED_MATCHING_CHILD, AXIS2_FAILURE);
                status = AXIS2_FAILURE;
            }
        }
        else
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_UNKNOWN_STYLE, AXIS2_FAILURE);
            status = AXIS2_FAILURE;
        }

        if(status == AXIS2_SUCCESS)
        {
            skel_invoked = AXIS2_TRUE;
            result_node = AXIS2_SVC_SKELETON_INVOKE(svc_obj, env, om_node, new_msg_ctx);
        }

        if(result_node)
        {
            if(0 == axutil_strcmp(style, AXIS2_STYLE_RPC))
            {
                axiom_namespace_t *ns = NULL;
                axis2_char_t *res_name = NULL;

                res_name = axutil_stracat(env, local_name, "Response");
                ns = axiom_namespace_create(env, "http://soapenc/", "res");
                if(!ns)
                {
                    status = AXIS2_FAILURE;
                }
                else
                {
                    body_content_element = axiom_element_create(env, NULL, res_name, ns,
                        &body_content_node);
                    axiom_node_add_child(body_content_node, env, result_node);
                }
            }
            else
            {
                body_content_node = result_node;
            }
        }
        else
        {
            axis2_char_t *mep = (axis2_char_t *)axis2_op_get_msg_exchange_pattern(op_desc, env);
            if(axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY) && axutil_strcmp(mep,
				AXIS2_MEP_URI_ROBUST_IN_ONLY) && axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY_WSDL2) &&						axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY_WSDL2))
            {
                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
                if(status == AXIS2_SUCCESS)
                {
                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
                }
                else
                {
                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
                        new_msg_ctx, env));
                }
                /* The new_msg_ctx is passed to the service. The status code must
                 * be taken from here and set to the old message context which is
                 * used by the worker when the request processing fails.
                 */
                if(svc_obj->ops->on_fault)
                {
                    fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
                }
                is_fault = AXIS2_TRUE;
            }
            else
            {
                /* If we have a in only message result node is NULL. We create fault only if
                 * an error is set
                 */
                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
                if(status == AXIS2_SUCCESS)
                {
                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
                }
                else
                {
                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
                        new_msg_ctx, env));
					if((!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY)) || 
						(!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY_WSDL2)))
                    {
                        /* The new_msg_ctx is passed to the service. The status code must
                         * be taken from here and set to the old message context which is
                         * used by the worker when the request processing fails.
                         */
                        if(svc_obj->ops->on_fault)
                        {
                            fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
                        }
                        is_fault = AXIS2_TRUE;
                    }
                }
            }
        }
    }

    if(msg_ctx && axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
    {
        soap_ns = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI; /* default is 1.2 */
        soap_version = AXIOM_SOAP11;
    }

    if(axis2_msg_ctx_get_soap_envelope(new_msg_ctx, env))
    {
        /* service implementation has set the envelope,
         useful when setting a SOAP fault.
         No need to further process */
        return AXIS2_SUCCESS;
    }

    /* create the soap envelope here */
    env_ns = axiom_namespace_create(env, soap_ns, "soapenv");
    if(!env_ns)
    {
        return AXIS2_FAILURE;
    }

    default_envelope = axiom_soap_envelope_create(env, env_ns);
	axiom_namespace_free(env_ns, env);

    if(!default_envelope)
    {
        return AXIS2_FAILURE;
    }

    out_header = axiom_soap_header_create_with_parent(env, default_envelope);
    if(!out_header)
    {
        return AXIS2_FAILURE;
    }

    out_body = axiom_soap_body_create_with_parent(env, default_envelope);
    if(!out_body)
    {
        return AXIS2_FAILURE;
    }

    out_node = axiom_soap_body_get_base_node(out_body, env);
    if(!out_node)
    {
        return AXIS2_FAILURE;
    }

    if(status != AXIS2_SUCCESS || is_fault)
    {
        /* something went wrong. set a SOAP Fault */
        const axis2_char_t *fault_value_str = "soapenv:Sender";
        const axis2_char_t *fault_reason_str = NULL;
        const axis2_char_t *err_msg = NULL;

        if(!skel_invoked)
        {
            if(axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
            {
fault_value_str            =
            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
            AXIOM_SOAP11_FAULT_CODE_RECEIVER;
        }
        else
        {
            fault_value_str =
            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
            AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
        }
    }

    err_msg = AXIS2_ERROR_GET_MESSAGE(env->error);
    if (err_msg && axutil_strcmp(err_msg, ""))
    {
        if(!axutil_strcmp(err_msg, "No Error"))
        {
            fault_reason_str = "An error has occurred, but could not determine exact details";
        }
        else
        {
            fault_reason_str = err_msg;
        }
    }
    else
    {
        fault_reason_str = "An error has occurred, but could not determine exact details";
    }

    soap_fault = axiom_soap_fault_create_default_fault(env, out_body, fault_value_str,
        fault_reason_str, soap_version);

    if (fault_node)
    {
        axiom_node_t *fault_detail_node = NULL;
        axis2_char_t *om_str = NULL;

        fault_detail = axiom_soap_fault_detail_create_with_parent(env, soap_fault);
        fault_detail_node = axiom_soap_fault_detail_get_base_node(fault_detail, env);

        om_str = axiom_node_to_string(fault_detail_node, env);
        if (om_str)
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "fault_detail:%s", om_str);
            AXIS2_FREE(env->allocator, om_str);
        }

        axiom_soap_fault_detail_add_detail_entry(fault_detail, env, fault_node);
    }
}

if (body_content_node)
{
    axiom_node_add_child(out_node, env, body_content_node);
    status = axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
}
else if (soap_fault)
{
    axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
    status = AXIS2_SUCCESS;
}
else
{
    /* we should free the memory as the envelope is not used, one way case */
    axiom_soap_envelope_free(default_envelope, env);
    default_envelope = NULL;
}

AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
    "[axis2]Exit:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");

return status;
}
         adb_getResponse_t* AXIS2_CALL 
         axis2_stub_op_IIp2Location_get( axis2_stub_t *stub, const axutil_env_t *env,
                                               adb_get_t* _get)
         {
            axis2_svc_client_t *svc_client = NULL;
            axis2_options_t *options = NULL;
            axiom_node_t *ret_node = NULL;

            const axis2_char_t *soap_action = NULL;
            axutil_qname_t *op_qname =  NULL;
            axiom_node_t *payload = NULL;
            axis2_bool_t is_soap_act_set = AXIS2_TRUE;
            axutil_string_t *soap_act = NULL;

            adb_getResponse_t* ret_val;
            
                                payload = adb_get_serialize(_get, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                           
            svc_client = axis2_stub_get_svc_client(stub, env );
            
           
            
            

            options = axis2_stub_get_options( stub, env);
            if (NULL == options)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub");
                return (adb_getResponse_t*)NULL;
            }
            soap_act = axis2_options_get_soap_action( options, env );
            if (NULL == soap_act)
            {
              is_soap_act_set = AXIS2_FALSE;
              soap_action = "urn:get";
              soap_act = axutil_string_create(env, "urn:get");
              axis2_options_set_soap_action(options, env, soap_act);    
            }

            
            axis2_options_set_soap_version(options, env, AXIOM_SOAP12);
             
            ret_node =  axis2_svc_client_send_receive_with_op_qname( svc_client, env, op_qname, payload);
 
            if (!is_soap_act_set)
            {
              
              axis2_options_set_soap_action(options, env, NULL);    
              
              axis2_options_set_action( options, env, NULL);
            }
            if(soap_act)
            {
              axutil_string_free(soap_act, env);
            }

            
                    if ( NULL == ret_node )
                    {
                        return (adb_getResponse_t*)NULL;
                    }
                    ret_val = adb_getResponse_create(env);

                    if(adb_getResponse_deserialize(ret_val, env, &ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE)
                    {
                        if(ret_val != NULL)
                        {
                            adb_getResponse_free(ret_val, env);
                        }

                        AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getResponse_deserialize: "
                                                                "This should be due to an invalid XML");
                        return (adb_getResponse_t*)NULL;
                    }

                   
                            return ret_val;
                       
        }
Beispiel #24
0
axis2_op_t *AXIS2_CALL
axis2_rest_disp_find_op(
    axis2_msg_ctx_t * msg_ctx,
    const axutil_env_t * env,
    axis2_svc_t * svc)
{
    axis2_endpoint_ref_t *endpoint_ref = NULL;
    axis2_op_t *op = NULL;
    axiom_soap_envelope_t *soap_env = NULL;
    axiom_soap_body_t *soap_body = NULL;
    axiom_element_t *body_child = NULL;
    axiom_node_t *body_child_node = NULL;
    axiom_node_t *body_element_node = NULL;
    axis2_bool_t soap_env_exists = AXIS2_TRUE;
    int i = 0;

    axutil_array_list_t *param_keys = NULL;
    axutil_array_list_t *param_values = NULL;

    AXIS2_PARAM_CHECK(env->error, svc, NULL);

    if(!axis2_msg_ctx_get_doing_rest(msg_ctx, env))
        return NULL;

    endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);

    if(endpoint_ref)
    {
        const axis2_char_t *address = NULL;

        address = axis2_endpoint_ref_get_address(endpoint_ref, env);
        if(address)
        {
            axis2_char_t **url_tokens = NULL;

            url_tokens = axutil_parse_request_url_for_svc_and_op(env, address);

            if(url_tokens)
            {
                if(url_tokens[0])
                {
                    axis2_char_t *location = NULL;

                    location = strstr(address, url_tokens[0]);
                    if(location)
                    {
                        const axis2_char_t *method = NULL;

                        location += strlen(url_tokens[0]);
                        param_keys = axutil_array_list_create(env, 10);
                        if(!param_keys)
                        {
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                "No memory. Cannot create the live rest parameter maps");
                            return NULL;
                        }
                        param_values = axutil_array_list_create(env, 10);

                        if(!param_values)
                        {
                            axutil_array_list_free(param_keys, env);
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                "No memory. Cannot create the live rest parameter maps");
                            return NULL;
                        }
                        method = axis2_msg_ctx_get_rest_http_method(msg_ctx, env);
                        op = axis2_core_utils_get_rest_op_with_method_and_location(svc, env,
                            method, location, param_keys, param_values);
                    }
                }
                if(url_tokens[0])
                    AXIS2_FREE(env->allocator, url_tokens[0]);
                if(url_tokens[1])
                    AXIS2_FREE(env->allocator, url_tokens[1]);
                AXIS2_FREE(env->allocator, url_tokens);
            }
        }
    }

    if(!op)
    {
        if(param_keys)
        {
            for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
            {
                void *value = axutil_array_list_get(param_keys, env, i);
                AXIS2_FREE(env->allocator, value);
            }
            axutil_array_list_free(param_keys, env);
        }
        if(param_values)
        {
            for(i = 0; i < axutil_array_list_size(param_values, env); i++)
            {
                void *value = axutil_array_list_get(param_values, env, i);
                AXIS2_FREE(env->allocator, value);
            }
            axutil_array_list_free(param_values, env);
        }
        return NULL;
    }

    soap_env = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);

    if(!soap_env)
    {
        soap_env_exists = AXIS2_FALSE;
        soap_env = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
    }
    if(soap_env)
    {
        soap_body = axiom_soap_envelope_get_body(soap_env, env);
    }
    if(!soap_body)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL, AXIS2_FAILURE);

        if(param_keys)
        {
            for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
            {
                void *value = axutil_array_list_get(param_keys, env, i);
                AXIS2_FREE(env->allocator, value);
            }
            axutil_array_list_free(param_keys, env);
        }
        if(param_values)
        {
            for(i = 0; i < axutil_array_list_size(param_values, env); i++)
            {
                void *value = axutil_array_list_get(param_values, env, i);
                AXIS2_FREE(env->allocator, value);
            }
            axutil_array_list_free(param_values, env);
        }
        return NULL;
    }

    body_element_node = axiom_soap_body_get_base_node(soap_body, env);

    if(body_element_node)
    {
        body_child_node = axiom_node_get_first_child(body_element_node, env);
    }

    if(!body_child_node)
    {
        body_child = axiom_element_create_with_qname(env, NULL, axis2_op_get_qname(op, env),
            &body_child_node);
        axiom_soap_body_add_child(soap_body, env, body_child_node);
    }

    if(param_keys && param_values)
    {
        for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
        {
            axis2_char_t *param_key = NULL;
            axis2_char_t *param_value = NULL;

            axiom_node_t *node = NULL;
            axiom_element_t *element = NULL;

            param_key = axutil_array_list_get(param_keys, env, i);
            param_value = axutil_array_list_get(param_values, env, i);

            element = axiom_element_create(env, NULL, param_key, NULL, &node);
            axiom_element_set_text(element, env, param_value, node);
            axiom_node_add_child(body_child_node, env, node);

            AXIS2_FREE(env->allocator, param_key);
            AXIS2_FREE(env->allocator, param_value);
        }

        axutil_array_list_free(param_keys, env);
        axutil_array_list_free(param_values, env);
    }

    if(!soap_env_exists)
    {
        axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_env);
    }

    return op;
}
Beispiel #25
0
axiom_node_t *
axis2_sub_sub(
    const axutil_env_t * env,
    axiom_node_t * node)
{
    axiom_node_t *param1_node = NULL;
    axiom_node_t *param1_text_node = NULL;
    axis2_char_t *param1_str = NULL;
    long int param1 = 0;
    axiom_node_t *param2_node = NULL;
    axiom_node_t *param2_text_node = NULL;
    axis2_char_t *param2_str = NULL;
    long int param2 = 0;

    if (!node)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL,
                        AXIS2_FAILURE);
        printf("Math client request ERROR: input parameter NULL\n");
        return NULL;
    }

    param1_node = axiom_node_get_first_child(node, env);
    if (!param1_node)
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service  ERROR: invalid XML in request\n");
        return NULL;
    }

    param1_text_node = axiom_node_get_first_child(param1_node, env);
    if (!param1_text_node)
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service ERROR: invalid XML in request\n");
        return NULL;
    }

    if (axiom_node_get_node_type(param1_text_node, env) == AXIOM_TEXT)
    {
        axiom_text_t *text =
            (axiom_text_t *) axiom_node_get_data_element(param1_text_node, env);
        if (text && axiom_text_get_value(text, env))
        {
            param1_str = (axis2_char_t *) axiom_text_get_value(text, env);
        }
    }
    else
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service ERROR: invalid XML in request\n");
        return NULL;
    }

    param2_node = axiom_node_get_next_sibling(param1_node, env);
    if (!param2_node)
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service  ERROR: invalid XML in request\n");
        return NULL;
    }

    param2_text_node = axiom_node_get_first_child(param2_node, env);
    if (!param2_text_node)
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service ERROR: invalid XML in request\n");
        return NULL;
    }

    if (axiom_node_get_node_type(param2_text_node, env) == AXIOM_TEXT)
    {
        axiom_text_t *text =
            (axiom_text_t *) axiom_node_get_data_element(param2_text_node, env);
        if (text && axiom_text_get_value(text, env))
        {
            param2_str = (axis2_char_t *) axiom_text_get_value(text, env);
        }
    }
    else
    {
        AXIS2_ERROR_SET(env->error,
                        AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
                        AXIS2_FAILURE);
        printf("Math service ERROR: invalid XML in request\n");
        return NULL;
    }

    if (param1_str && param2_str)
    {
        long int result = 0;
        axis2_char_t result_str[255];

        axiom_element_t *ele1 = NULL;
        axiom_node_t *node1 = NULL,
            *node2 = NULL;
        axiom_namespace_t *ns1 = NULL;
        axiom_text_t *text1 = NULL;

        param1 = strtol(param1_str, NULL, 10);
        param2 = strtol(param2_str, NULL, 10);
        result = param1 - param2;
        sprintf(result_str, "%ld", result);

        ns1 = axiom_namespace_create(env,
                                     "http://axis2/test/namespace1", "ns1");
        ele1 = axiom_element_create(env, NULL, "result", ns1, &node1);
        text1 = axiom_text_create(env, node1, result_str, &node2);

        return node1;
    }

    AXIS2_ERROR_SET(env->error,
                    AXIS2_ERROR_SVC_SKEL_INVALID_OPERATION_PARAMETERS_IN_SOAP_REQUEST,
                    AXIS2_FAILURE);
    printf("Math service ERROR: invalid parameters\n");
    return NULL;
}
AXIS2_EXTERN axiom_xml_writer_t *AXIS2_CALL
axiom_xml_writer_create_for_memory(
    const axutil_env_t * env,
    axis2_char_t * encoding,
    int is_prefix_default,
    int compression,
    int type)
{
    axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL;
    AXIS2_ENV_CHECK(env, NULL);
    writer_impl = (axis2_libxml2_writer_wrapper_impl_t *)AXIS2_MALLOC(env->allocator,
        sizeof(axis2_libxml2_writer_wrapper_impl_t));
    if(!writer_impl)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create writer wrapper");
        return NULL;
    }

    writer_impl->encoding = NULL;
    writer_impl->buffer = NULL;
    writer_impl->doc = NULL;
    writer_impl->in_empty_element = AXIS2_FALSE;
    writer_impl->in_start_element = AXIS2_FALSE;
    writer_impl->stack = NULL;
    writer_impl->uri_prefix_map = NULL;
    writer_impl->default_lang_namespace = NULL;
    writer_impl->compression = compression;

    if(AXIS2_XML_PARSER_TYPE_BUFFER == type)
    {
        writer_impl->writer_type = AXIS2_XML_PARSER_TYPE_BUFFER;
        writer_impl->buffer = xmlBufferCreate();
        if(!(writer_impl->buffer))
        {
            axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env);
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "No memory. Cannot create a buffer for writer wrapper");
            return NULL;
        }

        writer_impl->xml_writer = xmlNewTextWriterMemory(writer_impl->buffer, 0);
    }
    else if(AXIS2_XML_PARSER_TYPE_DOC == type)
    {
        writer_impl->writer_type = AXIS2_XML_PARSER_TYPE_DOC;
        writer_impl->xml_writer = xmlNewTextWriterDoc(&writer_impl->doc, 0);
    }
    else
    {
        axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env);
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_XML_PARSER_INVALID_MEM_TYPE, AXIS2_FAILURE);
        return NULL;
    }

    if(!(writer_impl->xml_writer))
    {
        axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env);
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_CREATING_XML_STREAM_WRITER, AXIS2_FAILURE);
        return NULL;
    }

    if(encoding)
    {
        writer_impl->encoding = axutil_strdup(env, encoding);
    }
    else
    {
        writer_impl->encoding = axutil_strdup(env, ENCODING);
    }

    writer_impl->uri_prefix_map = axutil_hash_make(env);
    if(!(writer_impl->uri_prefix_map))
    {
        axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env);
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create URI prefix hash map");
        return NULL;
    }
    writer_impl->stack = axutil_stack_create(env);
    if(!(writer_impl->stack))
    {
        axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env);
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "No memory. Cannot create the stack for writer wrapper");
        return NULL;
    }

    writer_impl->writer.ops = &axiom_xml_writer_ops_var;

    return &(writer_impl->writer);
}
	/*
	 * This method invokes the right service method
	 */
	axiom_node_t* AXIS2_CALL
	axis2_svc_skel_SecurityAdminService_invoke(axis2_svc_skeleton_t *svc_skeleton,
				const axutil_env_t *env,
				axiom_node_t *content_node,
				axis2_msg_ctx_t *msg_ctx)
	{
         /* depending on the function name invoke the
          * corresponding  method
          */

          axis2_op_ctx_t *operation_ctx = NULL;
          axis2_op_t *operation = NULL;
          axutil_qname_t *op_qname = NULL;
          axis2_char_t *op_name = NULL;
          axis2_msg_ctx_t *in_msg_ctx = NULL;
          
          axiom_soap_envelope_t *req_soap_env = NULL;
          axiom_soap_header_t *req_soap_header = NULL;
          axiom_soap_envelope_t *res_soap_env = NULL;
          axiom_soap_header_t *res_soap_header = NULL;

          axiom_node_t *ret_node = NULL;
          axiom_node_t *input_header = NULL;
          axiom_node_t *output_header = NULL;
          axiom_node_t *header_base_node = NULL;
	    
          axis2_svc_skel_SecurityAdminService_t *svc_skeleton_wrapper = NULL;

          
            adb_getScenariosResponse_t* ret_val1;
            adb_getScenarios_t* input_val1;
            
            axis2_status_t ret_val2;
            adb_applySecurity_t* input_val2;
            
            axis2_status_t ret_val3;
            adb_activateUsernameTokenAuthentication_t* input_val3;
            
            axis2_status_t ret_val4;
            adb_disableSecurityOnService_t* input_val4;
            
            adb_getSecurityConfigDataResponse_t* ret_val5;
            adb_getSecurityConfigData_t* input_val5;
            
            adb_getSecurityScenarioResponse_t* ret_val6;
            adb_getSecurityScenario_t* input_val6;
            

          svc_skeleton_wrapper = (axis2_svc_skel_SecurityAdminService_t*)svc_skeleton;
          operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
          operation = axis2_op_ctx_get_op(operation_ctx, env);
          op_qname = (axutil_qname_t *)axis2_op_get_qname(operation, env);
          op_name = axutil_qname_get_localpart(op_qname, env);

          if (op_name)
          {
               

                if ( axutil_strcmp(op_name, "getScenarios") == 0 )
                {

                    
                    input_val1 = adb_getScenarios_create( env);
                        if( AXIS2_FAILURE == adb_getScenarios_deserialize(input_val1, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getScenarios_free(input_val1, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getScenarios_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val1 =  axis2_skel_SecurityAdminService_getScenarios(env, msg_ctx,input_val1,
                                                (axis2_skel_SecurityAdminService_getScenarios_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if ( NULL == ret_val1 )
                        {
                            adb_getScenarios_free(input_val1, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getScenariosResponse_serialize(ret_val1, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getScenariosResponse_free(ret_val1, env);
                                   adb_getScenarios_free(input_val1, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "applySecurity") == 0 )
                {

                    
                    input_val2 = adb_applySecurity_create( env);
                        if( AXIS2_FAILURE == adb_applySecurity_deserialize(input_val2, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_applySecurity_free(input_val2, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_applySecurity_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val2 =  axis2_skel_SecurityAdminService_applySecurity(env, msg_ctx,input_val2,
                                                (axis2_skel_SecurityAdminService_applySecurity_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val2 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from applySecurity ");
                        }
                        adb_applySecurity_free(input_val2, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "activateUsernameTokenAuthentication") == 0 )
                {

                    
                    input_val3 = adb_activateUsernameTokenAuthentication_create( env);
                        if( AXIS2_FAILURE == adb_activateUsernameTokenAuthentication_deserialize(input_val3, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_activateUsernameTokenAuthentication_free(input_val3, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_activateUsernameTokenAuthentication_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val3 =  axis2_skel_SecurityAdminService_activateUsernameTokenAuthentication(env, msg_ctx,input_val3,
                                                (axis2_skel_SecurityAdminService_activateUsernameTokenAuthentication_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val3 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from activateUsernameTokenAuthentication ");
                        }
                        adb_activateUsernameTokenAuthentication_free(input_val3, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "disableSecurityOnService") == 0 )
                {

                    
                    input_val4 = adb_disableSecurityOnService_create( env);
                        if( AXIS2_FAILURE == adb_disableSecurityOnService_deserialize(input_val4, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_disableSecurityOnService_free(input_val4, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_disableSecurityOnService_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val4 =  axis2_skel_SecurityAdminService_disableSecurityOnService(env, msg_ctx,input_val4,
                                                (axis2_skel_SecurityAdminService_disableSecurityOnService_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if( AXIS2_FAILURE == ret_val4 )
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from disableSecurityOnService ");
                        }
                        adb_disableSecurityOnService_free(input_val4, env);
                        

                    /* since this has no output params it just returns NULL */                    
                    return NULL;

                }
             

                if ( axutil_strcmp(op_name, "getSecurityConfigData") == 0 )
                {

                    
                    input_val5 = adb_getSecurityConfigData_create( env);
                        if( AXIS2_FAILURE == adb_getSecurityConfigData_deserialize(input_val5, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getSecurityConfigData_free(input_val5, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getSecurityConfigData_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val5 =  axis2_skel_SecurityAdminService_getSecurityConfigData(env, msg_ctx,input_val5,
                                                (axis2_skel_SecurityAdminService_getSecurityConfigData_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if ( NULL == ret_val5 )
                        {
                            adb_getSecurityConfigData_free(input_val5, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getSecurityConfigDataResponse_serialize(ret_val5, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSecurityConfigDataResponse_free(ret_val5, env);
                                   adb_getSecurityConfigData_free(input_val5, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             

                if ( axutil_strcmp(op_name, "getSecurityScenario") == 0 )
                {

                    
                    input_val6 = adb_getSecurityScenario_create( env);
                        if( AXIS2_FAILURE == adb_getSecurityScenario_deserialize(input_val6, env, &content_node, NULL, AXIS2_FALSE))
                        {
                            adb_getSecurityScenario_free(input_val6, env);
                      
                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the adb_getSecurityScenario_deserialize: "
                                        "This should be due to an invalid XML");
                            return NULL;      
                        }
                        
                        ret_val6 =  axis2_skel_SecurityAdminService_getSecurityScenario(env, msg_ctx,input_val6,
                                                (axis2_skel_SecurityAdminService_getSecurityScenario_fault*)&(svc_skeleton_wrapper->fault));
                    
                        if ( NULL == ret_val6 )
                        {
                            adb_getSecurityScenario_free(input_val6, env);
                            
                            return NULL; 
                        }
                        ret_node = adb_getSecurityScenarioResponse_serialize(ret_val6, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                                   adb_getSecurityScenarioResponse_free(ret_val6, env);
                                   adb_getSecurityScenario_free(input_val6, env);
                                   

                        return ret_node;
                    

                    /* since this has no output params it just returns NULL */                    
                    

                }
             
             }
            
          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2_svc_skel_SecurityAdminService service ERROR: invalid OM parameters in request\n");
          return NULL;
    }
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_soap11_builder_helper_handle_event(
    axiom_soap11_builder_helper_t * builder_helper,
    const axutil_env_t * env,
    axiom_node_t * om_element_node,
    int element_level)
{
    axiom_element_t *om_ele = NULL;
    axis2_char_t *ele_localname = NULL;
    axiom_soap_envelope_t *soap_envelope = NULL;
    axiom_soap_body_t *soap_body = NULL;
    axiom_soap_fault_t *soap_fault = NULL;

    AXIS2_PARAM_CHECK(env->error, om_element_node, AXIS2_FAILURE);

    om_ele = (axiom_element_t *)axiom_node_get_data_element(om_element_node, env);

    ele_localname = axiom_element_get_localname(om_ele, env);
    if(!ele_localname)
    {
        return AXIS2_FAILURE;
    }

    soap_envelope = axiom_soap_builder_get_soap_envelope(builder_helper->soap_builder, env);

    if(!soap_envelope)
    {
        return AXIS2_FAILURE;
    }

    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
    if(!soap_body)
    {
        return AXIS2_FAILURE;
    }

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

    if(element_level == 4)
    {
        axiom_soap_fault_code_t *fault_code = NULL;
        axiom_soap_fault_value_t *fault_value = NULL;
        axiom_node_t *fault_value_node = NULL;
        axiom_element_t *fault_value_ele = NULL;

        if(axutil_strcmp(ele_localname, AXIOM_SOAP11_SOAP_FAULT_CODE_LOCAL_NAME) == 0)
        {
            axis2_status_t status = AXIS2_SUCCESS;

            if(builder_helper->fault_string_present)
            {
                axiom_soap_builder_set_bool_processing_mandatory_fault_elements(
                    builder_helper->soap_builder, env, AXIS2_FALSE);
            }

            fault_code = axiom_soap_fault_code_create(env);
            if(!fault_code)
            {
                return AXIS2_FAILURE;
            }
            axiom_soap_fault_code_set_base_node(fault_code, env, om_element_node);

            axiom_soap_fault_set_code(soap_fault, env, fault_code);

            axiom_soap_fault_code_set_builder(fault_code, env, builder_helper->soap_builder);

            axiom_element_set_localname(om_ele, env, AXIOM_SOAP12_SOAP_FAULT_CODE_LOCAL_NAME);

            fault_value = axiom_soap_fault_value_create_with_code(env, fault_code);
            if(!fault_value)
            {
                return AXIS2_FAILURE;
            }
            fault_value_node = axiom_soap_fault_value_get_base_node(fault_value, env);
            if(!fault_value_node)
            {
                return AXIS2_FAILURE;
            }
            fault_value_ele = (axiom_element_t *)axiom_node_get_data_element(fault_value_node, env);

            axiom_stax_builder_set_lastnode(builder_helper->om_builder, env, fault_value_node);

            status = axiom_soap11_builder_helper_process_text(builder_helper, env);
            if(status == AXIS2_FAILURE)
            {
                return AXIS2_FAILURE;
            }
            axiom_stax_builder_set_lastnode(builder_helper->om_builder, env, om_element_node);
            axiom_node_set_complete(om_element_node, env, AXIS2_TRUE);

            axiom_stax_builder_set_element_level(builder_helper->om_builder, env, (element_level
                - 1));
            builder_helper->fault_code_present = AXIS2_TRUE;
        }
        else if(axutil_strcmp(AXIOM_SOAP11_SOAP_FAULT_STRING_LOCAL_NAME, ele_localname) == 0)
        {

            axiom_soap_fault_reason_t *fault_reason = NULL;
            axiom_soap_fault_text_t *fault_text = NULL;
            axiom_node_t *fault_text_node = NULL;
            int status = AXIS2_SUCCESS;
            if(builder_helper->fault_code_present)
            {
                axiom_soap_builder_set_bool_processing_mandatory_fault_elements(
                    builder_helper->soap_builder, env, AXIS2_FALSE);
            }

            axiom_element_set_localname(om_ele, env, AXIOM_SOAP12_SOAP_FAULT_REASON_LOCAL_NAME);

            fault_reason = axiom_soap_fault_reason_create(env);
            if(!fault_reason)
            {
                return AXIS2_FAILURE;
            }
            axiom_soap_fault_reason_set_base_node(fault_reason, env, om_element_node);

            axiom_soap_fault_set_reason(soap_fault, env, fault_reason);

            fault_text = axiom_soap_fault_text_create_with_parent(env, fault_reason);
            if(!fault_text)
            {
                return AXIS2_FAILURE;
            }
            fault_text_node = axiom_soap_fault_text_get_base_node(fault_text, env);
            if(!fault_text_node)
            {
                return AXIS2_FAILURE;
            }
            axiom_stax_builder_set_lastnode(builder_helper->om_builder, env, fault_text_node);

            status = axiom_soap11_builder_helper_process_text(builder_helper, env);
            if(status == AXIS2_FAILURE)
            {
                return AXIS2_FAILURE;
            }
            axiom_stax_builder_set_lastnode(builder_helper->om_builder, env, om_element_node);

            axiom_node_set_complete(om_element_node, env, AXIS2_TRUE);

            axiom_stax_builder_set_element_level(builder_helper->om_builder, env, (element_level
                - 1));

            builder_helper->fault_string_present = AXIS2_TRUE;

        }
        else if(axutil_strcmp(AXIOM_SOAP11_SOAP_FAULT_ACTOR_LOCAL_NAME, ele_localname) == 0)
        {
            axiom_soap_fault_role_t *fault_role = NULL;
            fault_role = axiom_soap_fault_role_create(env);
            if(!fault_role)
            {
                return AXIS2_FAILURE;
            }
            axiom_element_set_localname(om_ele, env, AXIOM_SOAP12_SOAP_FAULT_ROLE_LOCAL_NAME);

            axiom_soap_fault_role_set_base_node(fault_role, env, om_element_node);

            axiom_soap_fault_set_role(soap_fault, env, fault_role);
            /*
             Role element may not have a namespace associated, hence commented, else it segfaults here - Samisa
             status = axiom_soap_builder_process_namespace_data(
             builder_helper->soap_builder, env, om_element_node, AXIS2_TRUE);
             if(status == AXIS2_FAILURE)
             return AXIS2_FAILURE; */
        }
        else if(axutil_strcmp(AXIOM_SOAP11_SOAP_FAULT_DETAIL_LOCAL_NAME, ele_localname) == 0)
        {
            axiom_soap_fault_detail_t *fault_detail = NULL;
            fault_detail = axiom_soap_fault_detail_create(env);
            if(!fault_detail)
            {
                return AXIS2_FAILURE;
            }
            axiom_element_set_localname(om_ele, env, AXIOM_SOAP12_SOAP_FAULT_DETAIL_LOCAL_NAME);

            axiom_soap_fault_detail_set_base_node(fault_detail, env, om_element_node);

            axiom_soap_fault_set_detail(soap_fault, env, fault_detail);
        }
        else
        {
            return AXIS2_SUCCESS;
        }
    }
    else if(element_level == 5)
    {
        axiom_node_t *parent_node = NULL;
        axiom_element_t *parent_element = NULL;
        axis2_char_t *parent_localname = NULL;

        parent_node = axiom_node_get_parent(om_element_node, env);
        if(!parent_node)
        {
            return AXIS2_FAILURE;
        }
        parent_element = (axiom_element_t *)axiom_node_get_data_element(om_element_node, env);
        parent_localname = axiom_element_get_localname(parent_element, env);

        if(!parent_localname)
        {
            return AXIS2_FAILURE;
        }
        if(axutil_strcmp(parent_localname, AXIOM_SOAP12_SOAP_FAULT_ROLE_LOCAL_NAME) == 0)
        {
            AXIS2_ERROR_SET(env->error,
                AXIS2_ERROR_SOAP11_FAULT_ACTOR_SHOULD_NOT_HAVE_CHILD_ELEMENTS, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "SOAP 1.1 Actor should not have child elements");
            return AXIS2_FAILURE;
        }
    }
    return AXIS2_SUCCESS;
}
Beispiel #29
0
AXIS2_EXTERN axutil_url_t *AXIS2_CALL
axutil_url_create(
    const axutil_env_t *env,
    const axis2_char_t *protocol,
    const axis2_char_t *host,
    const int port,
    const axis2_char_t *path)
{
    axutil_url_t *url = NULL;
    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, protocol, NULL);

    if(!protocol || !*protocol || strstr(protocol, "://") || (host && strchr(host, '/')))
    {
        return NULL;
    }

    url = (axutil_url_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_url_t));

    if(!url)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
        return NULL;
    }
    url->protocol = axutil_strdup(env, protocol);
    url->host = NULL;
    url->path = NULL;
    url->server = NULL;
    url->query = NULL;

    if(host)
    {
        url->host = (axis2_char_t *)axutil_strdup(env, host);
        url->port = port;
    }
    else
    {
        url->port = 0;
    }

    /** if the path is not starting with / we have to make it so
     */
    if(path)
    {
        axis2_char_t *params = NULL;
        axis2_char_t *temp = NULL;
        if(path[0] == '/')
        {
            temp = (axis2_char_t *)axutil_strdup(env, path);
        }
        else
        {
            temp = axutil_stracat(env, "/", path);
        }
        params = strchr(temp, '?');
        if(!params)
        {
            params = strchr(temp, '#');
        }
        if(params)
        {
            url->query = (axis2_char_t *)axutil_strdup(env, params);
            *params = '\0';
        }
        url->path = (axis2_char_t *)axutil_strdup(env, temp);
        AXIS2_FREE(env->allocator, temp);
    }

    return url;
}
Beispiel #30
0
AXIS2_EXPORT axis2_svc_skeleton_t *AXIS2_CALL
axis2_msg_recv_make_new_svc_obj(
    axis2_msg_recv_t * msg_recv,
    const axutil_env_t * env,
    struct axis2_msg_ctx * msg_ctx)
{
    struct axis2_svc *svc = NULL;
    struct axis2_op_ctx *op_ctx = NULL;
    struct axis2_svc_ctx *svc_ctx = NULL;
    axutil_param_t *impl_info_param = NULL;
    void *impl_class = NULL;

    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, msg_ctx, NULL);

    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
    svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
    svc = axis2_svc_ctx_get_svc(svc_ctx, env);
    if(!svc)
    {
        return NULL;
    }

    impl_class = axis2_svc_get_impl_class(svc, env);
    if(impl_class)
    {
        return impl_class;
    }
    else
    {
        /* When we load the DLL we have to make sure that only one thread will load it */
        axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
        /* If more than one thread tries to acquires the lock, first thread loads the DLL.
         Others should not load the DLL */
        impl_class = axis2_svc_get_impl_class(svc, env);
        if(impl_class)
        {
            axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
            return impl_class;
        }
        impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
        if(!impl_info_param)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
            axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
            return NULL;
        }

        axutil_allocator_switch_to_global_pool(env->allocator);

        axutil_class_loader_init(env);

        impl_class = axutil_class_loader_create_dll(env, impl_info_param);

        if(impl_class)
        {
            AXIS2_SVC_SKELETON_INIT((axis2_svc_skeleton_t *)impl_class, env);
        }

        axis2_svc_set_impl_class(svc, env, impl_class);

        axutil_allocator_switch_to_local_pool(env->allocator);
        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
        return impl_class;
	(void)msg_recv;
    }
}