/** * Following block distinguish the exposed part of the dll. */ AXIS2_EXPORT int axis2_get_instance( struct axis2_transport_receiver **inst, const axutil_env_t * env) { *inst = axis2_tcp_server_create(env, NULL, -1); if (!(*inst)) { return AXIS2_FAILURE; } return AXIS2_SUCCESS; }
int main( int argc, char *argv[]) { axutil_allocator_t *allocator = NULL; axutil_env_t *env = NULL; extern char *optarg; extern int optopt; int c; int log_file_size = AXUTIL_LOG_FILE_SIZE; axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG; const axis2_char_t *log_file = AXIS2_TCP_SERVER_LOG_FILE_NAME; int port = AXIS2_TCP_SERVER_PORT; const axis2_char_t *repo_path = AXIS2_TCP_SERVER_REPO_PATH; while((c = AXIS2_GETOPT(argc, argv, ":p:r:ht:l:s:f:")) != -1) { switch(c) { case 'p': port = AXIS2_ATOI(optarg); break; case 'r': repo_path = optarg; break; case 't': axis2_tcp_socket_read_timeout = AXIS2_ATOI(optarg) * 1000; break; case 'l': log_level = AXIS2_ATOI(optarg); if(log_level < AXIS2_LOG_LEVEL_CRITICAL) log_level = AXIS2_LOG_LEVEL_CRITICAL; if(log_level > AXIS2_LOG_LEVEL_TRACE) log_level = AXIS2_LOG_LEVEL_TRACE; break; case 's': log_file_size = 1024 * 1024 * AXIS2_ATOI(optarg); break; case 'f': log_file = optarg; break; case 'h': usage(argv[0]); return 0; case ':': fprintf(stderr, "\nOption -%c requires an operand\n", optopt); usage(argv[0]); return -1; case '?': if(isprint(optopt)) fprintf(stderr, "\nUnknown option `-%c'.\n", optopt); usage(argv[0]); return -1; } } allocator = axutil_allocator_init(NULL); if(!allocator) { system_exit(NULL, -1); } env = init_syetem_env(allocator, log_file); env->log->level = log_level; env->log->size = log_file_size; axutil_error_init(); system_env = env; #ifndef WIN32 signal(SIGINT, sig_handler); signal(SIGPIPE, sig_handler); #endif AXIS2_LOG_INFO(env->log, "Starting Axis2 TCP server...."); AXIS2_LOG_INFO(env->log, "Server port : %d", port); AXIS2_LOG_INFO(env->log, "Repo location : %s", repo_path); AXIS2_LOG_INFO(env->log, "Read Timeout : %d ms", axis2_tcp_socket_read_timeout); server = axis2_tcp_server_create(env, repo_path, port); if(!server) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Server creation failed: Error code:" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); system_exit(env, -1); } printf("Started Simple Axis2 TCP Server ...\n"); if(axis2_transport_receiver_start(server, env) == AXIS2_FAILURE) { AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Server start failed: Error code:" " %d :: %s", env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error)); system_exit(env, -1); } return 0; }