summaryrefslogtreecommitdiffstats
path: root/examples/csoap
diff options
context:
space:
mode:
authorGravatar m0gg2006-11-23 15:27:32 +0000
committerGravatar m0gg2006-11-23 15:27:32 +0000
commit6457c46897d6e0c63476bf4ba4ca14b4844fac0d (patch)
treeb1f892f4f1d7cb58ff50660c73947847447a14ce /examples/csoap
parent06906cd337028c9e42e10916d08db64e1e22d0f1 (diff)
downloadcsoap-6457c46897d6e0c63476bf4ba4ca14b4844fac0d.tar.gz
csoap-6457c46897d6e0c63476bf4ba4ca14b4844fac0d.tar.bz2
Code cleanup
Diffstat (limited to 'examples/csoap')
-rwxr-xr-xexamples/csoap/echoattachments-client.c33
-rwxr-xr-xexamples/csoap/echoattachments-server.c18
-rw-r--r--examples/csoap/simpleclient.c20
-rw-r--r--examples/csoap/simpleserver.c15
-rw-r--r--examples/csoap/soapclient.c24
5 files changed, 38 insertions, 72 deletions
diff --git a/examples/csoap/echoattachments-client.c b/examples/csoap/echoattachments-client.c
index b128563..26c65ff 100755
--- a/examples/csoap/echoattachments-client.c
+++ b/examples/csoap/echoattachments-client.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: echoattachments-client.c,v 1.13 2006/11/21 20:58:59 m0gg Exp $
+ * $Id: echoattachments-client.c,v 1.14 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -20,30 +20,22 @@
*
* Email: ferhatayaz@yahoo.com
******************************************************************/
-#include <sys/time.h>
#include <stdio.h>
-#include <netinet/in.h>
+#include <stdlib.h>
#include <libxml/tree.h>
#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-socket.h>
-#include <nanohttp/nanohttp-stream.h>
-#include <nanohttp/nanohttp-request.h>
-#include <nanohttp/nanohttp-response.h>
-#include <nanohttp/nanohttp-client.h>
#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-env.h>
#include <libcsoap/soap-ctx.h>
#include <libcsoap/soap-client.h>
-
static const char *urn = "urn:examples";
static const char *url = "http://localhost:10000/echoattachments";
static const char *method = "echo";
-
void
compareFiles(const char *received, const char *sent)
{
@@ -116,14 +108,13 @@ compareFiles(const char *received, const char *sent)
}
int
-main(int argc, char *argv[])
+main(int argc, char **argv)
{
- SoapCtx *ctx, *ctx2;
+ struct SoapCtx *ctx, *ctx2;
char href[MAX_HREF_SIZE];
xmlNodePtr fault;
herror_t err;
-
if (argc < 2)
{
fprintf(stderr, "usage: %s <filename> [url]\n", argv[0]);
@@ -135,8 +126,7 @@ main(int argc, char *argv[])
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));
+ printf("[%d] %s():%s ", herror_code(err), herror_func(err), herror_message(err));
herror_release(err);
return 1;
}
@@ -146,8 +136,7 @@ main(int argc, char *argv[])
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));
+ printf("[%d] %s():%s ", herror_code(err), herror_func(err), herror_message(err));
herror_release(err);
return 1;
}
@@ -157,8 +146,7 @@ main(int argc, char *argv[])
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));
+ printf("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err));
herror_release(err);
return 1;
}
@@ -177,8 +165,7 @@ main(int argc, char *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;
}
@@ -188,7 +175,7 @@ main(int argc, char *argv[])
fault = soap_env_get_fault(ctx2->env);
if (fault)
{
- soap_xml_doc_print(ctx2->env->root->doc);
+ xmlDocDump(stdout, ctx2->env->root->doc);
}
else if (ctx2->attachments)
{
@@ -197,7 +184,7 @@ main(int argc, char *argv[])
else
{
printf("No attachments!");
- soap_xml_doc_print(ctx2->env->root->doc);
+ xmlDocDump(stdout, ctx2->env->root->doc);
}
/*
diff --git a/examples/csoap/echoattachments-server.c b/examples/csoap/echoattachments-server.c
index a065cc5..abfb7ec 100755
--- a/examples/csoap/echoattachments-server.c
+++ b/examples/csoap/echoattachments-server.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: echoattachments-server.c,v 1.10 2006/11/21 20:58:59 m0gg Exp $
+ * $Id: echoattachments-server.c,v 1.11 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -22,16 +22,10 @@
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
-#include <netinet/in.h>
#include <libxml/tree.h>
#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-socket.h>
-#include <nanohttp/nanohttp-stream.h>
-#include <nanohttp/nanohttp-request.h>
-#include <nanohttp/nanohttp-response.h>
-#include <nanohttp/nanohttp-server.h>
#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-env.h>
@@ -45,7 +39,7 @@ static const char *urn = "urn:examples";
static const char *method = "echo";
herror_t
-echo_attachments(SoapCtx * req, SoapCtx * res)
+echo_attachments(struct SoapCtx * req, struct SoapCtx * res)
{
herror_t err;
@@ -70,20 +64,18 @@ echo_attachments(SoapCtx * req, SoapCtx * res)
return H_OK;
}
-
int
-main(int argc, char *argv[])
+main(int argc, char **argv)
{
herror_t err;
- SoapRouter *router;
+ struct SoapRouter *router;
hlog_set_level(HLOG_VERBOSE);
err = soap_server_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;
}
diff --git a/examples/csoap/simpleclient.c b/examples/csoap/simpleclient.c
index 6a4451e..1e3b3ff 100644
--- a/examples/csoap/simpleclient.c
+++ b/examples/csoap/simpleclient.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleclient.c,v 1.14 2006/11/21 20:58:59 m0gg Exp $
+ * $Id: simpleclient.c,v 1.15 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -22,18 +22,14 @@
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
-#include <netinet/in.h>
#include <libxml/tree.h>
#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-socket.h>
-#include <nanohttp/nanohttp-stream.h>
-#include <nanohttp/nanohttp-request.h>
-#include <nanohttp/nanohttp-response.h>
-#include <nanohttp/nanohttp-client.h>
#include <nanohttp/nanohttp-logging.h>
+#include <libcsoap/soap-ctx.h>
+#include <libcsoap/soap-env.h>
#include <libcsoap/soap-client.h>
static char *url = "http://localhost:10000/csoapserver";
@@ -41,12 +37,12 @@ static char *urn = "urn:examples";
static char *method = "sayHello";
int
-main(int argc, char *argv[])
+main(int argc, char **argv)
{
- SoapCtx *ctx, *ctx2;
+ struct SoapCtx *ctx, *ctx2;
herror_t err;
- // hlog_set_level(HLOG_VERBOSE);
+ hlog_set_level(HLOG_VERBOSE);
err = soap_client_init_args(argc, argv);
if (err != H_OK)
@@ -67,7 +63,7 @@ main(int argc, char *argv[])
soap_env_add_item(ctx->env, "xsd:string", "name", "Jonny B. Good");
printf("**** sending ****\n");
- soap_xml_doc_print(ctx->env->root->doc);
+ xmlDocDump(stderr, ctx->env->root->doc);
if (argc > 1)
url = argv[1];
@@ -82,7 +78,7 @@ main(int argc, char *argv[])
}
printf("**** received ****\n");
- soap_xml_doc_print(ctx2->env->root->doc);
+ xmlDocDump(stdout, ctx2->env->root->doc);
soap_ctx_free(ctx2);
soap_ctx_free(ctx);
diff --git a/examples/csoap/simpleserver.c b/examples/csoap/simpleserver.c
index a433783..c67d0e5 100644
--- a/examples/csoap/simpleserver.c
+++ b/examples/csoap/simpleserver.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: simpleserver.c,v 1.21 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: simpleserver.c,v 1.22 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: CSOAP examples project
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -22,16 +22,11 @@
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
-#include <netinet/in.h>
#include <libxml/tree.h>
+#include <libxml/xpath.h>
#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-socket.h>
-#include <nanohttp/nanohttp-stream.h>
-#include <nanohttp/nanohttp-request.h>
-#include <nanohttp/nanohttp-response.h>
-#include <nanohttp/nanohttp-server.h>
#include <nanohttp/nanohttp-logging.h>
#include <libcsoap/soap-xml.h>
@@ -46,7 +41,7 @@ static const char const *urn = "urn:examples";
static const char const *method = "sayHello";
herror_t
-say_hello(SoapCtx * req, SoapCtx * res)
+say_hello(struct SoapCtx *req, struct SoapCtx *res)
{
herror_t err;
char *name;
@@ -76,11 +71,11 @@ say_hello(SoapCtx * req, SoapCtx * res)
}
int
-main(int argc, char *argv[])
+main(int argc, char **argv)
{
herror_t err;
- SoapRouter *router;
+ struct SoapRouter *router;
// hlog_set_level(HLOG_VERBOSE);
diff --git a/examples/csoap/soapclient.c b/examples/csoap/soapclient.c
index c7d55f3..ea7d05f 100644
--- a/examples/csoap/soapclient.c
+++ b/examples/csoap/soapclient.c
@@ -7,19 +7,15 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <netinet/in.h>
#include <libxml/tree.h>
#include <libxml/uri.h>
#include <nanohttp/nanohttp-common.h>
-#include <nanohttp/nanohttp-socket.h>
-#include <nanohttp/nanohttp-stream.h>
-#include <nanohttp/nanohttp-request.h>
-#include <nanohttp/nanohttp-response.h>
-#include <nanohttp/nanohttp-client.h>
-#include <nanohttp/nanohttp-logging.h>
+// #include <nanohttp/nanohttp-request.h>
+// #include <nanohttp/nanohttp-response.h>
+// #include <nanohttp/nanohttp-client.h>
#include <libcsoap/soap-fault.h>
#include <libcsoap/soap-env.h>
@@ -128,7 +124,7 @@ stripcslashes(char *str, int *len)
// to the SOAP request
*/
void
-ParseLine(SoapCtx * ctx, char *Buffer, int LineLen)
+ParseLine(struct SoapCtx * ctx, char *Buffer, int LineLen)
{
char *Line, *FirstCommaPos, *SecondCommaPos;
int len;
@@ -191,7 +187,7 @@ printusage(char *FileName)
int
main(int argc, char *argv[])
{
- SoapCtx *ctx, *ctx2;
+ struct SoapCtx *ctx, *ctx2;
herror_t err;
/* create buffer */
@@ -211,7 +207,7 @@ main(int argc, char *argv[])
err = soap_client_init_args(argc, argv);
if (err != H_OK)
{
- log_error4("%s():%s [%d]", herror_func(err),
+ printf("%s():%s [%d]", herror_func(err),
herror_message(err), herror_code(err));
herror_release(err);
return 1;
@@ -221,7 +217,7 @@ main(int argc, char *argv[])
err = soap_ctx_new_with_method(argv[2], argv[3], &ctx);
if (err != H_OK)
{
- log_error4("%s():%s [%d]", herror_func(err),
+ printf("%s():%s [%d]", herror_func(err),
herror_message(err), herror_code(err));
herror_release(err);
return 1;
@@ -244,7 +240,7 @@ main(int argc, char *argv[])
bytes_left = strlen(Buffer);
if (bytes_left == MAX_LINE_LENGTH)
{
- log_error1("The parameter line is too long.");
+ printf("The parameter line is too long.");
herror_release(err);
soap_ctx_free(ctx);
return 1;
@@ -255,7 +251,7 @@ main(int argc, char *argv[])
err = soap_client_invoke(ctx, &ctx2, argv[1], "");
if (err != H_OK)
{
- log_error4("[%d] %s(): %s ", herror_code(err),
+ printf("[%d] %s(): %s ", herror_code(err),
herror_func(err), herror_message(err));
herror_release(err);
soap_ctx_free(ctx);
@@ -263,7 +259,7 @@ main(int argc, char *argv[])
}
/* print the result */
- soap_xml_doc_print(ctx2->env->root->doc);
+ xmlDocDump(stdout, ctx2->env->root->doc);
/* free the objects */
soap_ctx_free(ctx2);