AXIS2_EXTERN axis2_status_t AXIS2_CALL neethi_exactlyone_serialize( neethi_exactlyone_t *neethi_exactlyone, axiom_node_t *parent, const axutil_env_t *env) { axiom_node_t *exactlyone_node = NULL; axiom_namespace_t *policy_ns = NULL; axutil_array_list_t *components = NULL; policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX); axiom_element_create(env, parent, NEETHI_EXACTLYONE, policy_ns, &exactlyone_node); if(!exactlyone_node) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create 'ExactlyOne' node. Serialization of 'ExactlyOne' assertion failed"); return AXIS2_FAILURE; } components = neethi_exactlyone_get_policy_components(neethi_exactlyone, env); if(components) { axis2_status_t status = AXIS2_FAILURE; int i = 0; for(i = 0; i < axutil_array_list_size(components, env); i++) { neethi_operator_t *operator = NULL; operator = (neethi_operator_t *)axutil_array_list_get(components, env, i); if(operator) { status = neethi_operator_serialize(operator, env, exactlyone_node); if(status != AXIS2_SUCCESS) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi operator serialization failed. " "Cannot serialize 'ExactlyOne' assertion"); return AXIS2_FAILURE; } } } } return AXIS2_SUCCESS; }
/** * Creates <wsc:Length> element */ AXIS2_EXTERN axiom_node_t* AXIS2_CALL oxs_token_build_length_element( const axutil_env_t *env, axiom_node_t *parent, int length, axis2_char_t *wsc_ns_uri) { axiom_node_t *length_node = NULL; axiom_element_t *length_ele = NULL; axiom_namespace_t *ns_obj = NULL; axis2_char_t *length_val = 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_LENGTH); return NULL; } ns_obj = axiom_namespace_create(env, wsc_ns_uri, OXS_WSC); length_ele = axiom_element_create(env, parent, OXS_NODE_LENGTH, ns_obj, &length_node); if(!length_ele) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating %s Token element.", OXS_NODE_LENGTH); axiom_namespace_free(ns_obj, env); return NULL; } if(length > 0) { length_val = (axis2_char_t *) AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 32); sprintf(length_val, "%d", length ); } if(length_val) { axiom_element_set_text(length_ele, env, length_val, length_node); AXIS2_FREE(env->allocator, length_val); } return length_node; }
AXIS2_EXTERN axiom_node_t* AXIS2_CALL saml_autho_decision_query_to_om(saml_autho_decision_query_t *autho_decision_query, axiom_node_t *parent, const axutil_env_t *env) { int size = 0, i = 0; axiom_element_t *e = NULL; axiom_node_t *n = NULL; axiom_namespace_t *ns = NULL; axiom_attribute_t *attr = NULL; saml_action_t *action; ns = axiom_namespace_create(env, SAML_PROTOCOL_NMSP, SAML_PROTOCOL_PREFIX); e = axiom_element_create(env, parent, SAML_AUTHORIZATION_DECISION_QUERY, ns, &n); if(e) { if(autho_decision_query->subject) saml_subject_to_om(autho_decision_query->subject, n, env); if(autho_decision_query->resource) { attr = axiom_attribute_create(env, SAML_RESOURCE, autho_decision_query->resource, NULL); axiom_element_add_attribute(e, env, attr, n); } if(autho_decision_query->saml_actions) { size = axutil_array_list_size(autho_decision_query->saml_actions, env); for(i = 0 ; i < size ; i++) { action = (saml_action_t*)axutil_array_list_get(autho_decision_query->saml_actions, env, i); saml_action_to_om(action, n, env); } } if(autho_decision_query->evidence) { saml_evidence_to_om(autho_decision_query->evidence, n, env); } } return n; }
void axis2_addr_in_create_fault_envelope( const axutil_env_t * env, const axis2_char_t * header_name, const axis2_char_t * addr_ns_str, axis2_msg_ctx_t * msg_ctx) { axiom_soap_envelope_t *envelope = NULL; axutil_array_list_t *sub_codes = NULL; int soap_version = AXIOM_SOAP12; axiom_node_t *text_om_node = NULL; axiom_element_t *text_om_ele = NULL; axiom_namespace_t *ns1 = NULL; if (axis2_msg_ctx_get_is_soap_11(msg_ctx, env)) { soap_version = AXIOM_SOAP11; } ns1 = axiom_namespace_create(env, addr_ns_str, AXIS2_WSA_DEFAULT_PREFIX); text_om_ele = axiom_element_create(env, NULL, "ProblemHeaderQName", ns1, &text_om_node); axiom_element_set_text(text_om_ele, env, header_name, text_om_node); sub_codes = axutil_array_list_create(env, 2); if (sub_codes) { axutil_array_list_add(sub_codes, env, "wsa:InvalidAddressingHeader"); axutil_array_list_add(sub_codes, env, "wsa:InvalidCardinality"); } envelope = axiom_soap_envelope_create_default_soap_fault_envelope(env, "soapenv:Sender", "A header representing a Message Addressing Property is not valid and the message cannot be processed", soap_version, sub_codes, text_om_node); axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, envelope); axis2_msg_ctx_set_wsa_action(msg_ctx, env, "http://www.w3.org/2005/08/addressing/fault"); return; }
AXIS2_EXTERN axiom_node_t* AXIS2_CALL saml_subject_query_to_om(saml_subject_query_t *subject_query, axiom_node_t *parent, const axutil_env_t *env) { axiom_element_t *e = NULL; axiom_node_t *n = NULL; axiom_namespace_t *ns = NULL; ns = axiom_namespace_create(env, SAML_PROTOCOL_NMSP, SAML_PROTOCOL_PREFIX); e = axiom_element_create(env, parent, SAML_SUBJECT_QUERY, ns, &n); if(e) { if(subject_query->subject) saml_subject_to_om(subject_query->subject, n, env); } return n; }
/* Builds the response content */ axiom_node_t * build_om_programatically(const axutil_env_t *env, axis2_char_t *text) { axiom_node_t *echo_om_node = NULL; axiom_element_t* echo_om_ele = NULL; axiom_node_t* text_om_node = NULL; axiom_element_t * text_om_ele = NULL; axiom_namespace_t *ns1 = NULL; ns1 = axiom_namespace_create (env, "http://ws.apache.org/axis2/c/samples", "ns1"); echo_om_ele = axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node); text_om_ele = axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node); axiom_element_set_text(text_om_ele, env, text, text_om_node); return echo_om_node; }
axiom_node_t *build_response2( const axutil_env_t *env, axiom_data_handler_t *data_handler) { axiom_node_t *mtom_om_node = NULL; axiom_element_t *mtom_om_ele = NULL; axiom_node_t *text_node = NULL; axiom_namespace_t *ns1 = NULL; ns1 = axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples", "ns1"); mtom_om_ele = axiom_element_create(env, NULL, "response", ns1, &mtom_om_node); axiom_text_create_with_data_handler(env, mtom_om_node, data_handler, &text_node); return mtom_om_node; }
/* build SOAP request message content using OM */ axiom_node_t * build_om_payload_for_echo_svc( const axutil_env_t *env, axis2_char_t *text) { axiom_node_t *echo_om_node = NULL; axiom_element_t* echo_om_ele = NULL; axiom_node_t* text_om_node = NULL; axiom_element_t * text_om_ele = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *ns = NULL; ns = "http://tempuri.org/"; ns1 = axiom_namespace_create (env, ns, "ns1"); echo_om_ele = axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node); text_om_ele = axiom_element_create(env, echo_om_node, "Text", NULL, &text_om_node); axiom_element_set_text(text_om_ele, env, text, text_om_node); return echo_om_node; }
/** Find or create namespace. * @param env * @param node * @param uri * @param prefix * @return ptr to the namespace of 'node'. */ axiom_namespace_t *sp_find_or_create_ns( const axutil_env_t *env, axiom_node_t *node, const axis2_char_t *uri, const axis2_char_t *prefix) { axiom_namespace_t *ns = NULL; axiom_node_t *root_el_node = axiom_node_get_first_element (node, env); if (axiom_node_get_node_type(root_el_node, env) == AXIOM_ELEMENT) { axiom_element_t *el = (axiom_element_t *) axiom_node_get_data_element (root_el_node, env); ns = axiom_element_find_declared_namespace(el, env, uri, prefix); } if (NULL == ns) { ns = axiom_namespace_create (env, uri, prefix); } }
/** * Creates <ds:SignedInfo> element */ AXIS2_EXTERN axiom_node_t* AXIS2_CALL oxs_token_build_signed_info_element( const axutil_env_t *env, axiom_node_t *parent) { axiom_node_t *signed_info_node = NULL; axiom_element_t *signed_info_ele = NULL; axiom_namespace_t *ns_obj = NULL; ns_obj = axiom_namespace_create(env, OXS_DSIG_NS, OXS_DS); signed_info_ele = axiom_element_create( env, parent, OXS_NODE_SIGNEDINFO, ns_obj, &signed_info_node); if (!signed_info_ele) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating SignedInfo element."); axiom_namespace_free(ns_obj, env); return NULL; } return signed_info_node; }
AXIS2_EXTERN axiom_node_t *AXIS2_CALL remote_registry_util_serialize_rating( const axutil_env_t *env, int rate) { axiom_node_t *entry_node = NULL; axiom_element_t *entry_element = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *content = NULL; axiom_node_t *content_node = NULL; axiom_element_t *content_element = NULL; axiom_node_t *summary_node = NULL; axiom_element_t *summary_element = NULL; axiom_attribute_t *type_attr = NULL; axis2_char_t *media_type = NULL; ns1 = axiom_namespace_create(env, REMOTE_REGISTRY_ATOM_NS, "ns1"); entry_element = axiom_element_create(env, NULL, "entry", ns1, &entry_node); /* getting variables from the argument and rendering into an XML */ content = AXIS2_MALLOC(env->allocator, 64); content_element = axiom_element_create(env, entry_node, "content", ns1, &content_node); axiom_element_set_text(content_element, env, content, content_node); type_attr = axiom_attribute_create(env, "type", "text", NULL); axiom_element_add_attribute(content_element, env, type_attr, content_node); summary_element = axiom_element_create(env, entry_node, "content", ns1, &summary_node); axiom_element_set_text(summary_element, env, content, summary_node); type_attr = axiom_attribute_create(env, "type", "text", NULL); axiom_element_add_attribute(summary_element, env, type_attr, summary_node); return entry_node; }
/** * Creates <xenc:CipherData> element */ AXIS2_EXTERN axiom_node_t* AXIS2_CALL oxs_token_build_cipher_data_element( const axutil_env_t *env, axiom_node_t *parent) { axiom_node_t *cipher_data_node = NULL; axiom_element_t *cipher_data_ele = NULL; axiom_namespace_t *ns_obj = NULL; ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC); cipher_data_ele = axiom_element_create( env, parent, OXS_NODE_CIPHER_DATA, ns_obj, &cipher_data_node); if (!cipher_data_ele) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating cipher data element."); axiom_namespace_free(ns_obj, env); return NULL; } return cipher_data_node; }
/** * 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; int ret; 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); ret = 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); ret = axiom_element_add_attribute(reference_ele, env, value_type_attr, reference_node); } return reference_node; }
/** * Creates <xenc:EncryptedData> element */ AXIS2_EXTERN axiom_node_t* AXIS2_CALL oxs_token_build_encrypted_data_element( const axutil_env_t *env, axiom_node_t *parent, axis2_char_t* type_attribute, axis2_char_t* id) { axiom_node_t *encrypted_data_node = NULL; axiom_element_t *encrypted_data_ele = NULL; axiom_attribute_t *type_attr = NULL; axiom_attribute_t *id_attr = NULL; axiom_namespace_t *ns_obj = NULL; ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC); encrypted_data_ele = axiom_element_create( env, parent, OXS_NODE_ENCRYPTED_DATA, ns_obj, &encrypted_data_node); if(!encrypted_data_ele) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating encrypted data element."); axiom_namespace_free(ns_obj, env); return NULL; } if (type_attribute) { type_attr = axiom_attribute_create(env, OXS_ATTR_TYPE, type_attribute, NULL); axiom_element_add_attribute(encrypted_data_ele, env, type_attr, encrypted_data_node); } if(!id) { id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID); } id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL ); axiom_element_add_attribute(encrypted_data_ele, env, id_attr, encrypted_data_node); return encrypted_data_node; }
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; }
AXIS2_EXTERN axiom_node_t* AXIS2_CALL saml_attr_query_to_om(saml_attr_query_t *attribute_query, axiom_node_t *parent, const axutil_env_t *env) { int size = 0, i = 0; axiom_element_t *e = NULL; axiom_node_t *n = NULL; axiom_namespace_t *ns = NULL; axiom_attribute_t *attr = NULL; saml_attr_desig_t *attr_desig = NULL; ns = axiom_namespace_create(env, SAML_PROTOCOL_NMSP, SAML_PROTOCOL_PREFIX); e = axiom_element_create(env, parent, SAML_ATTRIBUTE_QUERY, ns, &n); if(e) { if(attribute_query->subject) saml_subject_to_om(attribute_query->subject, n, env); if(attribute_query->resource) { attr = axiom_attribute_create(env, SAML_RESOURCE, attribute_query->resource, NULL); axiom_element_add_attribute(e, env, attr, n); } if(attribute_query->attr_desigs) { size = axutil_array_list_size(attribute_query->attr_desigs, env); for( i=0 ; i < size ; i++) { attr_desig = (saml_attr_desig_t*)axutil_array_list_get(attribute_query->attr_desigs, env, i); saml_attr_desig_to_om(attr_desig, n, env); } } } return n; }
/* build SOAP request message content using OM */ axiom_node_t * build_om_payload_for_echo_svc(const axutil_env_t *env) { axiom_node_t *echo_om_node = NULL; axiom_element_t* echo_om_ele = NULL; axiom_node_t* text_om_node = NULL; axiom_element_t * text_om_ele = NULL; axiom_namespace_t *ns1 = NULL; axis2_char_t *om_str = NULL; ns1 = axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples", "ns1"); echo_om_ele = axiom_element_create(env, NULL, "echoString", ns1, &echo_om_node); text_om_ele = axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node); axiom_element_set_text(text_om_ele, env, "echo5", text_om_node); om_str = axiom_node_to_string(echo_om_node, env); if (om_str) { AXIS2_FREE(env->allocator, om_str); om_str = NULL; } return echo_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, ¬ify_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; }
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; }
/** * 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; }
/* build SOAP request message content using OM */ axiom_node_t * build_om_payload_for_mtom( const axutil_env_t *env, const axis2_char_t *image_name, const axis2_char_t *to_save_name) { axiom_node_t *mtom_om_node = NULL; axiom_element_t* mtom_om_ele = NULL; axiom_node_t* image_om_node = NULL; axiom_element_t * image_om_ele = NULL; axiom_node_t* file_om_node = NULL; axiom_element_t * file_om_ele = NULL; axiom_node_t* data_om_node = NULL; axiom_text_t * data_text = NULL; axiom_namespace_t *ns1 = NULL; axiom_data_handler_t *data_handler = NULL; ns1 = axiom_namespace_create(env, "http://ws.apache.org/axis2/c/samples/mtom", "ns1"); mtom_om_ele = axiom_element_create(env, NULL, "mtomSample", ns1, &mtom_om_node); file_om_ele = axiom_element_create(env, mtom_om_node, "fileName", ns1, &file_om_node); axiom_element_set_text(file_om_ele, env, to_save_name, file_om_node); image_om_ele = axiom_element_create(env, mtom_om_node, "image", ns1, &image_om_node); data_handler = axiom_data_handler_create(env, image_name, "image/jpeg"); data_text = axiom_text_create_with_data_handler(env, image_om_node, data_handler, &data_om_node); /*printf("%s", axiom_node_to_string(mtom_om_node, env));*/ return mtom_om_node; }
/** * 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; }
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, ¤t_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; }
/** * 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; }
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, ¤t_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; }
axiom_node_t* AXIS2_CALL prf_logOnResponseType_serialize_obj( prf_logOnResponseType_t* _logOnResponseType, 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) { axis2_char_t *string_to_stream; 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; axis2_char_t* type_attrib = 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[PRF_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; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _logOnResponseType, NULL); current_node = parent; data_source = (axiom_data_source_t *)axiom_node_get_data_element(current_node, 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; if(!parent_tag_closed) { if(!(xsi_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING))) { /* it is better to stick with the standard prefix */ xsi_prefix = (axis2_char_t*)axutil_strdup(env, "xsi"); axutil_hash_set(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING, xsi_prefix); if(parent_element) { axiom_namespace_t *element_ns = NULL; element_ns = axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema-instance", xsi_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, element_ns); if(element_ns) { axiom_namespace_free(element_ns, env); } } } type_attrib = axutil_strcat(env, " ", xsi_prefix, ":type=\"logOnResponseType\"", NULL); axutil_stream_write(stream, env, type_attrib, axutil_strlen(type_attrib)); AXIS2_FREE(env->allocator, type_attrib); string_to_stream = ">"; axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); tag_closed = 1; } else { /* if the parent tag closed we would be able to declare the type directly on the parent element */ if(!(xsi_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING))) { /* it is better to stick with the standard prefix */ xsi_prefix = (axis2_char_t*)axutil_strdup(env, "xsi"); axutil_hash_set(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING, xsi_prefix); if(parent_element) { axiom_namespace_t *element_ns = NULL; element_ns = axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema-instance", xsi_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, element_ns); if(element_ns) { axiom_namespace_free(element_ns, env); } } } } xsi_ns = axiom_namespace_create (env, "http://www.pratsam.org/ns/profile/", xsi_prefix); xsi_type_attri = axiom_attribute_create (env, "type", "logOnResponseType", xsi_ns); axiom_element_add_attribute (parent_element, env, xsi_type_attri, parent); if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.pratsam.org/ns/profile/", AXIS2_HASH_KEY_STRING))) { p_prefix = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof (axis2_char_t) * PRF_DEFAULT_NAMESPACE_PREFIX_LIMIT); sprintf(p_prefix, "n%d", (*next_ns_index)++); axutil_hash_set(namespaces, "http://www.pratsam.org/ns/profile/", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.pratsam.org/ns/profile/", p_prefix)); } if (!_logOnResponseType->is_valid_logOnResult) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property logOnResult"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("logOnResult"))); /* 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("logOnResult"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing logOnResult element */ sprintf(start_input_str, "<%s%slogOnResult>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%slogOnResult>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); strcpy(text_value_1, (_logOnResponseType->property_logOnResult)?"true":"false"); 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); } return parent; }
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, ¤t_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; }
axiom_node_t* AXIS2_CALL adb_TransformTypeChoice_serialize_obj( adb_TransformTypeChoice_t* _TransformTypeChoice, 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) { axis2_char_t *string_to_stream; 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; axis2_char_t* type_attrib = 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 *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; AXIS2_ENV_CHECK(env, NULL); AXIS2_PARAM_CHECK(env->error, _TransformTypeChoice, NULL); current_node = parent; data_source = (axiom_data_source_t *)axiom_node_get_data_element(current_node, 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; if(!parent_tag_closed) { if(!(xsi_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING))) { /* it is better to stick with the standard prefix */ xsi_prefix = (axis2_char_t*)axutil_strdup(env, "xsi"); axutil_hash_set(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING, xsi_prefix); if(parent_element) { axiom_namespace_t *element_ns = NULL; element_ns = axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema-instance", xsi_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, element_ns); if(element_ns) { axiom_namespace_free(element_ns, env); } } } type_attrib = axutil_strcat(env, " ", xsi_prefix, ":type=\"TransformTypeChoice\"", NULL); axutil_stream_write(stream, env, type_attrib, axutil_strlen(type_attrib)); AXIS2_FREE(env->allocator, type_attrib); string_to_stream = ">"; axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); tag_closed = 1; } else { /* if the parent tag closed we would be able to declare the type directly on the parent element */ if(!(xsi_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING))) { /* it is better to stick with the standard prefix */ xsi_prefix = (axis2_char_t*)axutil_strdup(env, "xsi"); axutil_hash_set(namespaces, "http://www.w3.org/2001/XMLSchema-instance", AXIS2_HASH_KEY_STRING, xsi_prefix); if(parent_element) { axiom_namespace_t *element_ns = NULL; element_ns = axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema-instance", xsi_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, element_ns); if(element_ns) { axiom_namespace_free(element_ns, env); } } } } xsi_ns = axiom_namespace_create (env, "http://www.w3.org/2000/09/xmldsig#", xsi_prefix); xsi_type_attri = axiom_attribute_create (env, "type", "TransformTypeChoice", xsi_ns); axiom_element_add_attribute (parent_element, env, xsi_type_attri, parent); if(0 == axutil_strcmp(_TransformTypeChoice->current_choice, ":extraElement")) { p_prefix = NULL; if (!_TransformTypeChoice->is_valid_extraElement) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property extraElement"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("extraElement"))); /* 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("extraElement"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing extraElement element */ sprintf(start_input_str, "<%s%sextraElement>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sextraElement>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_1 = axiom_node_to_string(_TransformTypeChoice->property_extraElement, env); 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(0 == axutil_strcmp(_TransformTypeChoice->current_choice, "http://www.w3.org/2000/09/xmldsig#:XPath")) { if(!(p_prefix = (axis2_char_t*)axutil_hash_get(namespaces, "http://www.w3.org/2000/09/xmldsig#", 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/2000/09/xmldsig#", AXIS2_HASH_KEY_STRING, p_prefix); axiom_element_declare_namespace_assume_param_ownership(parent_element, env, axiom_namespace_create (env, "http://www.w3.org/2000/09/xmldsig#", p_prefix)); } if (!_TransformTypeChoice->is_valid_XPath) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil value found in non-nillable property XPath"); return NULL; } else { start_input_str = (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (4 + axutil_strlen(p_prefix) + axutil_strlen("XPath"))); /* 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("XPath"))); /* axutil_strlen("</:>") + 1 = 5 */ /* * parsing XPath element */ sprintf(start_input_str, "<%s%sXPath>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); start_input_str_len = axutil_strlen(start_input_str); sprintf(end_input_str, "</%s%sXPath>", p_prefix?p_prefix:"", (p_prefix && axutil_strcmp(p_prefix, ""))?":":""); end_input_str_len = axutil_strlen(end_input_str); text_value_2 = _TransformTypeChoice->property_XPath; 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); } } return parent; }
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, ¤t_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; }
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; }