From 15b392f1e21d3dae8f83da401199959e9f0b0db6 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Tue, 2 Nov 2004 22:42:51 +0000 Subject: develop --- Doxyfile | 4 ++-- examples/csoap/echoattachments-client.c | 41 +++++++++++++++++++++++++-------- examples/csoap/simpleclient.c | 3 ++- libcsoap/soap-client.c | 6 ++++- libcsoap/soap-client.h | 8 ++++++- libcsoap/soap-server.c | 5 ++-- nanohttp/nanohttp-client.c | 13 ++++++++++- nanohttp/nanohttp-client.h | 7 +++++- nanohttp/nanohttp-server.c | 5 ++-- 9 files changed, 72 insertions(+), 20 deletions(-) diff --git a/Doxyfile b/Doxyfile index 87d4b1a..16c48fe 100644 --- a/Doxyfile +++ b/Doxyfile @@ -336,7 +336,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = libcsoap/ +INPUT = libcsoap/ nanohttp/ # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -345,7 +345,7 @@ INPUT = libcsoap/ # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl -FILE_PATTERNS = soap-*.h +FILE_PATTERNS = soap-*.h nanohttp-*.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. diff --git a/examples/csoap/echoattachments-client.c b/examples/csoap/echoattachments-client.c index a6dfca7..0f57b6b 100755 --- a/examples/csoap/echoattachments-client.c +++ b/examples/csoap/echoattachments-client.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: echoattachments-client.c,v 1.6 2004/11/01 15:16:22 snowdrop Exp $ + * $Id: echoattachments-client.c,v 1.7 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: CSOAP examples project * Copyright (C) 2003-2004 Ferhat Ayaz @@ -96,7 +96,6 @@ int main(int argc, char *argv[]) char href[MAX_HREF_SIZE]; xmlNodePtr fault; herror_t err; - if (argc < 2) { @@ -104,7 +103,9 @@ int main(int argc, char *argv[]) exit(1); } - log_set_level(HLOG_VERBOSE); + /* + Initialize soap client + */ err = soap_client_init_args(argc, argv); if (err != H_OK) { log_error4("[%d] %s():%s ", herror_code(err), herror_func(err), herror_message(err)); @@ -112,20 +113,34 @@ int main(int argc, char *argv[]) return 1; } + /* + Create a context object + */ err = soap_ctx_new_with_method(urn, method, &ctx); if (err != H_OK) { log_error4("[%d] %s():%s ", herror_code(err), herror_func(err), herror_message(err)); herror_release(err); return 1; } - if (soap_ctx_add_file(ctx, argv[1], "application/octet-stream", href) != H_OK) { - fprintf(stderr, "Error while adding '%s'\n", argv[1]); - soap_ctx_free(ctx); - exit(1); - } - + + /* + Add file to the context + */ + err = soap_ctx_add_file(ctx, argv[1], "application/octet-stream", href); + if (err != H_OK) { + log_error4("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err)); + herror_release(err); + return 1; + } + + /* + Add file reference to the envelope + */ soap_env_add_attachment(ctx->env,"source", href); + /* + Send soap request to the server + */ printf("sending request ...\n"); if (argc > 2) err = soap_client_invoke(ctx, &ctx2, argv[2], ""); @@ -138,6 +153,9 @@ int main(int argc, char *argv[]) return 1; } + /* + Handle response (just print to the screen) + */ fault = soap_env_get_fault(ctx2->env); if (fault) { soap_xml_doc_print(ctx2->env->root->doc); @@ -148,9 +166,14 @@ int main(int argc, char *argv[]) soap_xml_doc_print(ctx2->env->root->doc); } + /* + Clean up + */ soap_ctx_free(ctx2); soap_ctx_free(ctx); + soap_client_destroy(); + return 0; } diff --git a/examples/csoap/simpleclient.c b/examples/csoap/simpleclient.c index ea9dcac..8c10d5f 100644 --- a/examples/csoap/simpleclient.c +++ b/examples/csoap/simpleclient.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: simpleclient.c,v 1.7 2004/11/01 15:16:22 snowdrop Exp $ + * $Id: simpleclient.c,v 1.8 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: CSOAP examples project * Copyright (C) 2003-2004 Ferhat Ayaz @@ -67,5 +67,6 @@ int main(int argc, char *argv[]) soap_ctx_free(ctx2); soap_ctx_free(ctx); + soap_client_destroy(); return 0; } diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index 21eb06a..bec9044 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.12 2004/11/01 15:16:26 snowdrop Exp $ +* $Id: soap-client.c,v 1.13 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -50,6 +50,10 @@ herror_t soap_client_init_args(int argc, char *argv[]) } +void soap_client_destroy() +{ + httpc_destroy(); +} static long _file_get_size(const char* filename) diff --git a/libcsoap/soap-client.h b/libcsoap/soap-client.h index 6826117..7042aad 100644 --- a/libcsoap/soap-client.h +++ b/libcsoap/soap-client.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-client.h,v 1.7 2004/11/01 15:16:26 snowdrop Exp $ + * $Id: soap-client.h,v 1.8 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -33,6 +33,12 @@ herror_t soap_client_init_args(int argc, char *argv[]); +/** + Destroy the soap client module +*/ +void soap_client_destroy(); + + /** Establish connection to the soap server and send the given envelope. diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c index 65bef3f..8313eb8 100644 --- a/libcsoap/soap-server.c +++ b/libcsoap/soap-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-server.c,v 1.7 2004/10/28 10:30:46 snowdrop Exp $ +* $Id: soap-server.c,v 1.8 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -100,7 +100,8 @@ void soap_server_destroy() free(node->context); free(node); node = tmp; - } + } + httpd_destroy(); } diff --git a/nanohttp/nanohttp-client.c b/nanohttp/nanohttp-client.c index 039fda4..814f0b4 100644 --- a/nanohttp/nanohttp-client.c +++ b/nanohttp/nanohttp-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-client.c,v 1.24 2004/10/29 09:27:05 snowdrop Exp $ +* $Id: nanohttp-client.c,v 1.25 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -55,6 +55,17 @@ httpc_init(int argc, char *argv[]) hsocket_module_init(); return H_OK; } + + +/*-------------------------------------------------- +FUNCTION: httpc_destroy +DESC: Destroy the http client module +----------------------------------------------------*/ +void httpc_destroy() +{ + hsocket_module_destroy(); +} + /*-------------------------------------------------- FUNCTION: httpc_new diff --git a/nanohttp/nanohttp-client.h b/nanohttp/nanohttp-client.h index b03c0a0..3e3f9c6 100644 --- a/nanohttp/nanohttp-client.h +++ b/nanohttp/nanohttp-client.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: nanohttp-client.h,v 1.12 2004/10/28 10:30:46 snowdrop Exp $ + * $Id: nanohttp-client.h,v 1.13 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -60,6 +60,11 @@ typedef struct httpc_conn */ herror_t httpc_init(int argc, char *argv[]); +/** + Destroy the httpc_* module +*/ +void httpc_destroy(); + /** Creates a new connection */ diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index 566a760..625bd79 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-server.c,v 1.29 2004/10/29 09:27:05 snowdrop Exp $ +* $Id: nanohttp-server.c,v 1.30 2004/11/02 22:42:52 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -706,7 +706,8 @@ void httpd_destroy() hservice_free(cur); cur = tmp; } - + + hsocket_module_destroy(); } #ifdef WIN32 -- cgit v1.1-32-gdbae