axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_empty_element_with_namespace_prefix( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * localname, axis2_char_t * namespace_uri, axis2_char_t * prefix) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, localname, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, namespace_uri, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, prefix, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterStartElementNS(writer_impl->xml_writer, BAD_CAST prefix, BAD_CAST localname, BAD_CAST NULL); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_START_ELEMENT_WITH_NAMESPACE_PREFIX, AXIS2_FAILURE); return AXIS2_FAILURE; } status = xmlTextWriterEndElement(writer_impl->xml_writer); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_EMPTY_ELEMENT_WITH_NAMESPACE_PREFIX, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_empty_element( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * localname) { int status = 0; axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, localname, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterStartElement(writer_impl->xml_writer, (xmlChar *)localname); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_EMPTY_ELEMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } status = xmlTextWriterEndElement(writer_impl->xml_writer); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_EMPTY_ELEMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
AXIS2_EXTERN axutil_stream_t *AXIS2_CALL axutil_stream_create_ssl( const axutil_env_t * env, axis2_socket_t sockt, axis2_char_t * server_cert, axis2_char_t * key_file, axis2_char_t * ssl_pp) { ssl_stream_impl_t *stream_impl = NULL; stream_impl = (ssl_stream_impl_t *) AXIS2_MALLOC(env->allocator, sizeof(ssl_stream_impl_t)); if (!stream_impl) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset ((void *)stream_impl, 0, sizeof (ssl_stream_impl_t)); stream_impl->socket = sockt; stream_impl->ctx = NULL; stream_impl->ssl = NULL; stream_impl->ctx = axis2_ssl_utils_initialize_ctx(env, server_cert, key_file, ssl_pp); if (!stream_impl->ctx) { axis2_ssl_stream_free((axutil_stream_t *) stream_impl, env); AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SSL_ENGINE, AXIS2_FAILURE); return NULL; } stream_impl->ssl = axis2_ssl_utils_initialize_ssl(env, stream_impl->ctx, stream_impl->socket); if (!stream_impl->ssl) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SSL_ENGINE, AXIS2_FAILURE); return NULL; } stream_impl->stream_type = AXIS2_STREAM_MANAGED; axutil_stream_set_read(&(stream_impl->stream), env, axis2_ssl_stream_read); axutil_stream_set_write(&(stream_impl->stream), env, axis2_ssl_stream_write); axutil_stream_set_skip(&(stream_impl->stream), env, axis2_ssl_stream_skip); return &(stream_impl->stream); }
AXIS2_EXTERN axis2_http_out_transport_info_t *AXIS2_CALL axis2_http_out_transport_info_create( const axutil_env_t * env, axis2_http_simple_response_t * response) { axis2_http_out_transport_info_t *http_out_transport_info = NULL; http_out_transport_info = (axis2_http_out_transport_info_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_out_transport_info_t)); if(!http_out_transport_info) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset((void *)http_out_transport_info, 0, sizeof(axis2_http_out_transport_info_t)); http_out_transport_info->out_transport.ops = &ops_var; http_out_transport_info->response = response; http_out_transport_info->encoding = NULL; http_out_transport_info->set_char_encoding = NULL; http_out_transport_info->set_content_type = NULL; http_out_transport_info->set_cookie_header = NULL; http_out_transport_info->set_session = NULL; http_out_transport_info->free_function = NULL; http_out_transport_info->set_char_encoding = axis2_http_out_transport_info_impl_set_char_encoding; http_out_transport_info->set_content_type = axis2_http_out_transport_info_impl_set_content_type; http_out_transport_info->set_cookie_header = axis2_http_out_transport_info_impl_set_cookie_header; http_out_transport_info->set_session = axis2_http_out_transport_info_impl_set_session; http_out_transport_info->free_function = axis2_http_out_transport_info_impl_free; return http_out_transport_info; }
/* * Internal function. Not exposed to outside */ AXIS2_EXTERN axutil_stream_t *AXIS2_CALL axutil_stream_create_libcurl( const axutil_env_t * env, axis2_char_t * buffer, unsigned int size) { libcurl_stream_impl_t *stream_impl = NULL; AXIS2_PARAM_CHECK(env->error, buffer, NULL); stream_impl = (libcurl_stream_impl_t *) AXIS2_MALLOC(env->allocator, sizeof(libcurl_stream_impl_t)); if (!stream_impl) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } stream_impl->buffer = buffer; stream_impl->size = size; stream_impl->read_len = 0; stream_impl->stream_type = AXIS2_STREAM_MANAGED; axutil_stream_set_read(&(stream_impl->stream), env, libcurl_stream_read); axutil_stream_set_write(&(stream_impl->stream), env, libcurl_stream_write); axutil_stream_set_skip(&(stream_impl->stream), env, libcurl_stream_skip); return &(stream_impl->stream); }
int AXIS2_CALL axis2_ssl_stream_skip( axutil_stream_t * stream, const axutil_env_t * env, int count) { ssl_stream_impl_t *stream_impl = NULL; axis2_char_t *tmp_buffer = NULL; int len = -1; if (count < 0) { return -1; } stream_impl = AXIS2_INTF_TO_IMPL(stream); tmp_buffer = AXIS2_MALLOC(env->allocator, (size_t)count * sizeof(axis2_char_t)); if (tmp_buffer == NULL) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return -1; } SSL_set_mode(stream_impl->ssl, SSL_MODE_AUTO_RETRY); len = SSL_read(stream_impl->ssl, tmp_buffer, count); AXIS2_FREE(env->allocator, tmp_buffer); return len; }
AXIS2_EXTERN savan_filter_mod_t * AXIS2_CALL savan_filter_mod_create( const axutil_env_t *env, axis2_conf_t *conf) { savan_xpath_filter_mod_t *filtermodimpl = NULL; axis2_char_t *filter_template_path = NULL; filtermodimpl = AXIS2_MALLOC(env->allocator, sizeof(savan_xpath_filter_mod_t)); if (!filtermodimpl) { AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_CREATION_FAILED, AXIS2_FAILURE); return NULL; } memset ((void *) filtermodimpl, 0, sizeof(savan_xpath_filter_mod_t)); filter_template_path = savan_util_get_module_param(env, conf, SAVAN_FILTER_TEMPLATE_PATH); if(!filter_template_path) { savan_xpath_filter_mod_free((savan_filter_mod_t *) filtermodimpl, env); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Filter template path not set"); return NULL; } filtermodimpl->filter_template_path = filter_template_path; filtermodimpl->dialect = NULL; filtermodimpl->conf = conf; filtermodimpl->filtermod.ops = &savan_filter_mod_ops; return (savan_filter_mod_t *) filtermodimpl; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_end_element( axiom_xml_writer_t * writer, const axutil_env_t * env) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); writer_impl->in_start_element = AXIS2_FALSE; /* write an empty element in case the element is empty, status = xmlTextWriterFullEndElement(writer_impl->xml_writer); Above call write it like <a></a>. Call below will write it like <a/> */ status = xmlTextWriterEndElement(writer_impl->xml_writer); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_END_ELEMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_char_t *AXIS2_CALL axis2_http_request_line_to_string( axis2_http_request_line_t * request_line, const axutil_env_t * env) { int alloc_len = 0; axis2_char_t *ret = NULL; alloc_len = axutil_strlen(request_line->method) + axutil_strlen(request_line->uri) + axutil_strlen(request_line->http_version) + 6; /* 5 = 2 * spaces + '/' +CR + LF + '\0' */ ret = AXIS2_MALLOC(env->allocator, alloc_len * sizeof(axis2_char_t)); if (!ret) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } if (request_line->uri[0] != AXIS2_F_SLASH) { sprintf(ret, "%s /%s %s%s", request_line->method, request_line->uri, request_line->http_version, AXIS2_HTTP_CRLF); } else { sprintf(ret, "%s %s %s%s", request_line->method, request_line->uri, request_line->http_version, AXIS2_HTTP_CRLF); } return ret; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_default_namespace( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * namespace_uri) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; axis2_char_t *xmlns = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, namespace_uri, AXIS2_FAILURE) xmlns = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * (strlen("xmlns") + 1)); sprintf(xmlns, "xmlns"); status = xmlTextWriterWriteAttribute(writer_impl->xml_writer, (const xmlChar *) xmlns, BAD_CAST namespace_uri); if(xmlns) { AXIS2_FREE(env->allocator, xmlns); xmlns = NULL; } if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_DEFAULT_NAMESPACE, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_attribute_with_namespace_prefix( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * localname, axis2_char_t * value, axis2_char_t * namespace_uri, axis2_char_t * prefix) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, localname, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, namespace_uri, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, prefix, AXIS2_FAILURE); if(!value) { value = ""; } writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterWriteAttributeNS(writer_impl->xml_writer, BAD_CAST prefix, BAD_CAST localname, BAD_CAST NULL, BAD_CAST value); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_ATTRIBUTE_WITH_NAMESPACE_PREFIX, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_simple_http_svr_conn_t *AXIS2_CALL axis2_simple_http_svr_conn_create( const axutil_env_t * env, int sockfd) { axis2_simple_http_svr_conn_t *svr_conn = NULL; svr_conn = (axis2_simple_http_svr_conn_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_simple_http_svr_conn_t)); if(!svr_conn) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "server connection failed. Insufficient memory"); return NULL; } memset((void *)svr_conn, 0, sizeof(axis2_simple_http_svr_conn_t)); svr_conn->socket = sockfd; if(-1 != svr_conn->socket) { svr_conn->stream = axutil_stream_create_socket(env, svr_conn->socket); if(!svr_conn->stream) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "socket creation failed, socket %d", sockfd); axis2_simple_http_svr_conn_free(svr_conn, env); return NULL; } } return svr_conn; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_attribute( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * localname, axis2_char_t * value) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, localname, AXIS2_FAILURE); if(!value) { value = ""; } writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterWriteAttribute(writer_impl->xml_writer, BAD_CAST localname, BAD_CAST value); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_ATTRIBUTE, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_http_request_line_t *AXIS2_CALL axis2_http_request_line_create( const axutil_env_t * env, const axis2_char_t * method, const axis2_char_t * uri, const axis2_char_t * http_version) { axis2_http_request_line_t *request_line = NULL; AXIS2_PARAM_CHECK(env->error, method, NULL); AXIS2_PARAM_CHECK(env->error, uri, NULL); AXIS2_PARAM_CHECK(env->error, http_version, NULL); request_line = (axis2_http_request_line_t *) AXIS2_MALLOC (env->allocator, sizeof(axis2_http_request_line_t)); if (!request_line) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset ((void *)request_line, 0, sizeof (axis2_http_request_line_t)); request_line->method = (axis2_char_t *) axutil_strdup(env, method); request_line->uri = (axis2_char_t *) axutil_strdup(env, uri); request_line->http_version = (axis2_char_t *) axutil_strdup(env, http_version); return request_line; }
AXIS2_EXTERN axis2_http_status_line_t *AXIS2_CALL axis2_http_status_line_create_with_values( const axutil_env_t * env, const axis2_char_t * http_ver, const int status_code, const axis2_char_t * phrase) { axis2_http_status_line_t *status_line = NULL; status_line = (axis2_http_status_line_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_status_line_t)); if(!status_line) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset((void *)status_line, 0, sizeof(axis2_http_status_line_t)); status_line->status_code = AXIS2_MALLOC(env->allocator, 6 * sizeof(axis2_char_t *)); if(!status_line->status_code) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); axis2_http_status_line_free(status_line, env); return NULL; } sprintf(status_line->status_code, "%3d", status_code); status_line->http_version = axutil_strdup(env, http_ver); status_line->reason_phrase = axutil_strdup(env, phrase); if(!status_line->http_version || !status_line->reason_phrase) { axis2_http_status_line_free(status_line, env); AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } status_line->line = axutil_strcat(env, http_ver, " ", status_line->status_code, " ", phrase, AXIS2_HTTP_CRLF, NULL); if(!status_line->line) { axis2_http_status_line_free(status_line, env); AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } return status_line; }
AXIS2_EXTERN axiom_xml_writer_t *AXIS2_CALL axiom_xml_writer_create( const axutil_env_t * env, axis2_char_t * filename, axis2_char_t * encoding, int is_prefix_default, int compression) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; AXIS2_ENV_CHECK(env, NULL); writer_impl = (axis2_libxml2_writer_wrapper_impl_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_libxml2_writer_wrapper_impl_t)); if(!writer_impl) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create an XML writer wrapper"); return NULL; } writer_impl->xml_writer = xmlNewTextWriterFilename(filename, compression); if(!(writer_impl->xml_writer)) { AXIS2_FREE(env->allocator, writer_impl); AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_CREATING_XML_STREAM_WRITER, AXIS2_FAILURE); return NULL; } writer_impl->buffer = NULL; writer_impl->encoding = NULL; writer_impl->compression = 0; writer_impl->in_empty_element = AXIS2_FALSE; writer_impl->in_start_element = AXIS2_FALSE; writer_impl->stack = NULL; writer_impl->uri_prefix_map = NULL; writer_impl->default_lang_namespace = NULL; writer_impl->writer_type = AXIS2_XML_PARSER_TYPE_FILE; writer_impl->compression = compression; if(encoding) { writer_impl->encoding = axutil_strdup(env, encoding); } else { writer_impl->encoding = axutil_strdup(env, ENCODING); } writer_impl->uri_prefix_map = axutil_hash_make(env); if(!(writer_impl->uri_prefix_map)) { axis2_libxml2_writer_wrapper_free(&(writer_impl->writer), env); AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create URI prefix hash map"); return NULL; } writer_impl->writer.ops = &axiom_xml_writer_ops_var; return &(writer_impl->writer); }
AXIS2_EXTERN axis2_http_simple_request_t *AXIS2_CALL axis2_simple_http_svr_conn_read_request( axis2_simple_http_svr_conn_t * svr_conn, const axutil_env_t * env) { axis2_char_t* str_line = NULL; axis2_bool_t end_of_headers = AXIS2_FALSE; axis2_http_request_line_t *request_line = NULL; axis2_http_simple_request_t *request = NULL; /* read first line of the request (which is <HTTP METHOD> <URI> <HTTP VERSION> CRLF */ str_line = axis2_simple_http_svr_conn_read_line(svr_conn, env); if(str_line) { request_line = axis2_http_request_line_parse_line(env, str_line); AXIS2_FREE(env->allocator, str_line); str_line = NULL; } if(!request_line) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE); return NULL; } request = axis2_http_simple_request_create(env, request_line, NULL, 0, svr_conn->stream); /* now read the headers until we find a line only having CRLF */ while(AXIS2_FALSE == end_of_headers) { str_line = axis2_simple_http_svr_conn_read_line(svr_conn, env); if(!str_line) { /*if nothing is read, this loop should be broken. Otherwise, going to be endless loop */ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "reading http header failed"); break; } if(0 == axutil_strcmp(str_line, AXIS2_HTTP_CRLF)) { /* line contains only CRLF, so should be end of headers */ end_of_headers = AXIS2_TRUE; } else { axis2_http_header_t *tmp_header = axis2_http_header_create_by_str(env, str_line); if(tmp_header) { axis2_http_simple_request_add_header(request, env, tmp_header); } } AXIS2_FREE(env->allocator, str_line); str_line = NULL; } return request; }
AXIS2_EXTERN axis2_transport_receiver_t *AXIS2_CALL axis2_udp_receiver_create( const axutil_env_t * env, const axis2_char_t * repo, const int port, axis2_char_t *multicast_group) { axis2_udp_receiver_impl_t *receiver = NULL; receiver = (axis2_udp_receiver_impl_t *) AXIS2_MALLOC(env->allocator, sizeof(axis2_udp_receiver_impl_t)); if (!receiver) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } receiver->is_multicast = AXIS2_FALSE; receiver->conf_ctx = NULL; receiver->conf_ctx_private = NULL; receiver->port = port; receiver->udp_receiver.ops = &udp_transport_recvr_ops; receiver->multicast_group = multicast_group; receiver->socket = AXIS2_INVALID_SOCKET; receiver->send_socket = AXIS2_INVALID_SOCKET; receiver->owns_socket = AXIS2_TRUE; receiver->max_packet_size = AXIS2_UDP_PACKET_MAX_SIZE; if (multicast_group) { receiver->is_multicast = AXIS2_TRUE; } receiver->mutex = axutil_thread_mutex_create(env->allocator, AXIS2_THREAD_MUTEX_DEFAULT); /* * We are creating the receiver in two instances. When we create the receiver from the server * we create the conf context. If we are creating the receiver while creating the conf we are * not creating the conf as conf is already there. */ if (repo) { receiver->conf_ctx_private = axis2_build_conf_ctx(env, repo); if (!receiver->conf_ctx_private) { AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "unable to create private configuration context for repo path %s", repo); axis2_udp_receiver_free((axis2_transport_receiver_t *) receiver, env); return NULL; } receiver->conf_ctx = receiver->conf_ctx_private; } axutil_thread_mutex_lock(receiver->mutex); return &(receiver->udp_receiver); }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axiom_soap_fault_text_set_base_node( axiom_soap_fault_text_t * fault_text, const axutil_env_t * env, axiom_node_t * node) { if(node && (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_BASE_TYPE, AXIS2_FAILURE); return AXIS2_FAILURE; } fault_text->om_ele_node = node; return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_status_t AXIS2_CALL axiom_soap_fault_code_set_base_node( axiom_soap_fault_code_t * fault_code, const axutil_env_t * env, axiom_node_t * node) { AXIS2_PARAM_CHECK(env->error, node, AXIS2_FAILURE); if(axiom_node_get_node_type(node, env) != AXIOM_ELEMENT) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_BASE_TYPE, AXIS2_FAILURE); return AXIS2_FAILURE; } fault_code->om_ele_node = node; return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_end_document( axiom_xml_writer_t * writer, const axutil_env_t * env) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterEndDocument(writer_impl->xml_writer); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_END_DOCUMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
/** need to work on this */ axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_namespace( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * prefix, axis2_char_t * namespace_uri) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; char *xmlnsprefix = NULL; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, namespace_uri, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); if(prefix && (axutil_strcmp(prefix, "") != 0)) { xmlnsprefix = (axis2_char_t *)AXIS2_MALLOC(env->allocator, (sizeof(char) * (axutil_strlen( prefix) + 7))); sprintf(xmlnsprefix, "xmlns:%s", prefix); } else { xmlnsprefix = axutil_strdup(env, "xmlns"); } status = xmlTextWriterWriteAttribute(writer_impl->xml_writer, BAD_CAST xmlnsprefix, BAD_CAST namespace_uri); AXIS2_FREE(env->allocator, xmlnsprefix); xmlnsprefix = NULL; if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_ATTRIBUTE_WITH_NAMESPACE_PREFIX, AXIS2_FAILURE); return AXIS2_FAILURE; } AXIS2_FREE(env->allocator, xmlnsprefix); xmlnsprefix = NULL; return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_http_response_writer_t *AXIS2_CALL axis2_http_response_writer_create_with_encoding( const axutil_env_t * env, axutil_stream_t * stream, const axis2_char_t * encoding) { axis2_http_response_writer_t *response_writer = NULL; response_writer = (axis2_http_response_writer_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_response_writer_t)); if(!response_writer) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } response_writer->stream = stream; response_writer->encoding = (axis2_char_t *)axutil_strdup(env, encoding); return response_writer; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_dtd( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * dtd) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, dtd, AXIS2_FAILURE); status = xmlTextWriterStartDTD(writer_impl->xml_writer, BAD_CAST dtd, NULL, NULL); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_DTD, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_raw( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * content) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, content, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterWriteRaw(writer_impl->xml_writer, BAD_CAST content); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_DATA_SOURCE, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_start_document_with_version_encoding( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * encoding, axis2_char_t * version) { axis2_libxml2_writer_wrapper_impl_t *wrapper_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); wrapper_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterStartDocument(wrapper_impl->xml_writer, version, encoding, NULL); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_START_DOCUMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_comment( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * value) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterWriteComment(writer_impl->xml_writer, BAD_CAST value); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_COMMENT, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
axis2_status_t AXIS2_CALL axis2_libxml2_writer_wrapper_write_processing_instruction( axiom_xml_writer_t * writer, const axutil_env_t * env, axis2_char_t * target) { axis2_libxml2_writer_wrapper_impl_t *writer_impl = NULL; int status = 0; AXIS2_ENV_CHECK(env, AXIS2_FAILURE); AXIS2_PARAM_CHECK(env->error, target, AXIS2_FAILURE); writer_impl = AXIS2_INTF_TO_IMPL(writer); status = xmlTextWriterStartPI(writer_impl->xml_writer, BAD_CAST target); if(status < 0) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_PROCESSING_INSTRUCTION, AXIS2_FAILURE); return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
AXIS2_EXTERN axis2_http_client_t *AXIS2_CALL axis2_http_client_create( const axutil_env_t * env, axutil_url_t * url) { axis2_http_client_t *http_client = NULL; http_client = (axis2_http_client_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_client_t)); if(!http_client) { AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); return NULL; } memset(http_client, 0, sizeof(axis2_http_client_t)); http_client->url = url; http_client->data_stream = NULL; http_client->owns_stream = AXIS2_FALSE; http_client->sockfd = -1; http_client->response = NULL; http_client->request_sent = AXIS2_FALSE; /* default timeout is 60000 milliseconds */ http_client->timeout = AXIS2_HTTP_DEFAULT_CONNECTION_TIMEOUT; http_client->proxy_enabled = AXIS2_FALSE; http_client->proxy_port = 0; http_client->proxy_host = NULL; http_client->proxy_host_port = NULL; http_client->dump_input_msg = AXIS2_FALSE; http_client->server_cert = NULL; http_client->key_file = NULL; http_client->req_body = NULL; http_client->req_body_size = 0; http_client->mime_parts = NULL; http_client->doing_mtom = AXIS2_FALSE; http_client->mtom_sending_callback_name = NULL; return http_client; }
AXIS2_EXTERN savan_publisher_t * AXIS2_CALL savan_publisher_create_with_conf( const axutil_env_t *env, axis2_conf_t *conf) { savan_default_publisher_t *publishermodimpl = NULL; publishermodimpl = AXIS2_MALLOC(env->allocator, sizeof(savan_default_publisher_t)); if (!publishermodimpl) { AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_CREATION_FAILED, AXIS2_FAILURE); return NULL; } memset ((void *) publishermodimpl, 0, sizeof(savan_default_publisher_t)); publishermodimpl->conf = conf; publishermodimpl->publishermod.ops = &savan_publisher_ops; return (savan_publisher_t *) publishermodimpl; }