From c3fd98b25607d0f7f5977586d188f88ab226a9b8 Mon Sep 17 00:00:00 2001 From: m0gg Date: Tue, 21 Nov 2006 20:58:59 +0000 Subject: decoupling of nanohttp/libcsoap --- examples/csoap/simpleclient.c | 45 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'examples/csoap/simpleclient.c') diff --git a/examples/csoap/simpleclient.c b/examples/csoap/simpleclient.c index 47ffd32..6a4451e 100644 --- a/examples/csoap/simpleclient.c +++ b/examples/csoap/simpleclient.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: simpleclient.c,v 1.13 2006/11/19 09:40:14 m0gg Exp $ + * $Id: simpleclient.c,v 1.14 2006/11/21 20:58:59 m0gg Exp $ * * CSOAP Project: CSOAP examples project * Copyright (C) 2003-2004 Ferhat Ayaz @@ -20,10 +20,12 @@ * * Email: ferhatayaz@yahoo.com ******************************************************************/ -#include #include +#include #include +#include + #include #include #include @@ -34,11 +36,9 @@ #include - -static const char *url = "http://localhost:10000/csoapserver"; -static const char *urn = "urn:examples"; -static const char *method = "sayHello"; - +static char *url = "http://localhost:10000/csoapserver"; +static char *urn = "urn:examples"; +static char *method = "sayHello"; int main(int argc, char *argv[]) @@ -46,45 +46,48 @@ main(int argc, char *argv[]) SoapCtx *ctx, *ctx2; herror_t err; - /* log_set_level(HLOG_VERBOSE); */ + // hlog_set_level(HLOG_VERBOSE); + err = soap_client_init_args(argc, argv); if (err != H_OK) { - log_error4("%s():%s [%d]", herror_func(err), herror_message(err), - herror_code(err)); + printf("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err)); herror_release(err); - return 1; + exit(1); } err = soap_ctx_new_with_method(urn, method, &ctx); if (err != H_OK) { - log_error4("%s():%s [%d]", herror_func(err), herror_message(err), - herror_code(err)); + printf("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err)); herror_release(err); - return 1; + exit(1); } soap_env_add_item(ctx->env, "xsd:string", "name", "Jonny B. Good"); + printf("**** sending ****\n"); + soap_xml_doc_print(ctx->env->root->doc); + if (argc > 1) - err = soap_client_invoke(ctx, &ctx2, argv[1], ""); - else - err = soap_client_invoke(ctx, &ctx2, url, ""); + url = argv[1]; + printf("destination: \"%s\"\n", url); - if (err != H_OK) + if ((err = soap_client_invoke(ctx, &ctx2, url, "")) != H_OK) { - log_error4("[%d] %s(): %s ", herror_code(err), herror_func(err), - herror_message(err)); + printf("[%d] %s(): %s ", herror_code(err), herror_func(err), herror_message(err)); herror_release(err); soap_ctx_free(ctx); - return 1; + exit(1); } + printf("**** received ****\n"); soap_xml_doc_print(ctx2->env->root->doc); + soap_ctx_free(ctx2); soap_ctx_free(ctx); soap_client_destroy(); + return 0; } -- cgit v1.1-32-gdbae