axiom_node_t *
build_om_programatically(
    const axutil_env_t * env)
{
    axiom_node_t *version_om_node = NULL;
    axiom_element_t *version_om_ele = NULL;
    axiom_namespace_t *ns1 = NULL;

    axiom_xml_writer_t *xml_writer = NULL;
    axiom_output_t *om_output = NULL;
    axis2_char_t *buffer = NULL;

    ns1 =
        axiom_namespace_create(env, "urn:aewebservices71",
                               "ns1");

    version_om_ele =
        axiom_element_create(env, NULL, "GetVersion", ns1, &version_om_node);


    xml_writer =
        axiom_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE, AXIS2_FALSE,
                                           AXIS2_XML_PARSER_TYPE_BUFFER);
    om_output = axiom_output_create(env, xml_writer);

    axiom_node_serialize(version_om_node, env, om_output);
    buffer = (axis2_char_t *) axiom_xml_writer_get_xml(xml_writer, env);
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "\nSending OM node in XML : %s \n",
                    buffer);
    if (om_output)
    {
        axiom_output_free(om_output, env);
        om_output = NULL;
    }

    axiom_namespace_free(ns1, env);
    return version_om_node;
}
/* build SOAP request message content using OM */
axiom_node_t *
build_om_programatically(
    const axutil_env_t * env)
{
    axiom_node_t *notify_om_node = NULL;
    axiom_element_t *notify_om_ele = NULL;
    axiom_namespace_t *ns1 = NULL;
    axis2_char_t *buffer = NULL;

    ns1 = axiom_namespace_create(env, "http://example.org/notify", "m");
    notify_om_ele =
        axiom_element_create(env, NULL, "notify", ns1, &notify_om_node);
    axiom_element_set_text(notify_om_ele, env, "notify5", notify_om_node);

    buffer = axiom_node_to_string(notify_om_node, env);
    if (buffer)
    {
        printf("\nSending OM node in XML : %s \n", buffer);
        AXIS2_FREE(env->allocator, buffer);
    }

    return notify_om_node;
}
Beispiel #3
0
axiom_node_t* AXIS2_CALL 
sandesha2_address_to_om_node(
    sandesha2_address_t *address,
   	const axutil_env_t *env, 
    void *om_node)
{
    axiom_namespace_t *rm_ns = NULL;
    axiom_element_t *addr_element = NULL;
    axiom_node_t *addr_node = NULL;
    
    AXIS2_PARAM_CHECK(env->error, om_node, NULL);
    if(!address->epr || !axis2_endpoint_ref_get_address(
            address->epr, env) || 0 == axutil_strlen(
            axis2_endpoint_ref_get_address(address->epr, env)))
    {
        AXIS2_ERROR_SET(env->error, (axutil_error_codes_t)SANDESHA2_ERROR_TO_OM_NULL_ELEMENT, 
            AXIS2_FAILURE);
        return NULL;
    }
    rm_ns = axiom_namespace_create(env, address->ns_val,
        AXIS2_WSA_DEFAULT_PREFIX);
    if(!rm_ns)
    {
        return NULL;
    }
    addr_element = axiom_element_create(env, NULL, 
            SANDESHA2_WSA_ADDRESS, rm_ns, &addr_node);
    if(!addr_element)
    {
        return NULL;
    }
    axiom_element_set_text(addr_element, env, 
            axis2_endpoint_ref_get_address(address->epr, env), 
            addr_node);
    axiom_node_add_child((axiom_node_t*)om_node, env, addr_node);
    return (axiom_node_t*)om_node;
}
Beispiel #4
0
/**
 * Creates <wsse:Reference> element
 */
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
oxs_token_build_reference_element(
    const axutil_env_t *env,
    axiom_node_t *parent,
    axis2_char_t *ref,
    axis2_char_t *value_type)
{
    axiom_node_t *reference_node = NULL;
    axiom_element_t *reference_ele = NULL;
    axiom_attribute_t *ref_attr = NULL;
    axiom_attribute_t *value_type_attr = NULL;
    axiom_namespace_t *ns_obj = NULL;

    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS, OXS_WSSE);
    reference_ele = axiom_element_create(env, parent, OXS_NODE_REFERENCE, ns_obj, &reference_node);
    if (!reference_ele)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating Reference element.");
        axiom_namespace_free(ns_obj, env);
        return NULL;
    }

    if(!ref)
    {
        ref = "";
    }

    ref_attr =  axiom_attribute_create(env, OXS_ATTR_URI , ref, NULL);
    axiom_element_add_attribute(reference_ele, env, ref_attr, reference_node);

    if(value_type)
    {
        value_type_attr =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE , value_type, NULL);
        axiom_element_add_attribute(reference_ele, env, value_type_attr, reference_node);
    }
    return reference_node;
}
Beispiel #5
0
/**
 * Creates <wsc:Nonce> element
 */
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
oxs_token_build_nonce_element(
    const axutil_env_t *env,
    axiom_node_t *parent,
    axis2_char_t* nonce_val,
    axis2_char_t *wsc_ns_uri)
{
    axiom_node_t *nonce_node = NULL;
    axiom_element_t *nonce_ele = NULL;
    axis2_status_t ret;
    axiom_namespace_t *ns_obj = NULL;

    if(!wsc_ns_uri)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[rampart]Error creating %s Token element. SecConv namespace uri is not valid.", 
            OXS_NODE_NONCE);
        return NULL;
    }

    ns_obj = axiom_namespace_create(env, wsc_ns_uri, OXS_WSC);
    nonce_ele = axiom_element_create(env, parent, OXS_NODE_NONCE, ns_obj, &nonce_node);
    if (!nonce_ele)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[rampart]Error creating %s Token element.", OXS_NODE_NONCE);
        axiom_namespace_free(ns_obj, env);
        return NULL;
    }

    if (nonce_val)
    {
        ret  = axiom_element_set_text(nonce_ele, env, nonce_val, nonce_node);
    }

    return nonce_node;
}
Beispiel #6
0
/**
 * Creates <wsc:Label> element
 */
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
oxs_token_build_label_element(
    const axutil_env_t *env,
    axiom_node_t *parent,
    axis2_char_t *label_val, 
    axis2_char_t *wsc_ns_uri)
{
    axiom_node_t *label_node = NULL;
    axiom_element_t *label_ele = NULL;
    axiom_namespace_t *ns_obj = NULL;

    if(!wsc_ns_uri)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[rampart]Error creating %s Token element. SecConv namespace uri is not valid.", 
            OXS_NODE_LABEL);
        return NULL;
    }
    ns_obj = axiom_namespace_create(env, wsc_ns_uri, OXS_WSC);

    label_ele = axiom_element_create(env, parent, OXS_NODE_LABEL, ns_obj, &label_node);
    if(!label_ele)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[rampart]Error creating %s Token element.", OXS_NODE_LABEL);
        axiom_namespace_free(ns_obj, env);
        return NULL;
    }

    if(label_val)
    {
        axiom_element_set_text(label_ele, env, label_val, label_node);
    }

    return label_node;
}
Beispiel #7
0
/**
 * Creates <wsse:BinarySecurityToken> element
 */
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
oxs_token_build_binary_security_token_element(
    const axutil_env_t *env,
    axiom_node_t *parent,
    axis2_char_t* id,
    axis2_char_t* encoding_type,
    axis2_char_t* value_type,
    axis2_char_t* data)
{
    axiom_node_t *binary_sec_token_node = NULL;
    axiom_node_t *first_child_of_parent = NULL;
    axiom_element_t *binary_security_token_ele = NULL;
    axiom_attribute_t *encoding_type_att = NULL;
    axiom_attribute_t *value_type_att = NULL;
    axiom_attribute_t *id_attr = NULL;
    axiom_namespace_t *ns_obj = NULL;
    axiom_namespace_t *ns = NULL;

    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS, OXS_WSSE);
    ns = axiom_namespace_create(env, RAMPART_WSU_XMLNS, OXS_WSU);

    binary_security_token_ele = axiom_element_create(env, parent, OXS_NODE_BINARY_SECURITY_TOKEN,
        ns_obj, &binary_sec_token_node);
    if(!binary_security_token_ele)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating %s element.",
            OXS_NODE_BINARY_SECURITY_TOKEN);
        axiom_namespace_free(ns_obj, env);
        axiom_namespace_free(ns, env);
        return NULL;
    }

    /* Binary security token must be added as the first child of the paretn */
    binary_sec_token_node = axiom_node_detach_without_namespaces(binary_sec_token_node, env);
    first_child_of_parent = axiom_node_get_first_element(parent, env);
    if(first_child_of_parent)
    {
        /* If there is a child add bst before it */
        axiom_node_insert_sibling_before(first_child_of_parent, env, binary_sec_token_node);
    }
    else
    {
        /* If there are no children just add the bst */
        axiom_node_add_child(parent, env, binary_sec_token_node);
    }

    if(!id)
    {
        id = oxs_util_generate_id(env, (axis2_char_t*)OXS_CERT_ID);
    }

    id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, ns);
    encoding_type_att = axiom_attribute_create(env, OXS_ATTR_ENCODING_TYPE, encoding_type, NULL);
    value_type_att = axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);

    axiom_element_add_attribute(binary_security_token_ele, env, id_attr,
        binary_sec_token_node);
    axiom_element_add_attribute(binary_security_token_ele, env, encoding_type_att,
        binary_sec_token_node);
    axiom_element_add_attribute(binary_security_token_ele, env, value_type_att,
        binary_sec_token_node);

    if(data)
    {
        axiom_element_set_text(binary_security_token_ele, env, data,
            binary_sec_token_node);
    }

    return binary_sec_token_node;
}
Beispiel #8
0
        axiom_node_t* AXIS2_CALL
        axis2_sellRequest_ex_serialize(
                axis2_sellRequest_ex_t* sellRequest_ex,
                const axutil_env_t *env, axiom_node_t* parent, int has_parent)
        {
            
            axiom_namespace_t *ns1 = NULL;
            
                    axis2_char_t *text_value_1;
                    
                    axis2_char_t *text_value_2;
                    
                    axis2_char_t text_value_3[64];
                    
               axiom_node_t *current_node = NULL;
               axiom_element_t *current_element = NULL;
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            AXIS2_ENV_CHECK(env, NULL);

            ns1 = axiom_namespace_create (env,
                                         "http://www.wso2.org/types",
                                         "ns1");
            
                if( parent == NULL)
                {
                    current_element = axiom_element_create (env, parent, "sell", ns1 , &current_node);
                    axiom_element_set_namespace( current_element, env, ns1, current_node);
                    parent = current_node;
                }
               
                if(has_parent)
                {
                    data_source = axiom_node_get_data_element(parent, env);
                    if (!data_source)
                        return NULL;
                    stream = axiom_data_source_get_stream(data_source, env); /* assume parent is of type data source */
                    if (!stream)
                        return NULL;
                    current_node = parent;
                }
                else
                {
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                }
             
                     
                     /**
                      * parsing userid element
                      */
                     

                    
                    
                        start_input_str = "<ns1:userid>";
                        start_input_str_len = axutil_strlen(start_input_str);
                        end_input_str = "</ns1:userid>";
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                           text_value_1 = sellRequest_ex->attrib_userid;
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                        
                     
                     /**
                      * parsing symbol element
                      */
                     

                    
                    
                        start_input_str = "<ns1:symbol>";
                        start_input_str_len = axutil_strlen(start_input_str);
                        end_input_str = "</ns1:symbol>";
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                           text_value_2 = sellRequest_ex->attrib_symbol;
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           axutil_stream_write(stream, env, text_value_2, axutil_strlen(text_value_2));
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                        
                     
                     /**
                      * parsing qty element
                      */
                     

                    
                    
                        start_input_str = "<ns1:qty>";
                        start_input_str_len = axutil_strlen(start_input_str);
                        end_input_str = "</ns1:qty>";
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                               sprintf ( text_value_3, "%d", sellRequest_ex->attrib_qty );
                             
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           axutil_stream_write(stream, env, text_value_3, axutil_strlen(text_value_3));
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                        
            return parent;
        }
axiom_node_t* AXIS2_CALL
adb_listExternalUsersResponse_serialize_obj(
    adb_listExternalUsersResponse_t* _listExternalUsersResponse,
    const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
{



    axiom_node_t* current_node = NULL;
    int tag_closed = 0;

    axiom_namespace_t *ns1 = NULL;

    axis2_char_t *qname_uri = NULL;
    axis2_char_t *qname_prefix = NULL;
    axis2_char_t *p_prefix = NULL;
    axis2_bool_t ns_already_defined;

    int i = 0;
    int count = 0;
    void *element = NULL;

    axis2_char_t *text_value_1;
    axis2_char_t *text_value_1_temp;

    axis2_char_t *start_input_str = NULL;
    axis2_char_t *end_input_str = NULL;
    unsigned int start_input_str_len = 0;
    unsigned int end_input_str_len = 0;


    axiom_data_source_t *data_source = NULL;
    axutil_stream_t *stream = NULL;


    int next_ns_index_value = 0;


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


    namespaces = axutil_hash_make(env);
    next_ns_index = &next_ns_index_value;

    ns1 = axiom_namespace_create (env,
                                  "http://service.mgt.user.carbon.wso2.org",
                                  "n");
    axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));


    parent_element = axiom_element_create (env, NULL, "listExternalUsersResponse", ns1 , &parent);


    axiom_element_set_namespace(parent_element, env, ns1, parent);



    data_source = axiom_data_source_create(env, parent, &current_node);
    stream = axiom_data_source_get_stream(data_source, env);

    if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING)))
    {
        p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
        sprintf(p_prefix, "n%d", (*next_ns_index)++);
        axutil_hash_set(namespaces, "http://service.mgt.user.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix);

        axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                "http://service.mgt.user.carbon.wso2.org",
                p_prefix));
    }


    if (!_listExternalUsersResponse->is_valid_return)
    {

        /* no need to complain for minoccurs=0 element */


    }
    else
    {
        start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                          (4 + axutil_strlen(p_prefix) +
                           axutil_strlen("return")));

        /* axutil_strlen("<:>") + 1 = 4 */
        end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                        (5 + axutil_strlen(p_prefix) + axutil_strlen("return")));
        /* axutil_strlen("</:>") + 1 = 5 */





        /*
         * Parsing return array
         */
        if (_listExternalUsersResponse->property_return != NULL)
        {

            sprintf(start_input_str, "<%s%sreturn>",
                    p_prefix?p_prefix:"",
                    (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");

            start_input_str_len = axutil_strlen(start_input_str);

            sprintf(end_input_str, "</%s%sreturn>",
                    p_prefix?p_prefix:"",
                    (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
            end_input_str_len = axutil_strlen(end_input_str);

            count = axutil_array_list_size(_listExternalUsersResponse->property_return, env);
            for(i = 0; i < count; i ++)
            {
                element = axutil_array_list_get(_listExternalUsersResponse->property_return, env, i);

                if(NULL == element)
                {
                    continue;
                }


                /*
                 * parsing return element
                 */



                text_value_1 = (axis2_char_t*)element;

                axutil_stream_write(stream, env, start_input_str, start_input_str_len);


                text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE);
                if (text_value_1_temp)
                {
                    axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp));
                    AXIS2_FREE(env->allocator, text_value_1_temp);
                }
                else
                {
                    axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));
                }

                axutil_stream_write(stream, env, end_input_str, end_input_str_len);

            }
        }


        AXIS2_FREE(env->allocator,start_input_str);
        AXIS2_FREE(env->allocator,end_input_str);
    }


    if(namespaces)
    {
        axutil_hash_index_t *hi;
        void *val;
        for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi))
        {
            axutil_hash_this(hi, NULL, NULL, &val);
            AXIS2_FREE(env->allocator, val);
        }
        axutil_hash_free(namespaces, env);
    }


    return parent;
}
Beispiel #10
0
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
remote_registry_resource_serialize(
    remote_registry_resource_t *resource,
    const axutil_env_t *env)
{
    axiom_node_t *entry_node = NULL;
    axiom_element_t *entry_element = NULL;
    axiom_namespace_t *ns1 = NULL;
    axiom_namespace_t *ns2 = NULL;
    axis2_char_t *description = NULL;
    axis2_char_t *author = NULL;
    axutil_hash_t *properties = NULL;
    axis2_char_t *content = NULL;
    int collection = 0;
    int content_modified= 0;
	axis2_char_t *id = NULL;
	axis2_char_t *title = NULL;
	
    axis2_char_t *media_type = NULL;
    axis2_char_t *parent_path = NULL;
	axutil_date_time_t *modified_date = NULL;

    ns1 = axiom_namespace_create(env, REMOTE_REGISTRY_ATOM_NS, REMOTE_REGISTRY_ATOM_NS_PREFIX);
    ns2 = axiom_namespace_create(env, REMOTE_REGISTRY_REGISTRY_NS, REMOTE_REGISTRY_REGISTRY_NS_PREFIX);

	if(resource->is_collection)
	{
		entry_element = axiom_element_create(env, NULL, REMOTE_REGISTRY_FEED_KEY_FEED, ns1, &entry_node);
	}
	else
	{
		entry_element = axiom_element_create(env, NULL, REMOTE_REGISTRY_FEED_KEY_ENTRY, ns1, &entry_node);
	}

	axiom_element_declare_namespace(entry_element, env, entry_node, ns1);
	axiom_element_declare_namespace(entry_element, env, entry_node, ns2);

    /* getting variables from the structure and rendering into an XML */
	id = remote_registry_resource_get_id(resource, env);
	if(id)
	{
		axiom_node_t *id_node = NULL;
		axiom_element_t *id_element = NULL;

		id_element = axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_ID, ns1, &id_node);
		axiom_element_set_text(id_element, env, id, id_node);
	}


    title = remote_registry_resource_get_title(resource, env);
    if(title)
    {
        axiom_node_t *title_node = NULL;
        axiom_element_t *title_element = NULL;
        axiom_attribute_t *type_attr = NULL;

        title_element = axiom_element_create(env, entry_node,
						REMOTE_REGISTRY_FEED_KEY_TITLE, ns1, &title_node);
        axiom_element_set_text(title_element, env, title, title_node);

        type_attr = axiom_attribute_create(env, REMOTE_REGISTRY_FEED_ATTR_TYPE,
						REMOTE_REGISTRY_FEED_ATTR_TYPE_TEXT, NULL); 
        axiom_element_add_attribute(title_element, env, type_attr, title_node);
    }

    description = remote_registry_resource_get_description(resource, env);
    if(description)
    {
        axiom_node_t *summary_node = NULL;
        axiom_element_t *summary_element = NULL;
        axiom_attribute_t *type_attr = NULL;

        summary_element = axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_SUMMARY, ns1, &summary_node);
        axiom_element_set_text(summary_element, env, description, summary_node);

        type_attr = axiom_attribute_create(env, REMOTE_REGISTRY_FEED_ATTR_TYPE,
					REMOTE_REGISTRY_FEED_ATTR_TYPE_TEXT, NULL); 
        axiom_element_add_attribute(summary_element, env, type_attr, summary_node);
    }

    author = remote_registry_resource_get_author_name(resource, env);
    if(author)
    {
        axiom_node_t *author_node = NULL;
        axiom_node_t *name_node = NULL;
        axiom_element_t *name_ele = NULL;

        axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_AUTHOR, ns1, &author_node);
        name_ele = axiom_element_create(env, author_node, REMOTE_REGISTRY_FEED_KEY_NAME, ns1, &name_node);

        axiom_element_set_text(name_ele, env, author, name_node);
    }

	modified_date = remote_registry_resource_get_last_modified_time(resource, env);
	if(!modified_date) {
		modified_date = axutil_date_time_create(env);
		remote_registry_resource_set_last_modified_time(resource, env, modified_date);
	}
	if(modified_date) 
	{
        axiom_node_t *date_node = NULL;
        axiom_element_t *date_ele = NULL;
		axis2_char_t *modified_date_str = NULL;

		modified_date_str = axutil_date_time_serialize_date_time(modified_date, env);
        date_ele = axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_UPDATED, ns1, &date_node);
        axiom_element_set_text(date_ele, env, modified_date_str, date_node);

		AXIS2_FREE(env->allocator, modified_date_str);
	}
	

    content = remote_registry_resource_get_content(resource, env);
    if(content)
    {
        axiom_node_t *content_node = NULL;
        axiom_element_t *content_element = NULL;
        axiom_attribute_t *type_attr = NULL;
		axis2_char_t *base64_content = NULL;

		int base64_len = 0;
		int content_len = -1;

		content_len = remote_registry_resource_get_content_len(resource, env);
		if(content_len == -1) /* which mean we have to derive the content length */
		{
			content_len = axutil_strlen(content);
		}

		base64_len = axutil_base64_encode_len(content_len);
		base64_content = AXIS2_MALLOC(env->allocator, base64_len+ 1);

		if(base64_content) 
		{
			axutil_base64_encode(base64_content, content, content_len);
			base64_content[base64_len] = '\0';


			content_element = axiom_element_create(env, entry_node, 
							REMOTE_REGISTRY_FEED_KEY_CONTENT, ns1, &content_node);
			axiom_element_set_text(content_element, env, base64_content, content_node);


			type_attr = axiom_attribute_create(env, REMOTE_REGISTRY_FEED_ATTR_TYPE, 
							REMOTE_REGISTRY_FEED_ATTR_TYPE_BASE64_VALUE, NULL); 
			axiom_element_add_attribute(content_element, env, type_attr, content_node);
			
			AXIS2_FREE(env->allocator, base64_content);
		}
    }
    else if(!resource->is_collection)
    {
        axiom_node_t *content_node = NULL;
        axiom_element_t *content_element = NULL;
        axiom_attribute_t *type_attr = NULL;

        content_element = axiom_element_create(env, entry_node, 
						REMOTE_REGISTRY_FEED_KEY_CONTENT, ns1, &content_node);
        axiom_element_set_text(content_element, env, 
						REMOTE_REGISTRY_FEED_VALUE_EMPTY_CONTENT, content_node);


        type_attr = axiom_attribute_create(env, REMOTE_REGISTRY_FEED_ATTR_TYPE, 
						REMOTE_REGISTRY_FEED_ATTR_TYPE_TEXT_VALUE, NULL); 
        axiom_element_add_attribute(content_element, env, type_attr, content_node);
    }

    properties = remote_registry_resource_get_properties(resource, env);
    if(properties)
    {
        axiom_node_t *properties_node = NULL;
        axiom_node_t *property_node = NULL;
        axiom_node_t *name_node = NULL;
        axiom_node_t *value_node = NULL;
        axiom_element_t *name_element = NULL;
        axiom_element_t *value_element = NULL;
        axutil_hash_index_t *hi;
        void *val;
        void *key;
        int sum = 0;

        axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_PROPERTIES, ns2, &properties_node);
        
        for (hi = axutil_hash_first(resource->properties, env); hi; hi = axutil_hash_next(env, hi)) {
            axutil_hash_this(hi, (const void**)&key, NULL, &val);
            
            axiom_element_create(env, properties_node, REMOTE_REGISTRY_FEED_KEY_PROPERTY, ns2, &property_node);

            name_element = axiom_element_create(env, property_node, 
								REMOTE_REGISTRY_FEED_KEY_PROPERTY_KEY_NAME, ns2, &name_node);
            axiom_element_set_text(name_element, env, (axis2_char_t*)key, name_node);
            value_element = axiom_element_create(env, property_node, 
								REMOTE_REGISTRY_FEED_KEY_PROPERTY_KEY_VALUE, ns2, &value_node);
            axiom_element_set_text(value_element, env, (axis2_char_t*)val, value_node);
        }
    }
	
	media_type = remote_registry_resource_get_media_type(resource, env);
	if(media_type) 
	{
		axiom_element_t *media_element = NULL;
		axiom_node_t *media_node = NULL;
		media_element = axiom_element_create(env, entry_node, 
								REMOTE_REGISTRY_FEED_KEY_MEDIA_TYPE, ns2, &media_node);
		axiom_element_set_text(media_element, env, media_type, media_node);

	}

    parent_path = remote_registry_resource_get_parent_path(resource, env);
	if(parent_path) 
	{
		axiom_element_t *parent_path_element = NULL;
		axiom_node_t *parent_path_node = NULL;
		parent_path_element = axiom_element_create(env, entry_node, REMOTE_REGISTRY_FEED_KEY_PARENT_PATH, ns2, &parent_path_node);
		if(resource->is_collection) 
		{
			/* for collection parent path is always sent at the http request header */
			parent_path = "";
		}
		axiom_element_set_text(parent_path_element, env, parent_path, parent_path_node);
	}
	if(resource->is_collection)
	{
		axiom_element_t *content_modified_element = NULL;
		axiom_node_t *content_modified_node = NULL;
		content_modified_element = axiom_element_create(env, entry_node, 
				REMOTE_REGISTRY_FEED_KEY_CONTENT_MODIFIED, ns2, &content_modified_node);
		axiom_element_set_text(content_modified_element, env, 
				REMOTE_REGISTRY_FEED_KEY_TRUE_VALUE, content_modified_node);
	}

    return entry_node;
}
Beispiel #11
0
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
savan_client_get_status(
    savan_client_t *client,
    const axutil_env_t *env,
    axis2_svc_client_t *svc_client)
{
    axis2_options_t *wsa_options = NULL;
    const axis2_char_t *old_action = NULL;
    axutil_qname_t *qname = NULL;
    axiom_namespace_t *ns = NULL;
    axiom_node_t *reply = NULL;
    axiom_node_t *status_node = NULL;
    axiom_node_t *expires_node = NULL;
    axiom_element_t *status_elem = NULL;
    axiom_element_t *expires_elem = NULL;
    axis2_char_t *expires = NULL;
    axis2_char_t *status_elem_localname = NULL;

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

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

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

    expires = axiom_element_get_text(expires_elem, env, expires_node);
    
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Exit:savan_client_get_status");
    return expires;
}
Beispiel #12
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;
}
        axiom_node_t* AXIS2_CALL
        adb_getPermissionsResponse_serialize_obj(
                adb_getPermissionsResponse_t* _getPermissionsResponse,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t* current_node = NULL;
         int tag_closed = 0;
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT];
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _getPermissionsResponse, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://services.resource.ui.mgt.registry.carbon.wso2.org",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://services.resource.ui.mgt.registry.carbon.wso2.org", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "getPermissionsResponse", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://services.resource.ui.mgt.registry.carbon.wso2.org", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://services.resource.ui.mgt.registry.carbon.wso2.org", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://services.resource.ui.mgt.registry.carbon.wso2.org",
                                            p_prefix));
                       }
                      

                   if (!_getPermissionsResponse->is_valid_return)
                   {
                      
                           /* no need to complain for minoccurs=0 element */
                            
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("return"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("return")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing return element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%sreturn",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); 
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sreturn>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                     
                            if(!adb_PermissionBean_is_particle())
                            {
                                axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                            }
                            adb_PermissionBean_serialize(_getPermissionsResponse->property_return, 
                                                                                 env, current_node, parent_element,
                                                                                 adb_PermissionBean_is_particle() || AXIS2_FALSE, namespaces, next_ns_index);
                            
                            if(!adb_PermissionBean_is_particle())
                            {
                                axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                            }
                            
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
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;
}
Beispiel #15
0
        axiom_node_t* AXIS2_CALL
        adb_subscriberRequest_serialize_obj(
                adb_subscriberRequest_t* _subscriberRequest,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t* current_node = NULL;
         int tag_closed = 0;
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT];
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _subscriberRequest, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://mopevm.ru/axis2/services/types",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://mopevm.ru/axis2/services/types", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "subscriberRequest", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       p_prefix = NULL;
                      

                   if (!_subscriberRequest->is_valid_number)
                   {
                      
                            
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property number");
                            return NULL;
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("number"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("number")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing number element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%snumber>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%snumber>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                               sprintf (text_value_1, AXIS2_PRINTF_INT32_FORMAT_SPECIFIER, _subscriberRequest->property_number);
                             
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           
                           axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));
                           
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                           
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
Beispiel #16
0
axis2_status_t 
create_recipient_node(neethi_options_t *options,
                       const axutil_env_t *env,
                       axiom_node_t *parent_node)
{
    axiom_node_t *rec_token_node = NULL;
    axiom_node_t *rec_policy_node = NULL;
    axiom_node_t *x509_node = NULL;
    axiom_node_t *x509_policy_node = NULL;
    axiom_node_t *x509_type_node = NULL;

    axiom_element_t *rec_token_ele = NULL;
    axiom_element_t *x509_ele = NULL;
    axiom_element_t *parent_ele = NULL;

    axiom_attribute_t *attr = NULL;

    /*axiom_namespace_t *sp_ns = NULL;*/

    /*sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);*/

    parent_ele = axiom_node_get_data_element(parent_node, env);
    if(!parent_ele)
    {
        return AXIS2_FAILURE;
    }

    /*sp_ns = axiom_element_find_namespace(
            parent_ele, env, parent_node, RP_SP_NS_12, RP_SP_PREFIX);*/
    

    rec_token_ele = axiom_element_create(env, parent_node, RP_RECIPIENT_TOKEN, sp_ns, &rec_token_node);
    if(!rec_token_ele)
    {
        return AXIS2_FAILURE;
    }
    
    rec_policy_node = neethi_options_create_policy_node(env, rec_token_node);

    x509_ele = axiom_element_create(env, rec_policy_node, RP_X509_TOKEN, sp_ns, &x509_node);

    if(!x509_ele)
    {
        return AXIS2_FAILURE;
    }

    attr = axiom_attribute_create(env, RP_INCLUDE_TOKEN,  RP_INCLUDE_NEVER,
                                  sp_ns);
    axiom_element_add_attribute(x509_ele, env, attr, x509_node);
    x509_policy_node = neethi_options_create_policy_node(env, x509_node);
    if(x509_policy_node)
    {
        if(options->keyidentifier && !(options->server_side))
        {
            axiom_node_t *key_identifier_node = NULL;
            axiom_element_create(env, x509_policy_node, options->keyidentifier, sp_ns, &key_identifier_node);
        }
        axiom_element_create(env, x509_policy_node, RP_WSS_X509_V3_TOKEN_10, sp_ns, &x509_type_node);
        return AXIS2_SUCCESS;
    }
    else return AXIS2_FAILURE;
}
        axiom_node_t* AXIS2_CALL
        adb_UserNotRegisteredException1_serialize(
                adb_UserNotRegisteredException1_t* _UserNotRegisteredException1,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t *current_node = NULL;
         int tag_closed = 0;

         
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t text_value_1[64];
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _UserNotRegisteredException1, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://esb.callbackservice.services.hdviper.psnc.pl/",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "UserNotRegisteredException", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://esb.callbackservice.services.hdviper.psnc.pl/", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://esb.callbackservice.services.hdviper.psnc.pl/",
                                            p_prefix));
                       }
                      

                   if (!_UserNotRegisteredException1->is_valid_UserNotRegisteredException)
                   {
                      
                            
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property UserNotRegisteredException");
                            return NULL;
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("UserNotRegisteredException"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("UserNotRegisteredException")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing UserNotRegisteredException element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%sUserNotRegisteredException",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); 
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sUserNotRegisteredException>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                            adb_UserNotRegisteredException_serialize(_UserNotRegisteredException1->property_UserNotRegisteredException, 
                                                                                 env, current_node, parent_element,
                                                                                 adb_UserNotRegisteredException_is_particle() || AXIS2_TRUE, namespaces, next_ns_index);
                            
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
Beispiel #18
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
neethi_options_create_sym_node(
    neethi_options_t *options,
    const axutil_env_t *env,
    axiom_node_t *parent_node)
{
    axiom_node_t *symmetric_om_node = NULL;
    axiom_node_t *policy_sym_node = NULL;

    axiom_element_t *symmetric_om_ele = NULL;

    axis2_status_t status = AXIS2_FAILURE;

    symmetric_om_ele = axiom_element_create(env, parent_node, RP_SYMMETRIC_BINDING, sp_ns, &symmetric_om_node);
    if(!symmetric_om_ele)
    {
        return AXIS2_FAILURE;
    }
    policy_sym_node = neethi_options_create_policy_node(env, symmetric_om_node);
    if(!policy_sym_node)
    {
        return AXIS2_FAILURE;
    }
    status = create_protection_node(options, env, policy_sym_node);      
    if(status != AXIS2_SUCCESS)
    {
        return AXIS2_FAILURE;
    }

    status = create_algo_node(options, env, policy_sym_node);
    if(status != AXIS2_SUCCESS)
    {
        return AXIS2_FAILURE;
    }
    status = create_layout_node(options, env, policy_sym_node);
    if(status != AXIS2_SUCCESS)
    {
        return AXIS2_FAILURE;
    }
    if(options->include_timestamp)
    {
        axiom_node_t *ts_node = NULL;
        axiom_element_t *ts_ele = NULL;

        /*sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);*/
        ts_ele = axiom_element_create(env, policy_sym_node, RP_INCLUDE_TIMESTAMP, sp_ns, &ts_node);
        if(!ts_ele)
        {
            return AXIS2_FAILURE;
        }
    }
    if(options->encrypt_before_sign)
    {
        axiom_node_t *ebs_node = NULL;
        axiom_element_t *ebs_ele = NULL;

        /*sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);*/
        ebs_ele = axiom_element_create(env, policy_sym_node, RP_ENCRYPT_BEFORE_SIGNING, sp_ns, &ebs_node);
        if(!ebs_ele)
        {
            return AXIS2_FAILURE;
        }
    }
    if(options->signature_protection)
    {
        axiom_node_t *sigpro_node = NULL;
        axiom_element_t *sigpro_ele = NULL;

        /*sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);*/
        sigpro_ele = axiom_element_create(env, policy_sym_node, RP_ENCRYPT_SIGNATURE, sp_ns, &sigpro_node);
        if(!sigpro_ele)
        {
            return AXIS2_FAILURE;
        }
    }
    if(options->token_protection)
    {
        axiom_node_t *tokpro_node = NULL;
        axiom_element_t *tokpro_ele = NULL;

        /*sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);*/
        tokpro_ele = axiom_element_create(env, policy_sym_node, RP_PROTECT_TOKENS, sp_ns, &tokpro_node);
        if(!tokpro_ele)
        {
            return AXIS2_FAILURE;
        }
    }
    return AXIS2_SUCCESS;
}
Beispiel #19
0
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
neethi_options_get_root_node(
    neethi_options_t *options,
    const axutil_env_t *env)
{

    axiom_node_t *root_om_node = NULL;
    axiom_node_t* exact_om_node = NULL;
    axiom_node_t *all_om_node = NULL;

    axiom_element_t *all_om_ele = NULL;

    axis2_status_t status = AXIS2_SUCCESS;

    sp_ns = NULL;
    wsp_ns = NULL;

    wsp_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX);
    sp_ns = axiom_namespace_create(env, RP_SP_NS_12, RP_SP_PREFIX);

    axiom_element_create(env, NULL, NEETHI_POLICY, wsp_ns, &root_om_node);

    axiom_element_create(env, root_om_node, NEETHI_EXACTLYONE, wsp_ns, &exact_om_node);
    all_om_ele = axiom_element_create(env, exact_om_node, NEETHI_ALL, wsp_ns, &all_om_node);

    if(all_om_ele)
    {
        if(!axutil_strcmp(options->binding, RP_ASYMMETRIC_BINDING))
        {
            status = neethi_options_create_asym_node(options, env, all_om_node);
        }
        else
        {
            status = neethi_options_create_sym_node(options, env, all_om_node);
        }
        if(status != AXIS2_SUCCESS)
        {
            return NULL;
        }
        if(options->is_username_token)
        {
            status = create_username_node(options, env, all_om_node);
            if(status != AXIS2_SUCCESS)
            {
                return NULL;
            }
        }
        status = create_wss10_node(options, env, all_om_node);
        if(status != AXIS2_SUCCESS)
        {
            return NULL;
        }
        if(options->sign_body)/* Or if there are headers to be signed*/
        {    
            status = neethi_options_create_signed_parts_node(options, env, all_om_node);
            if(status != AXIS2_SUCCESS)
            {
                return NULL;
            }
        }    
        if(options->encrypt_body)/*Or if there are headers to be encrypt*/
        {    
            status = neethi_options_create_encrypted_parts_node(options, env, all_om_node);
            if(status != AXIS2_SUCCESS)
            {
                return NULL;
            }
        }    
        return root_om_node;
    }    
    else return NULL;
}
static void
ngx_squ_xml_serialize_table(squ_State *l, axutil_env_t *env,
    axiom_node_t *parent, char *name, int index)
{
    int                 top;
    char               *uri, *prefix, *text, *value;
    axiom_node_t       *node;
    axiom_element_t    *elem;
    ngx_squ_thread_t   *thr;
    axiom_namespace_t  *ns;
    axiom_attribute_t  *attr;

    thr = ngx_squ_thread(l);

    ngx_log_debug0(NGX_LOG_DEBUG_CORE, thr->log, 0, "squ xml serialize table");

    top = squ_gettop(l);

    squ_getfield(l, index, "uri");
    uri = (char *) squL_optstring(l, -1, NULL);

    squ_getfield(l, index, "prefix");
    prefix = (char *) squL_optstring(l, -1, NULL);

    if (uri != NULL || prefix != NULL) {
        ns = axiom_namespace_create(env, uri, prefix);

    } else {
        ns = NULL;
    }

    elem = axiom_element_create(env, parent, name, ns, &node);

    squ_getfield(l, index, "attributes");
    if (!squ_isnil(l, -1)) {
        if (!squ_istable(l, -1)) {
            squL_error(l, "the value of \"attributes\" must be a table");
        }

        squ_pushnil(l);

        while (squ_next(l, -2)) {
            name = (char *) squL_checkstring(l, -2);
            value = (char *) squL_checkstring(l, -1);

            attr = axiom_attribute_create(env, name, value, NULL);
            axiom_element_add_attribute(elem, env, attr, node);

            squ_pop(l, 1);
        }
    }

    squ_getfield(l, index, "text");
    text = (char *) squL_optstring(l, -1, NULL);

    if (text != NULL) {
        axiom_element_set_text(elem, env, text, node);
        squ_settop(l, top);
        return;
    }

    squ_getfield(l, index, "children");
    if (!squ_isnil(l, -1)) {
        if (!squ_istable(l, -1)) {
            squL_error(l, "the value of \"children\" must be a table");
        }

        ngx_squ_xml_serialize_tables(l, env, node);
    }

    squ_settop(l, top);
}
        axiom_node_t* AXIS2_CALL
        adb_CipherReference_serialize_obj(
                adb_CipherReference_t* _CipherReference,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t* current_node = NULL;
         int tag_closed = 0;
         axis2_char_t* xsi_prefix = NULL;
         axiom_namespace_t* xsi_ns = NULL;
         axiom_attribute_t* xsi_type_attri = NULL;
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t text_value_1[ADB_DEFAULT_DIGIT_LIMIT];
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _CipherReference, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://www.w3.org/2001/04/xmlenc#",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "CipherReference", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://www.w3.org/2001/04/xmlenc#", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://www.w3.org/2001/04/xmlenc#",
                                            p_prefix));
                       }
                      

                   if (!_CipherReference->is_valid_CipherReference)
                   {
                      
                            
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property CipherReference");
                            return NULL;
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("CipherReference"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("CipherReference")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing CipherReference element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%sCipherReference",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); 
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sCipherReference>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    adb_CipherReferenceType_serialize(_CipherReference->property_CipherReference, 
                                                                                 env, current_node, parent_element,
                                                                                 adb_CipherReferenceType_is_particle() || AXIS2_TRUE, namespaces, next_ns_index);
                            
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
AXIS2_EXTERN axiom_soap_fault_value_t *AXIS2_CALL
axiom_soap_fault_value_create_with_subcode(
    const axutil_env_t * env,
    axiom_soap_fault_sub_code_t * parent)
{
    axiom_soap_fault_value_t *fault_value = NULL;

    axiom_element_t *this_ele = NULL;
    axiom_node_t *this_node = NULL;
    axiom_namespace_t *parent_ns = NULL;
    axiom_node_t *parent_node = NULL;
    axiom_element_t *parent_ele = NULL;
    int soap_version = -1;

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

    fault_value = axiom_soap_fault_value_create(env);

    if (!fault_value)
    {
        return NULL;
    }

    parent_node = axiom_soap_fault_sub_code_get_base_node(parent, env);

    if (!parent_node)
    {
        axiom_soap_fault_value_free(fault_value, env);
        return NULL;
    }

    parent_ele = (axiom_element_t *)
        axiom_node_get_data_element(parent_node, env);

    if (!parent_ele)
    {
        axiom_soap_fault_value_free(fault_value, env);
        return NULL;
    }
    soap_version = axiom_soap_fault_sub_code_get_soap_version(parent, env);
    if (soap_version == AXIOM_SOAP12)
    {
        parent_ns = axiom_element_get_namespace(parent_ele, env, parent_node);
    }

    this_ele = axiom_element_create(env,
                                    parent_node,
                                    AXIOM_SOAP12_SOAP_FAULT_VALUE_LOCAL_NAME,
                                    parent_ns, &this_node);

    if (!this_ele)
    {
        axiom_soap_fault_value_free(fault_value, env);
        return NULL;
    }

    fault_value->om_ele_node = this_node;

    axiom_soap_fault_sub_code_set_value(parent, env, fault_value);

    return fault_value;
}
    axiom_node_t* AXIS2_CALL
    axis2_svc_skel_LoggingAdmin_on_fault(axis2_svc_skeleton_t *svc_skeleton,
                  const axutil_env_t *env, axiom_node_t *node)
	{
		axiom_node_t *error_node = NULL;
		axiom_element_t *error_ele = NULL;
        axutil_error_codes_t error_code;
        axis2_svc_skel_LoggingAdmin_t *svc_skeleton_wrapper = NULL;

        svc_skeleton_wrapper = (axis2_svc_skel_LoggingAdmin_t*)svc_skeleton;

        error_code = env->error->error_number;

        if(error_code <= AXIS2_SKEL_LOGGINGADMIN_ERROR_NONE ||
                error_code >= AXIS2_SKEL_LOGGINGADMIN_ERROR_LAST )
        {
            error_ele = axiom_element_create(env, node, "fault", NULL,
                            &error_node);
            axiom_element_set_text(error_ele, env, "LoggingAdmin|http://service.logging.carbon.wso2.org failed",
                            error_node);
        }
        

                else if(error_code == AXIS2_SKEL_LOGGINGADMIN_RESTOREDEFAULTS_FAULT_EXCEPTION)
                {
                    /* found which error code */
                    adb_ExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_ExceptionE0_t*)svc_skeleton_wrapper->fault.restoreDefaults_fault.Exception;
                    if(adb_obj)
                    {
                        error_node = adb_ExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_ExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.restoreDefaults_fault.Exception = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_LOGGINGADMIN_UPDATESYSTEMLOG_FAULT_EXCEPTION)
                {
                    /* found which error code */
                    adb_ExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_ExceptionE0_t*)svc_skeleton_wrapper->fault.updateSystemLog_fault.Exception;
                    if(adb_obj)
                    {
                        error_node = adb_ExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_ExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.updateSystemLog_fault.Exception = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_LOGGINGADMIN_GETSYSTEMLOG_FAULT_EXCEPTION)
                {
                    /* found which error code */
                    adb_ExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_ExceptionE0_t*)svc_skeleton_wrapper->fault.getSystemLog_fault.Exception;
                    if(adb_obj)
                    {
                        error_node = adb_ExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_ExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.getSystemLog_fault.Exception = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_LOGGINGADMIN_UPDATEALLAPPENDERDATA_FAULT_EXCEPTION)
                {
                    /* found which error code */
                    adb_ExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_ExceptionE0_t*)svc_skeleton_wrapper->fault.updateAllAppenderData_fault.Exception;
                    if(adb_obj)
                    {
                        error_node = adb_ExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_ExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.updateAllAppenderData_fault.Exception = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_LOGGINGADMIN_UPDATELOGGERDATA_FAULT_EXCEPTION)
                {
                    /* found which error code */
                    adb_ExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_ExceptionE0_t*)svc_skeleton_wrapper->fault.updateLoggerData_fault.Exception;
                    if(adb_obj)
                    {
                        error_node = adb_ExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_ExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.updateLoggerData_fault.Exception = NULL;
                    }

                }
            

		return error_node;
	}
Beispiel #24
0
axiom_node_t *
build_soap_body_content(
    const axutil_env_t * env,
    const axis2_char_t * echo_operation,
    const axis2_char_t * echo_type,
    const axis2_char_t * word_to_echo)
{

    axiom_node_t *operation_om_node = NULL;
    axiom_element_t *operation_om_ele = NULL;

    axiom_node_t *text_om_node = NULL;
    axiom_element_t *text_om_ele = NULL;

    axiom_attribute_t *attri1 = NULL;
    axiom_namespace_t *ns0 = NULL,
        *ns1 = NULL,
        *ns2 = NULL,
        *ns3 = NULL,
        *ns4 = NULL,
        *ns5 = NULL;
    axis2_char_t *om_str = NULL;

    axis2_char_t echo_operation_buff[32];
    axis2_char_t input_type_buff[32];
    axis2_char_t xsd_type_buff[32];

    /*generating the requried parameters */
    sprintf(echo_operation_buff, "echo%s", echo_operation);
    sprintf(input_type_buff, "input%s", echo_operation);
    sprintf(xsd_type_buff, "xsd:%s", echo_type);

    ns0 =
        axiom_namespace_create(env,
                               "http://schemas.xmlsoap.org/soap/envelope/",
                               "soapenv");
    ns1 =
        axiom_namespace_create(env,
                               "http://www.w3.org/2001/XMLSchema-instance",
                               "xsi");
    ns2 =
        axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema", "xsd");
    ns3 =
        axiom_namespace_create(env,
                               "http://schemas.xmlsoap.org/soap/encoding/",
                               "soapenc");
    ns4 = axiom_namespace_create(env, "http://soapinterop.org/", "tns");
    ns5 =
        axiom_namespace_create(env, "http://soapinterop.org/encodedTypes",
                               "types");

    operation_om_ele = axiom_element_create(env, NULL, echo_operation_buff,
                                            ns4, &operation_om_node);

    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns0);
    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns1);
    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns2);
    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns3);
    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns4);
    axiom_element_declare_namespace(operation_om_ele, env,
                                    operation_om_node, ns5);

    attri1 =
        axiom_attribute_create(env, "encodingStyle",
                               "http://schemas.xmlsoap.org/soap/encoding/",
                               ns0);

    operation_om_ele = AXIOM_NODE_GET_DATA_ELEMENT(operation_om_node, env);
    axiom_element_add_attribute(operation_om_ele, env, attri1,
                                operation_om_node);

    text_om_ele =
        axiom_element_create(env, operation_om_node, input_type_buff, NULL,
                             &text_om_node);
    attri1 = axiom_attribute_create(env, "type", xsd_type_buff, ns1);
    axiom_element_add_attribute(text_om_ele, env, attri1, text_om_node);
    axiom_element_set_text(text_om_ele, env, word_to_echo, text_om_node);

    om_str = AXIOM_NODE_TO_STRING(operation_om_node, env);
    if (om_str)
        printf("\nSending OM : %s\n", om_str);

    return operation_om_node;
}
    axiom_node_t* AXIS2_CALL
    axis2_svc_skel_SecurityAdminService_on_fault(axis2_svc_skeleton_t *svc_skeleton,
                  const axutil_env_t *env, axiom_node_t *node)
	{
		axiom_node_t *error_node = NULL;
		axiom_element_t *error_ele = NULL;
        axutil_error_codes_t error_code;
        axis2_svc_skel_SecurityAdminService_t *svc_skeleton_wrapper = NULL;

        svc_skeleton_wrapper = (axis2_svc_skel_SecurityAdminService_t*)svc_skeleton;

        error_code = env->error->error_number;

        if(error_code <= AXIS2_SKEL_SECURITYADMINSERVICE_ERROR_NONE ||
                error_code >= AXIS2_SKEL_SECURITYADMINSERVICE_ERROR_LAST )
        {
            error_ele = axiom_element_create(env, node, "fault", NULL,
                            &error_node);
            axiom_element_set_text(error_ele, env, "SecurityAdminService|http://service.config.security.carbon.wso2.org failed",
                            error_node);
        }
        

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_GETSCENARIOS_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.getScenarios_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.getScenarios_fault.SecurityConfigException = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_APPLYSECURITY_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.applySecurity_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.applySecurity_fault.SecurityConfigException = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_ACTIVATEUSERNAMETOKENAUTHENTICATION_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.activateUsernameTokenAuthentication_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.activateUsernameTokenAuthentication_fault.SecurityConfigException = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_DISABLESECURITYONSERVICE_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.disableSecurityOnService_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.disableSecurityOnService_fault.SecurityConfigException = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_GETSECURITYCONFIGDATA_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.getSecurityConfigData_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.getSecurityConfigData_fault.SecurityConfigException = NULL;
                    }

                }
            

                else if(error_code == AXIS2_SKEL_SECURITYADMINSERVICE_GETSECURITYSCENARIO_FAULT_SECURITYCONFIGEXCEPTION)
                {
                    /* found which error code */
                    adb_SecurityConfigExceptionE0_t* adb_obj = NULL;
                   
                    adb_obj = (adb_SecurityConfigExceptionE0_t*)svc_skeleton_wrapper->fault.getSecurityScenario_fault.SecurityConfigException;
                    if(adb_obj)
                    {
                        error_node = adb_SecurityConfigExceptionE0_serialize(adb_obj, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
                        adb_SecurityConfigExceptionE0_free(adb_obj, env);
                        svc_skeleton_wrapper->fault.getSecurityScenario_fault.SecurityConfigException = NULL;
                    }

                }
            

		return error_node;
	}
Beispiel #26
0
        axiom_node_t* AXIS2_CALL
        axis2_buyResponse_serialize(
                axis2_buyResponse_t* buyResponse,
                const axutil_env_t *env, axiom_node_t* parent, int has_parent)
        {
            
            axiom_namespace_t *ns1 = NULL;
            
                    /*axis2_char_t text_value_1[64];*/
                    
               axiom_node_t *current_node = NULL;
               axiom_element_t *current_element = NULL;
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            AXIS2_ENV_CHECK(env, NULL);

            ns1 = axiom_namespace_create (env,
                                         "http://www.wso2.org/types",
                                         "ns1");
            
                if( parent == NULL)
                {
                    current_element = axiom_element_create (env, parent, "buyResponse", ns1 , &current_node);
                    axiom_element_set_namespace( current_element, env, ns1, current_node);
                    parent = current_node;
                }
               
                if(has_parent)
                {
                    data_source = axiom_node_get_data_element(parent, env);
                    if (!data_source)
                        return NULL;
                    stream = axiom_data_source_get_stream(data_source, env); /* assume parent is of type data source */
                    if (!stream)
                        return NULL;
                    current_node = parent;
                }
                else
                {
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                }
             
                     
                     /**
                      * parsing trade_status element
                      */
                     

                    
                    
                        start_input_str = "<ns1:trade_status xmlns:ns1=\"http://www.wso2.org/types\">";
                        start_input_str_len = axutil_strlen(start_input_str);
                        end_input_str = "</ns1:trade_status>";
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                            axis2_TradeStatus_serialize( buyResponse->attrib_trade_status, env, current_node, AXIS2_TRUE);
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                        
            return parent;
        }
Beispiel #27
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;
}
        axiom_node_t* AXIS2_CALL
        adb_item_serialize_obj(
                adb_item_t* _item,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t* current_node = NULL;
         int tag_closed = 0;
         axis2_char_t* xsi_prefix = NULL;
         axiom_namespace_t* xsi_ns = NULL;
         axiom_attribute_t* xsi_type_attri = NULL;
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t *text_value_1;
                    axis2_char_t *text_value_1_temp;
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _item, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://www.daisy.org/ns/daisy-online/",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "item", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://www.daisy.org/ns/daisy-online/", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://www.daisy.org/ns/daisy-online/",
                                            p_prefix));
                       }
                      

                   if (!_item->is_valid_item)
                   {
                      
                            
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property item");
                            return NULL;
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("item"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("item")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing item element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%sitem>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sitem>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                           text_value_1 = _item->property_item;
                           
                            
                           text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE);
                           if (text_value_1_temp)
                           {
                               axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp));
                               AXIS2_FREE(env->allocator, text_value_1_temp);
                           }
                           else
                           {
                               axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));
                           }
                           
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
        axiom_node_t* AXIS2_CALL
        adb_getOperationRequestCount_serialize_obj(
                adb_getOperationRequestCount_t* _getOperationRequestCount,
                const axutil_env_t *env, axiom_node_t *parent, axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t *namespaces, int *next_ns_index)
        {
            
            
         
         axiom_node_t* current_node = NULL;
         int tag_closed = 0;
         
                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;
            
                    axis2_char_t *text_value_1;
                    axis2_char_t *text_value_1_temp;
                    
                    axis2_char_t *text_value_2;
                    axis2_char_t *text_value_2_temp;
                    
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;
            
            
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;

             
                int next_ns_index_value = 0;
            

            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _getOperationRequestCount, NULL);
            
             
                    namespaces = axutil_hash_make(env);
                    next_ns_index = &next_ns_index_value;
                     
                           ns1 = axiom_namespace_create (env,
                                             "http://org.apache.axis2/xsd",
                                             "n"); 
                           axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, axutil_strdup(env, "n"));
                       
                     
                    parent_element = axiom_element_create (env, NULL, "getOperationRequestCount", ns1 , &parent);
                    
                    
                    axiom_element_set_namespace(parent_element, env, ns1, parent);


            
                    data_source = axiom_data_source_create(env, parent, &current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                  
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://org.apache.axis2/xsd",
                                            p_prefix));
                       }
                      

                   if (!_getOperationRequestCount->is_valid_serviceName)
                   {
                      
                           /* no need to complain for minoccurs=0 element */
                            
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("serviceName"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("serviceName")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing serviceName element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%sserviceName>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sserviceName>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                           text_value_1 = _getOperationRequestCount->property_serviceName;
                           
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           
                            
                           text_value_1_temp = axutil_xml_quote_string(env, text_value_1, AXIS2_TRUE);
                           if (text_value_1_temp)
                           {
                               axutil_stream_write(stream, env, text_value_1_temp, axutil_strlen(text_value_1_temp));
                               AXIS2_FREE(env->allocator, text_value_1_temp);
                           }
                           else
                           {
                               axutil_stream_write(stream, env, text_value_1, axutil_strlen(text_value_1));
                           }
                           
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                           
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                       if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING)))
                       {
                           p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT);
                           sprintf(p_prefix, "n%d", (*next_ns_index)++);
                           axutil_hash_set(namespaces, "http://org.apache.axis2/xsd", AXIS2_HASH_KEY_STRING, p_prefix);
                           
                           axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env,
                                            "http://org.apache.axis2/xsd",
                                            p_prefix));
                       }
                      

                   if (!_getOperationRequestCount->is_valid_operationName)
                   {
                      
                           /* no need to complain for minoccurs=0 element */
                            
                          
                   }
                   else
                   {
                     start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) + 
                                  axutil_strlen("operationName"))); 
                                 
                                 /* axutil_strlen("<:>") + 1 = 4 */
                     end_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + axutil_strlen(p_prefix) + axutil_strlen("operationName")));
                                  /* axutil_strlen("</:>") + 1 = 5 */
                                  
                     

                   
                   
                     
                     /*
                      * parsing operationName element
                      */

                    
                    
                            sprintf(start_input_str, "<%s%soperationName>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                            
                        start_input_str_len = axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%soperationName>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);
                    
                           text_value_2 = _getOperationRequestCount->property_operationName;
                           
                           axutil_stream_write(stream, env, start_input_str, start_input_str_len);
                           
                            
                           text_value_2_temp = axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE);
                           if (text_value_2_temp)
                           {
                               axutil_stream_write(stream, env, text_value_2_temp, axutil_strlen(text_value_2_temp));
                               AXIS2_FREE(env->allocator, text_value_2_temp);
                           }
                           else
                           {
                               axutil_stream_write(stream, env, text_value_2, axutil_strlen(text_value_2));
                           }
                           
                           axutil_stream_write(stream, env, end_input_str, end_input_str_len);
                           
                     
                     AXIS2_FREE(env->allocator,start_input_str);
                     AXIS2_FREE(env->allocator,end_input_str);
                 } 

                 
                   if(namespaces)
                   {
                       axutil_hash_index_t *hi;
                       void *val;
                       for (hi = axutil_hash_first(namespaces, env); hi; hi = axutil_hash_next(env, hi)) 
                       {
                           axutil_hash_this(hi, NULL, NULL, &val);
                           AXIS2_FREE(env->allocator, val);
                       }
                       axutil_hash_free(namespaces, env);
                   }
                

            return parent;
        }
Beispiel #30
0
axis2_status_t AXIS2_CALL
wsf_xml_msg_recv_invoke_business_logic_sync(
        axis2_msg_recv_t * msg_recv,
        const axutil_env_t * env,
        axis2_msg_ctx_t * in_msg_ctx,
        axis2_msg_ctx_t * out_msg_ctx)
{

    axis2_op_ctx_t *op_ctx = NULL;
    axis2_op_t *op_desc = NULL;

    axiom_namespace_t *env_ns = NULL;

    int soap_version = AXIOM_SOAP12;
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_bool_t skel_invoked = AXIS2_FALSE;

    const axis2_char_t *style = NULL;
    axis2_char_t *local_name = NULL;
    axis2_char_t *soap_ns = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
    axis2_char_t *operation_name = NULL;
    char *classname = NULL;

    axutil_property_t *svc_info_prop = NULL;
    axutil_property_t *req_info_prop = NULL;
    wsf_svc_info_t *svc_info = NULL;
    wsf_request_info_t *req_info = NULL;

    /** store in_msg_ctx envelope */
    axiom_soap_envelope_t *envelope = NULL;
    axiom_soap_body_t *body = NULL;
    axiom_node_t *in_body_node = NULL;

    /* store out_msg_ctx envelope */
    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 *out_soap_fault = NULL;

    axiom_node_t *result_node = NULL;

    axiom_node_t *out_body_content_node = NULL;
    axiom_element_t *out_body_content_element = NULL;
    axiom_node_t *out_node = NULL;

    zval **output_headers_zval = NULL;

    TSRMLS_FETCH();

    AXIS2_PARAM_CHECK(env->error, in_msg_ctx, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, out_msg_ctx, AXIS2_FAILURE);

    op_ctx = axis2_msg_ctx_get_op_ctx(in_msg_ctx, env);
    op_desc = axis2_op_ctx_get_op(op_ctx, env);
    style = axis2_op_get_style(op_desc, env);

    envelope = axis2_msg_ctx_get_soap_envelope(in_msg_ctx, env);

    body = axiom_soap_envelope_get_body(envelope, env);

    in_body_node = axiom_soap_body_get_base_node(body, env);


    if (0 == axutil_strcmp(AXIS2_STYLE_DOC, style))
    {
        local_name = wsf_xml_msg_recv_get_method_name(in_msg_ctx, env);
        if (!local_name)
        {
            return AXIS2_FAILURE;
        }
    } else if (0 == axutil_strcmp(AXIS2_STYLE_RPC, style))
    {

        axiom_node_t *op_node = NULL;
        axiom_element_t *op_element = NULL;
        op_node = axiom_node_get_first_child(in_body_node, env);
        if (!op_node)
        {
            return AXIS2_FAILURE;
        }
        op_element = axiom_node_get_data_element(op_node, env);

        if (!op_element)
        {
            return AXIS2_FAILURE;
        }
        local_name = axiom_element_get_localname(op_element, env);
        if (!local_name)
        {
            return AXIS2_FAILURE;
        }
    }

    /** set soap version and soap namespace to local variables */
    if (in_msg_ctx && axis2_msg_ctx_get_is_soap_11(in_msg_ctx, env))
    {
        soap_ns = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI; /* default is 1.2 */
        soap_version = AXIOM_SOAP11;
    }

    svc_info_prop = axis2_msg_ctx_get_property(in_msg_ctx, env, WSF_SVC_INFO);
    if (svc_info_prop)
    {
        svc_info = (wsf_svc_info_t *) axutil_property_get_value(svc_info_prop, env);
        if (svc_info)
        {
            operation_name = axutil_hash_get(svc_info->ops_to_functions, local_name,
                    AXIS2_HASH_KEY_STRING);
            if (!operation_name)
            {
                return AXIS2_FAILURE;
            }
        } else
        {
            return AXIS2_FAILURE;
        }
        if (svc_info->ops_to_classes)
        {
            classname = axutil_hash_get(svc_info->ops_to_classes, local_name, AXIS2_HASH_KEY_STRING);
        }
    }

    req_info_prop = axis2_msg_ctx_get_property(in_msg_ctx, env, WSF_REQ_INFO);
    if (req_info_prop)
    {
        req_info = (wsf_request_info_t *) axutil_property_get_value(req_info_prop, env);

        if (axis2_msg_ctx_get_doing_rest(in_msg_ctx, env))
        {
            axis2_op_t *op = NULL;
            axiom_node_t *body_child_node = NULL;
            axiom_element_t *body_child = NULL;
            int i = 0;

            body_child_node = axiom_node_get_first_child(in_body_node, env);

            if (!body_child_node)
            {
                op = axis2_msg_ctx_get_op(in_msg_ctx, env);
                if (op)
                {
                    body_child = axiom_element_create_with_qname(env, NULL,
                            axis2_op_get_qname(op, env), &body_child_node);
                    axiom_soap_body_add_child(body, env, body_child_node);
                }
            }
            if (req_info->param_keys && req_info->param_values)
            {
                int i = 0;
                for (i = 0; i < axutil_array_list_size(req_info->param_keys, env); i++)
                {
                    axiom_node_t *node = NULL;
                    axiom_element_t *element = NULL;

                    axis2_char_t *param_key = NULL;
                    axis2_char_t *param_value = NULL;

                    param_key = axutil_array_list_get(req_info->param_keys, env, i);
                    param_value = axutil_array_list_get(req_info->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(req_info->param_keys, env);
                axutil_array_list_free(req_info->param_values, env);
            }
        }
    }

    if (svc_info->ht_op_params)
    {
        zval **tmp;
        char *function_type = NULL;
        if (zend_hash_find(svc_info->ht_op_params,
                operation_name, strlen(operation_name) + 1,
                (void **) & tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING)
        {
            function_type = Z_STRVAL_PP(tmp);

            if (strcmp(function_type, WSF_MIXED) == 0)
            {
                result_node = wsf_xml_msg_recv_invoke_mixed(env, svc_info,
                        in_msg_ctx, out_msg_ctx, operation_name,
                        classname, &output_headers_zval TSRMLS_CC);

            } else if (strcmp(function_type, WSF_WSMESSAGE) == 0)
            {
                result_node = wsf_xml_msg_recv_invoke_wsmsg(env, operation_name,
                        in_msg_ctx, out_msg_ctx, svc_info, classname, req_info->content_type TSRMLS_CC);
            }
        }
    } else
    {
        /* this is where the default value for opParam is set,
           If the wsdl option is set go for the MIXED mode by default */
		if (svc_info->wsdl == NULL || svc_info->omit_wsdl)
        {
            result_node = wsf_xml_msg_recv_invoke_wsmsg(env, operation_name,
                    in_msg_ctx, out_msg_ctx, svc_info, classname, req_info->content_type TSRMLS_CC);
        } else
        {
            result_node = wsf_xml_msg_recv_invoke_mixed(env, svc_info,
                    in_msg_ctx, out_msg_ctx, operation_name,
                    classname, &output_headers_zval TSRMLS_CC);
        }
    }
    if (!result_node)
    {
        status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
    } else
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, WSF_PHP_LOG_PREFIX "Response node is not null");
    }

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

            response_name = axutil_stracat(env, local_name, "Response");
            ns = axiom_namespace_create(env, "http://soapenc/", "res");
            if (!ns)
            {
                return AXIS2_FAILURE;
            }

            out_body_content_element = axiom_element_create(env, NULL, response_name,
                    ns, &out_body_content_node);
            axiom_node_add_child(out_body_content_node, env, result_node);

        } else
        {
            out_body_content_node = result_node;
        }
    }

    if (axis2_msg_ctx_get_soap_envelope(out_msg_ctx, env))
    {
        /* service implementation has set the envelope, useful when setting a SOAP fault.
           No need to further process */
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, WSF_PHP_LOG_PREFIX "soap fault is set");
        return AXIS2_SUCCESS;
    }

    /* create the soap envelope here */
    env_ns = axiom_namespace_create(env, soap_ns, AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX);
    if (!env_ns)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] error seting the namespces for the "
                AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX);
        return AXIS2_FAILURE;
    }

    default_envelope = axiom_soap_envelope_create(env, env_ns);

    if (!default_envelope)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, WSF_PHP_LOG_PREFIX "failed in creating the response soap envelope");
        return AXIS2_FAILURE;
    }


    out_body = axiom_soap_body_create_with_parent(env, default_envelope);
    if (!out_body)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] failed in creating the response soap body");
        return AXIS2_FAILURE;
    }

    out_header = axiom_soap_header_create_with_parent(env, default_envelope);
    if (!out_header)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, WSF_PHP_LOG_PREFIX "failed in creating the response soap headers");
        return AXIS2_FAILURE;
    }

    if (output_headers_zval)
    {
        axiom_node_t *header_base_node = NULL;

        HashPosition pos;
        zval **param;
        char *header_str;
        axiom_node_t *header_node;

        for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(output_headers_zval), &pos);
                zend_hash_get_current_data_ex(Z_ARRVAL_PP(output_headers_zval),
                (void **) & param, &pos) == SUCCESS;
                zend_hash_move_forward_ex(Z_ARRVAL_PP(output_headers_zval), &pos))
        {

            if (Z_TYPE_PP(param) == IS_STRING)
            {

                header_base_node = axiom_soap_header_get_base_node(out_header, env);

                if (header_base_node)
                {
                    header_str = Z_STRVAL_PP(param);
                    header_node = wsf_util_deserialize_buffer(env, header_str);
                    axiom_node_add_child(header_base_node, env, header_node);
                } else
                {
                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] failed in retrieving the response soap headers node");
                    return AXIS2_FAILURE;
                }
            }
        }
    }

    out_node = axiom_soap_body_get_base_node(out_body, env);
    if (!out_node)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[wsfphp] failed in retrieving the response soap body node");
        return AXIS2_FAILURE;
    }

    if (status != AXIS2_SUCCESS)
    {
        /* something went wrong, set a SOAP Fault */
        axis2_char_t *fault_value_str =
                AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":" AXIOM_SOAP12_SOAP_FAULT_VALUE_SENDER;

        axis2_char_t *fault_reason_str = NULL;
        axis2_char_t *err_msg = NULL;

        if (!skel_invoked)
            fault_value_str = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":" AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
        ;

        err_msg = (char *) AXIS2_ERROR_GET_MESSAGE(env->error);

        if (err_msg)
        {
            fault_reason_str = err_msg;
        } else
        {
            fault_reason_str = "Error occurred while processing SOAP message";
        }

        out_soap_fault = axiom_soap_fault_create_default_fault(env, out_body,
                fault_value_str, fault_reason_str, soap_version);
    }

    if (out_body_content_node)
    {
        axiom_node_add_child(out_node, env, out_body_content_node);
        status = axis2_msg_ctx_set_soap_envelope(out_msg_ctx, env,
                default_envelope);
    } else if (out_soap_fault)
    {
        axis2_msg_ctx_set_soap_envelope(out_msg_ctx, env, default_envelope);
        status = AXIS2_FAILURE; /* if there is a failure we have to return a failure code */
    } 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;
    }
    return AXIS2_SUCCESS;
}