summaryrefslogtreecommitdiffstats
path: root/libcsoap
diff options
context:
space:
mode:
authorGravatar snowdrop2006-01-10 11:29:04 +0000
committerGravatar snowdrop2006-01-10 11:29:04 +0000
commit07c7c81772c4b60b7980880847f3b21455a0f3c9 (patch)
treed7f8ea3508586842124684aa8f0b860f3a3a1c47 /libcsoap
parente96ea6884919f551111c32de0b63af4dff791f12 (diff)
downloadcsoap-07c7c81772c4b60b7980880847f3b21455a0f3c9.tar.gz
csoap-07c7c81772c4b60b7980880847f3b21455a0f3c9.tar.bz2
indent with 'indent -nut -bli0 -fca -npcs' command
Diffstat (limited to 'libcsoap')
-rw-r--r--libcsoap/soap-client.c146
-rw-r--r--libcsoap/soap-client.h14
-rwxr-xr-xlibcsoap/soap-ctx.c62
-rwxr-xr-xlibcsoap/soap-ctx.h18
-rw-r--r--libcsoap/soap-env.c315
-rw-r--r--libcsoap/soap-env.h66
-rw-r--r--libcsoap/soap-fault.c42
-rw-r--r--libcsoap/soap-fault.h8
-rw-r--r--libcsoap/soap-router.c38
-rw-r--r--libcsoap/soap-router.h16
-rw-r--r--libcsoap/soap-server.c261
-rw-r--r--libcsoap/soap-server.h10
-rw-r--r--libcsoap/soap-service.c38
-rw-r--r--libcsoap/soap-service.h14
-rw-r--r--libcsoap/soap-xml.c48
-rw-r--r--libcsoap/soap-xml.h16
16 files changed, 550 insertions, 562 deletions
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c
index d1599bd..f7c38c2 100644
--- a/libcsoap/soap-client.c
+++ b/libcsoap/soap-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-client.c,v 1.20 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-client.c,v 1.21 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -27,17 +27,17 @@
/*--------------------------------- */
static int _block_socket = 0;
-static herror_t _soap_client_build_result (hresponse_t * res, SoapEnv ** out);
+static herror_t _soap_client_build_result(hresponse_t * res, SoapEnv ** out);
/*--------------------------------- */
void
-soap_client_block_socket (int block)
+soap_client_block_socket(int block)
{
_block_socket = block;
}
int
-soap_client_get_blockmode ()
+soap_client_get_blockmode()
{
return _block_socket;
}
@@ -45,38 +45,38 @@ soap_client_get_blockmode ()
herror_t
-soap_client_init_args (int argc, char *argv[])
+soap_client_init_args(int argc, char *argv[])
{
- return httpc_init (argc, argv);
+ return httpc_init(argc, argv);
}
void
-soap_client_destroy ()
+soap_client_destroy()
{
- httpc_destroy ();
+ httpc_destroy();
}
static long
-_file_get_size (const char *filename)
+_file_get_size(const char *filename)
{
- FILE *f = fopen (filename, "r");
+ FILE *f = fopen(filename, "r");
long size;
if (!f)
return -1;
- fseek (f, 0, SEEK_END);
- size = ftell (f);
- fclose (f);
+ fseek(f, 0, SEEK_END);
+ size = ftell(f);
+ fclose(f);
return size;
}
herror_t
-soap_client_invoke (SoapCtx * call, SoapCtx ** response, const char *url,
- const char *soap_action)
+soap_client_invoke(SoapCtx * call, SoapCtx ** response, const char *url,
+ const char *soap_action)
{
/* Status */
herror_t status;
@@ -102,55 +102,55 @@ soap_client_invoke (SoapCtx * call, SoapCtx ** response, const char *url,
char href[MAX_HREF_SIZE];
/* Create buffer */
- buffer = xmlBufferCreate ();
- xmlNodeDump (buffer, call->env->root->doc, call->env->root, 1, 0);
- content = (char *) xmlBufferContent (buffer);
+ buffer = xmlBufferCreate();
+ xmlNodeDump(buffer, call->env->root->doc, call->env->root, 1, 0);
+ content = (char *) xmlBufferContent(buffer);
/* Transport via HTTP */
- conn = httpc_new ();
+ conn = httpc_new();
if (!conn)
{
- return herror_new ("soap_client_invoke", SOAP_ERROR_CLIENT_INIT,
- "Unable to create SOAP client!");
+ return herror_new("soap_client_invoke", SOAP_ERROR_CLIENT_INIT,
+ "Unable to create SOAP client!");
}
- conn->block = soap_client_get_blockmode ();
+ conn->block = soap_client_get_blockmode();
/* Set soap action */
if (soap_action != NULL)
{
- httpc_set_header (conn, "SoapAction", soap_action);
+ httpc_set_header(conn, "SoapAction", soap_action);
}
/* check for attachments */
if (!call->attachments)
{
/* content-type is always 'text/xml' */
- httpc_set_header (conn, HEADER_CONTENT_TYPE, "text/xml");
+ httpc_set_header(conn, HEADER_CONTENT_TYPE, "text/xml");
- sprintf (tmp, "%d", (int) strlen (content));
- httpc_set_header (conn, HEADER_CONTENT_LENGTH, tmp);
- status = httpc_post_begin (conn, url);
+ sprintf(tmp, "%d", (int) strlen(content));
+ httpc_set_header(conn, HEADER_CONTENT_LENGTH, tmp);
+ status = httpc_post_begin(conn, url);
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
- status = http_output_stream_write_string (conn->out, content);
+ status = http_output_stream_write_string(conn->out, content);
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
- status = httpc_post_end (conn, &res);
+ status = httpc_post_end(conn, &res);
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
}
@@ -158,72 +158,72 @@ soap_client_invoke (SoapCtx * call, SoapCtx ** response, const char *url,
{
/* Use chunked transport */
- httpc_set_header (conn, HEADER_TRANSFER_ENCODING,
- TRANSFER_ENCODING_CHUNKED);
+ httpc_set_header(conn, HEADER_TRANSFER_ENCODING,
+ TRANSFER_ENCODING_CHUNKED);
- sprintf (start_id, "289247829121218%d", counter++);
- status = httpc_mime_begin (conn, url, start_id, "", "text/xml");
+ sprintf(start_id, "289247829121218%d", counter++);
+ status = httpc_mime_begin(conn, url, start_id, "", "text/xml");
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
- status = httpc_mime_next (conn, start_id, "text/xml", "binary");
+ status = httpc_mime_next(conn, start_id, "text/xml", "binary");
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
- status = http_output_stream_write (conn->out, content, strlen (content));
+ status = http_output_stream_write(conn->out, content, strlen(content));
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
for (part = call->attachments->parts; part; part = part->next)
{
- status = httpc_mime_send_file (conn, part->id,
- part->content_type,
- part->transfer_encoding, part->filename);
+ status = httpc_mime_send_file(conn, part->id,
+ part->content_type,
+ part->transfer_encoding, part->filename);
if (status != H_OK)
{
- log_error2 ("Send file failed. Status:%d", status);
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ log_error2("Send file failed. Status:%d", status);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
}
- status = httpc_mime_end (conn, &res);
+ status = httpc_mime_end(conn, &res);
if (status != H_OK)
{
- httpc_close_free (conn);
- xmlBufferFree (buffer);
+ httpc_close_free(conn);
+ xmlBufferFree(buffer);
return status;
}
}
/* Free buffer */
- xmlBufferFree (buffer);
+ xmlBufferFree(buffer);
/* Build result */
- status = _soap_client_build_result (res, &res_env);
+ status = _soap_client_build_result(res, &res_env);
if (status != H_OK)
{
- hresponse_free (res);
- httpc_close_free (conn);
+ hresponse_free(res);
+ httpc_close_free(conn);
return status;
}
/* Create Context */
- *response = soap_ctx_new (res_env);
+ *response = soap_ctx_new(res_env);
/* soap_ctx_add_files(*response, res->attachments);*/
if (res->attachments != NULL)
@@ -231,7 +231,7 @@ soap_client_invoke (SoapCtx * call, SoapCtx ** response, const char *url,
part = res->attachments->parts;
while (part)
{
- soap_ctx_add_file (*response, part->filename, part->content_type, href);
+ soap_ctx_add_file(*response, part->filename, part->content_type, href);
part->deleteOnExit = 0;
part = part->next;
}
@@ -244,33 +244,33 @@ soap_client_invoke (SoapCtx * call, SoapCtx ** response, const char *url,
}
- hresponse_free (res);
- httpc_close_free (conn);
+ hresponse_free(res);
+ httpc_close_free(conn);
return H_OK;
}
static herror_t
-_soap_client_build_result (hresponse_t * res, SoapEnv ** env)
+_soap_client_build_result(hresponse_t * res, SoapEnv ** env)
{
herror_t err;
- log_verbose2 ("Building result (%p)", res);
+ log_verbose2("Building result (%p)", res);
if (res == NULL)
- return herror_new ("_soap_client_build_result",
- GENERAL_INVALID_PARAM, "hresponse_t is NULL");
+ return herror_new("_soap_client_build_result",
+ GENERAL_INVALID_PARAM, "hresponse_t is NULL");
if (res->in == NULL)
- return herror_new ("_soap_client_build_result",
- GENERAL_INVALID_PARAM, "Empty response from server");
+ return herror_new("_soap_client_build_result",
+ GENERAL_INVALID_PARAM, "Empty response from server");
if (res->errcode != 200)
- return herror_new ("_soap_client_build_result",
- GENERAL_INVALID_PARAM, "HTTP code is not 200 OK");
+ return herror_new("_soap_client_build_result",
+ GENERAL_INVALID_PARAM, "HTTP code is not 200 OK");
- err = soap_env_new_from_stream (res->in, env);
+ err = soap_env_new_from_stream(res->in, env);
if (err != H_OK)
{
diff --git a/libcsoap/soap-client.h b/libcsoap/soap-client.h
index 0795a29..43d1359 100644
--- a/libcsoap/soap-client.h
+++ b/libcsoap/soap-client.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-client.h,v 1.11 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-client.h,v 1.12 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -32,13 +32,13 @@
/**
Initializes the client side soap engine
*/
-herror_t soap_client_init_args (int argc, char *argv[]);
+herror_t soap_client_init_args(int argc, char *argv[]);
/**
Destroy the soap client module
*/
-void soap_client_destroy ();
+void soap_client_destroy();
/**
@@ -53,8 +53,8 @@ void soap_client_destroy ();
@returns H_OK if success
*/
-herror_t soap_client_invoke (SoapCtx * ctx, SoapCtx ** response,
- const char *url, const char *soap_action);
+herror_t soap_client_invoke(SoapCtx * ctx, SoapCtx ** response,
+ const char *url, const char *soap_action);
@@ -66,7 +66,7 @@ herror_t soap_client_invoke (SoapCtx * ctx, SoapCtx ** response,
@param block 1 to creat blocked sockets, 0 to create non
blocking sockets.
*/
-void soap_client_block_socket (int block);
-int soap_client_get_blockmode ();
+void soap_client_block_socket(int block);
+int soap_client_get_blockmode();
#endif
diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c
index b2d1db2..7edefc3 100755
--- a/libcsoap/soap-ctx.c
+++ b/libcsoap/soap-ctx.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.c,v 1.6 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-ctx.c,v 1.7 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -26,9 +26,9 @@
#include <string.h>
SoapCtx *
-soap_ctx_new (SoapEnv * env) /* should only be used internally */
+soap_ctx_new(SoapEnv * env) /* should only be used internally */
{
- SoapCtx *ctx = (SoapCtx *) malloc (sizeof (SoapCtx));
+ SoapCtx *ctx = (SoapCtx *) malloc(sizeof(SoapCtx));
ctx->env = env;
ctx->attachments = NULL;
@@ -37,7 +37,7 @@ soap_ctx_new (SoapEnv * env) /* should only be used internally */
void
-soap_ctx_add_files (SoapCtx * ctx, attachments_t * attachments)
+soap_ctx_add_files(SoapCtx * ctx, attachments_t * attachments)
{
part_t *part;
char href[MAX_HREF_SIZE];
@@ -48,43 +48,43 @@ soap_ctx_add_files (SoapCtx * ctx, attachments_t * attachments)
part = attachments->parts;
while (part)
{
- soap_ctx_add_file (ctx, part->filename, part->content_type, href);
+ soap_ctx_add_file(ctx, part->filename, part->content_type, href);
part = part->next;
}
}
herror_t
-soap_ctx_add_file (SoapCtx * ctx, const char *filename,
- const char *content_type, char *dest_href)
+soap_ctx_add_file(SoapCtx * ctx, const char *filename,
+ const char *content_type, char *dest_href)
{
char cid[250];
char id[250];
part_t *part;
static int counter = 1;
- FILE *test = fopen (filename, "r");
+ FILE *test = fopen(filename, "r");
if (!test)
- return herror_new ("soap_ctx_add_file", FILE_ERROR_OPEN,
- "Can not open file '%s'", filename);
+ return herror_new("soap_ctx_add_file", FILE_ERROR_OPEN,
+ "Can not open file '%s'", filename);
- fclose (test);
+ fclose(test);
/* generate an id */
- sprintf (id, "005512345894583%d", counter++);
- sprintf (dest_href, "cid:%s", id);
- sprintf (cid, "<%s>", id);
+ sprintf(id, "005512345894583%d", counter++);
+ sprintf(dest_href, "cid:%s", id);
+ sprintf(cid, "<%s>", id);
/* add part to context */
- part = part_new (cid, filename, content_type, NULL, NULL);
+ part = part_new(cid, filename, content_type, NULL, NULL);
if (!ctx->attachments)
- ctx->attachments = attachments_new ();
- attachments_add_part (ctx->attachments, part);
+ ctx->attachments = attachments_new();
+ attachments_add_part(ctx->attachments, part);
return H_OK;
}
part_t *
-soap_ctx_get_file (SoapCtx * ctx, xmlNodePtr node)
+soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node)
{
xmlChar *prop;
char href[MAX_HREF_SIZE];
@@ -94,18 +94,18 @@ soap_ctx_get_file (SoapCtx * ctx, xmlNodePtr node)
if (!ctx->attachments)
return NULL;
- prop = xmlGetProp (node, "href");
+ prop = xmlGetProp(node, "href");
if (!prop)
return NULL;
- strcpy (href, (const char *) prop);
- if (!strncmp (href, "cid:", 4))
+ strcpy(href, (const char *) prop);
+ if (!strncmp(href, "cid:", 4))
{
for (part = ctx->attachments->parts; part; part = part->next)
{
- sprintf (buffer, "<%s>", href + 4);
- if (!strcmp (part->id, buffer))
+ sprintf(buffer, "<%s>", href + 4);
+ if (!strcmp(part->id, buffer))
return part;
}
@@ -114,7 +114,7 @@ soap_ctx_get_file (SoapCtx * ctx, xmlNodePtr node)
{
for (part = ctx->attachments->parts; part; part = part->next)
{
- if (!strcmp (part->location, href))
+ if (!strcmp(part->location, href))
return part;
}
@@ -124,29 +124,29 @@ soap_ctx_get_file (SoapCtx * ctx, xmlNodePtr node)
}
void
-soap_ctx_free (SoapCtx * ctx)
+soap_ctx_free(SoapCtx * ctx)
{
if (!ctx)
return;
if (ctx->attachments)
- attachments_free (ctx->attachments);
+ attachments_free(ctx->attachments);
if (ctx->env)
- soap_env_free (ctx->env);
+ soap_env_free(ctx->env);
- free (ctx);
+ free(ctx);
}
herror_t
-soap_ctx_new_with_method (const char *urn, const char *method, SoapCtx ** out)
+soap_ctx_new_with_method(const char *urn, const char *method, SoapCtx ** out)
{
SoapEnv *env;
herror_t err;
- err = soap_env_new_with_method (urn, method, &env);
+ err = soap_env_new_with_method(urn, method, &env);
if (err != H_OK)
return err;
- *out = soap_ctx_new (env);
+ *out = soap_ctx_new(env);
return H_OK;
}
diff --git a/libcsoap/soap-ctx.h b/libcsoap/soap-ctx.h
index 2df74b9..1baabba 100755
--- a/libcsoap/soap-ctx.h
+++ b/libcsoap/soap-ctx.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.h,v 1.6 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-ctx.h,v 1.7 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -41,7 +41,7 @@ typedef struct _SoapCtx
} SoapCtx;
-SoapCtx *soap_ctx_new (SoapEnv * env); /* should only be used internally */
+SoapCtx *soap_ctx_new(SoapEnv * env); /* should only be used internally */
/**
Returns the attached file if any found.
@@ -51,22 +51,22 @@ SoapCtx *soap_ctx_new (SoapEnv * env); /* should only be used internally */
@returns a part_t object of attachment was found, NULL otherwise.
*/
-part_t *soap_ctx_get_file (SoapCtx * ctx, xmlNodePtr node);
+part_t *soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node);
/**
Creates a new soap context object.
*/
-herror_t soap_ctx_new_with_method (const char *urn, const char *method,
- SoapCtx ** out);
+herror_t soap_ctx_new_with_method(const char *urn, const char *method,
+ SoapCtx ** out);
/* Size of destination dest_href should be MAX_HREF_SIZE */
-herror_t soap_ctx_add_file (SoapCtx * ctx, const char *filename,
- const char *content_type, char *dest_href);
+herror_t soap_ctx_add_file(SoapCtx * ctx, const char *filename,
+ const char *content_type, char *dest_href);
/*
Used internally. Will switch the deleteOnExit flag from the
given one to the added part.
*/
-void soap_ctx_add_files (SoapCtx * ctx, attachments_t * attachments);
-void soap_ctx_free (SoapCtx * ctx);
+void soap_ctx_add_files(SoapCtx * ctx, attachments_t * attachments);
+void soap_ctx_free(SoapCtx * ctx);
#endif
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index ec27137..5859dbc 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.11 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-env.c,v 1.12 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -89,52 +89,52 @@ struct XmlNodeHolder
};
static
- void xmlbuilder_start_element (const xmlChar * element_name, int attr_count,
- xmlChar ** keys, xmlChar ** values,
- void *userData);
+ void xmlbuilder_start_element(const xmlChar * element_name, int attr_count,
+ xmlChar ** keys, xmlChar ** values,
+ void *userData);
static
- void xmlbuilder_characters (const xmlChar * element_name,
- const xmlChar * chars, void *userData);
+ void xmlbuilder_characters(const xmlChar * element_name,
+ const xmlChar * chars, void *userData);
static
- void xmlbuilder_end_element (const xmlChar * element_name, void *userData);
+ void xmlbuilder_end_element(const xmlChar * element_name, void *userData);
/* ---------------------------------------------------------------------------- */
herror_t
-soap_env_new_from_doc (xmlDocPtr doc, SoapEnv ** out)
+soap_env_new_from_doc(xmlDocPtr doc, SoapEnv ** out)
{
xmlNodePtr node;
SoapEnv *env;
if (doc == NULL)
{
- log_error1 ("Can not create xml document!");
- return herror_new ("soap_env_new_from_doc",
- GENERAL_INVALID_PARAM,
- "XML Document (xmlDocPtr) is NULL");
+ log_error1("Can not create xml document!");
+ return herror_new("soap_env_new_from_doc",
+ GENERAL_INVALID_PARAM,
+ "XML Document (xmlDocPtr) is NULL");
}
- node = xmlDocGetRootElement (doc);
+ node = xmlDocGetRootElement(doc);
if (node == NULL)
{
- log_error1 ("xml document is empty!");
- return herror_new ("soap_env_new_from_doc",
- XML_ERROR_EMPTY_DOCUMENT, "XML Document is empty!");
+ log_error1("xml document is empty!");
+ return herror_new("soap_env_new_from_doc",
+ XML_ERROR_EMPTY_DOCUMENT, "XML Document is empty!");
}
- env = (SoapEnv *) malloc (sizeof (SoapEnv));
+ env = (SoapEnv *) malloc(sizeof(SoapEnv));
/* set root */
env->root = node;
/* set method root set call->cur (current node) to <method>. xpath:
//Envelope/Body/ */
- node = soap_xml_get_children (env->root); /* Check for NULL ! */
- env->cur = soap_xml_get_children (node); /* Check for NULL ! */
+ node = soap_xml_get_children(env->root); /* Check for NULL ! */
+ env->cur = soap_xml_get_children(node); /* Check for NULL ! */
*out = env;
return H_OK;
@@ -144,24 +144,24 @@ soap_env_new_from_doc (xmlDocPtr doc, SoapEnv ** out)
herror_t
-soap_env_new_from_buffer (const char *buffer, SoapEnv ** out)
+soap_env_new_from_buffer(const char *buffer, SoapEnv ** out)
{
xmlDocPtr doc;
herror_t err;
if (buffer == NULL)
- return herror_new ("soap_env_new_from_buffer",
- GENERAL_INVALID_PARAM, "buffer (first param) is NULL");
+ return herror_new("soap_env_new_from_buffer",
+ GENERAL_INVALID_PARAM, "buffer (first param) is NULL");
- doc = xmlParseDoc (BAD_CAST buffer);
+ doc = xmlParseDoc(BAD_CAST buffer);
if (doc == NULL)
- return herror_new ("soap_env_new_from_buffer",
- XML_ERROR_PARSE, "Can not parse xml");
+ return herror_new("soap_env_new_from_buffer",
+ XML_ERROR_PARSE, "Can not parse xml");
- err = soap_env_new_from_doc (doc, out);
+ err = soap_env_new_from_doc(doc, out);
if (err != H_OK)
{
- xmlFreeDoc (doc);
+ xmlFreeDoc(doc);
}
return err;
@@ -169,23 +169,23 @@ soap_env_new_from_buffer (const char *buffer, SoapEnv ** out)
herror_t
-soap_env_new_with_fault (fault_code_t faultcode,
- const char *faultstring,
- const char *faultactor, const char *detail,
- SoapEnv ** out)
+soap_env_new_with_fault(fault_code_t faultcode,
+ const char *faultstring,
+ const char *faultactor, const char *detail,
+ SoapEnv ** out)
{
xmlDocPtr doc;
herror_t err;
- doc = soap_fault_build (faultcode, faultstring, faultactor, detail);
+ doc = soap_fault_build(faultcode, faultstring, faultactor, detail);
if (doc == NULL)
- return herror_new ("soap_env_new_with_fault",
- XML_ERROR_PARSE, "Can not parse fault xml");
+ return herror_new("soap_env_new_with_fault",
+ XML_ERROR_PARSE, "Can not parse fault xml");
- err = soap_env_new_from_doc (doc, out);
+ err = soap_env_new_from_doc(doc, out);
if (err != H_OK)
{
- xmlFreeDoc (doc);
+ xmlFreeDoc(doc);
}
return err;
@@ -193,7 +193,7 @@ soap_env_new_with_fault (fault_code_t faultcode,
herror_t
-soap_env_new_with_response (SoapEnv * request, SoapEnv ** out)
+soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
{
char urn[100];
char methodname[150];
@@ -201,27 +201,26 @@ soap_env_new_with_response (SoapEnv * request, SoapEnv ** out)
if (request == NULL)
{
- return herror_new ("soap_env_new_with_response",
- GENERAL_INVALID_PARAM,
- "request (first param) is NULL");
+ return herror_new("soap_env_new_with_response",
+ GENERAL_INVALID_PARAM, "request (first param) is NULL");
}
if (request->root == NULL)
{
- return herror_new ("soap_env_new_with_response",
- GENERAL_INVALID_PARAM,
- "request (first param) has no xml structure");
+ return herror_new("soap_env_new_with_response",
+ GENERAL_INVALID_PARAM,
+ "request (first param) has no xml structure");
}
- if (!soap_env_find_methodname (request, methodname))
+ if (!soap_env_find_methodname(request, methodname))
{
- return herror_new ("soap_env_new_with_response",
- GENERAL_INVALID_PARAM,
- "Method name '%s' not found in request",
- SAVE_STR (methodname));
+ return herror_new("soap_env_new_with_response",
+ GENERAL_INVALID_PARAM,
+ "Method name '%s' not found in request",
+ SAVE_STR(methodname));
}
- if (!soap_env_find_urn (request, urn))
+ if (!soap_env_find_urn(request, urn))
{
/* here we have no chance to find out the namespace */
@@ -229,76 +228,74 @@ soap_env_new_with_response (SoapEnv * request, SoapEnv ** out)
urn[0] = '\0';
}
- sprintf (methodname2, "%sResponse", methodname);
- return soap_env_new_with_method (urn, methodname2, out);
+ sprintf(methodname2, "%sResponse", methodname);
+ return soap_env_new_with_method(urn, methodname2, out);
}
herror_t
-soap_env_new_with_method (const char *urn, const char *method, SoapEnv ** out)
+soap_env_new_with_method(const char *urn, const char *method, SoapEnv ** out)
{
xmlDocPtr env;
xmlChar buffer[1054];
- log_verbose2 ("URN = '%s'", urn);
- log_verbose2 ("Method = '%s'", method);
+ log_verbose2("URN = '%s'", urn);
+ log_verbose2("Method = '%s'", method);
- if (!strcmp (urn, ""))
+ if (!strcmp(urn, ""))
{
#ifdef USE_XMLSTRING
- xmlStrPrintf (buffer, 1054, BAD_CAST _SOAP_MSG_TEMPLATE_EMPTY_TARGET_,
- soap_env_ns, soap_env_enc, soap_xsi_ns,
- soap_xsd_ns, BAD_CAST method, BAD_CAST urn,
- BAD_CAST method);
+ xmlStrPrintf(buffer, 1054, BAD_CAST _SOAP_MSG_TEMPLATE_EMPTY_TARGET_,
+ soap_env_ns, soap_env_enc, soap_xsi_ns,
+ soap_xsd_ns, BAD_CAST method, BAD_CAST urn, BAD_CAST method);
#else
- sprintf (buffer, _SOAP_MSG_TEMPLATE_EMPTY_TARGET_,
- soap_env_ns, soap_env_enc, soap_xsi_ns,
- soap_xsd_ns, method, urn, method);
+ sprintf(buffer, _SOAP_MSG_TEMPLATE_EMPTY_TARGET_,
+ soap_env_ns, soap_env_enc, soap_xsi_ns,
+ soap_xsd_ns, method, urn, method);
#endif
}
else
{
#ifdef USE_XMLSTRING
- xmlStrPrintf (buffer, 1054, BAD_CAST _SOAP_MSG_TEMPLATE_,
- soap_env_ns, soap_env_enc, soap_xsi_ns,
- soap_xsd_ns, BAD_CAST method, BAD_CAST urn,
- BAD_CAST method);
+ xmlStrPrintf(buffer, 1054, BAD_CAST _SOAP_MSG_TEMPLATE_,
+ soap_env_ns, soap_env_enc, soap_xsi_ns,
+ soap_xsd_ns, BAD_CAST method, BAD_CAST urn, BAD_CAST method);
#else
- sprintf (buffer, _SOAP_MSG_TEMPLATE_,
- soap_env_ns, soap_env_enc, soap_xsi_ns,
- soap_xsd_ns, method, urn, method);
+ sprintf(buffer, _SOAP_MSG_TEMPLATE_,
+ soap_env_ns, soap_env_enc, soap_xsi_ns,
+ soap_xsd_ns, method, urn, method);
#endif
}
- env = xmlParseDoc (buffer);
+ env = xmlParseDoc(buffer);
if (!env)
- return herror_new ("soap_env_new_with_method",
- XML_ERROR_PARSE, "Can not parse xml");
+ return herror_new("soap_env_new_with_method",
+ XML_ERROR_PARSE, "Can not parse xml");
- return soap_env_new_from_doc (env, out);
+ return soap_env_new_from_doc(env, out);
}
static int
-_soap_env_xml_io_read (void *ctx, char *buffer, int len)
+_soap_env_xml_io_read(void *ctx, char *buffer, int len)
{
int readed;
http_input_stream_t *in = (http_input_stream_t *) ctx;
- if (!http_input_stream_is_ready (in))
+ if (!http_input_stream_is_ready(in))
return 0;
- readed = http_input_stream_read (in, buffer, len);
+ readed = http_input_stream_read(in, buffer, len);
if (readed == -1)
return 0;
return readed;
}
static int
-_soap_env_xml_io_close (void *ctx)
+_soap_env_xml_io_close(void *ctx)
{
/* do nothing */
return 0;
@@ -306,44 +303,44 @@ _soap_env_xml_io_close (void *ctx)
herror_t
-soap_env_new_from_stream (http_input_stream_t * in, SoapEnv ** out)
+soap_env_new_from_stream(http_input_stream_t * in, SoapEnv ** out)
{
xmlDocPtr doc;
herror_t err;
- doc = xmlReadIO (_soap_env_xml_io_read,
- _soap_env_xml_io_close, in, "", NULL, 0);
+ doc = xmlReadIO(_soap_env_xml_io_read,
+ _soap_env_xml_io_close, in, "", NULL, 0);
if (in->err != H_OK)
return in->err;
if (doc == NULL)
- return herror_new ("soap_env_new_from_stream",
- XML_ERROR_PARSE, "Trying to parse not valid xml");
- err = soap_env_new_from_doc (doc, out);
+ return herror_new("soap_env_new_from_stream",
+ XML_ERROR_PARSE, "Trying to parse not valid xml");
+ err = soap_env_new_from_doc(doc, out);
return err;
}
xmlNodePtr
-soap_env_add_item (SoapEnv * call, const char *type,
- const char *name, const char *value)
+soap_env_add_item(SoapEnv * call, const char *type,
+ const char *name, const char *value)
{
xmlNodePtr newnode;
- newnode = xmlNewTextChild (call->cur, NULL, BAD_CAST name, BAD_CAST value);
+ newnode = xmlNewTextChild(call->cur, NULL, BAD_CAST name, BAD_CAST value);
if (newnode == NULL)
{
- log_error1 ("Can not create new xml node");
+ log_error1("Can not create new xml node");
return NULL;
}
if (type)
{
- if (!xmlNewProp (newnode, BAD_CAST "xsi:type", BAD_CAST type))
+ if (!xmlNewProp(newnode, BAD_CAST "xsi:type", BAD_CAST type))
{
- log_error1 ("Can not create new xml attribute");
+ log_error1("Can not create new xml attribute");
return NULL;
}
}
@@ -354,41 +351,41 @@ soap_env_add_item (SoapEnv * call, const char *type,
xmlNodePtr
-soap_env_add_itemf (SoapEnv * call, const char *type,
- const char *name, const char *format, ...)
+soap_env_add_itemf(SoapEnv * call, const char *type,
+ const char *name, const char *format, ...)
{
va_list ap;
char buffer[1054];
- va_start (ap, format);
- vsprintf (buffer, format, ap);
- va_end (ap);
+ va_start(ap, format);
+ vsprintf(buffer, format, ap);
+ va_end(ap);
- return soap_env_add_item (call, type, name, buffer);
+ return soap_env_add_item(call, type, name, buffer);
}
xmlNodePtr
-soap_env_add_attachment (SoapEnv * call, const char *name, const char *href)
+soap_env_add_attachment(SoapEnv * call, const char *name, const char *href)
{
xmlNodePtr newnode;
- newnode = xmlNewTextChild (call->cur, NULL, BAD_CAST name, BAD_CAST "");
+ newnode = xmlNewTextChild(call->cur, NULL, BAD_CAST name, BAD_CAST "");
if (newnode == NULL)
{
- log_error1 ("Can not create new xml node");
+ log_error1("Can not create new xml node");
return NULL;
}
if (href)
{
- if (!xmlNewProp (newnode, BAD_CAST "href", BAD_CAST href))
+ if (!xmlNewProp(newnode, BAD_CAST "href", BAD_CAST href))
{
- log_error1 ("Can not create new xml attribute");
+ log_error1("Can not create new xml attribute");
return NULL;
}
}
@@ -397,27 +394,27 @@ soap_env_add_attachment (SoapEnv * call, const char *name, const char *href)
}
void
-soap_env_add_custom (SoapEnv * call, void *obj, XmlSerializerCallback cb,
- const char *type, const char *name)
+soap_env_add_custom(SoapEnv * call, void *obj, XmlSerializerCallback cb,
+ const char *type, const char *name)
{
struct XmlNodeHolder holder;
- holder.node = soap_env_get_method (call);
+ holder.node = soap_env_get_method(call);
- cb (obj, BAD_CAST name,
- xmlbuilder_start_element,
- xmlbuilder_characters, xmlbuilder_end_element, &holder);
+ cb(obj, BAD_CAST name,
+ xmlbuilder_start_element,
+ xmlbuilder_characters, xmlbuilder_end_element, &holder);
}
xmlNodePtr
-soap_env_push_item (SoapEnv * call, const char *type, const char *name)
+soap_env_push_item(SoapEnv * call, const char *type, const char *name)
{
xmlNodePtr node;
- node = soap_env_add_item (call, type, name, "");
+ node = soap_env_add_item(call, type, name, "");
if (node)
{
@@ -429,72 +426,72 @@ soap_env_push_item (SoapEnv * call, const char *type, const char *name)
void
-soap_env_pop_item (SoapEnv * call)
+soap_env_pop_item(SoapEnv * call)
{
call->cur = call->cur->parent;
}
void
-soap_env_free (SoapEnv * env)
+soap_env_free(SoapEnv * env)
{
if (env)
{
if (env->root)
{
- xmlFreeDoc (env->root->doc);
+ xmlFreeDoc(env->root->doc);
}
- free (env);
+ free(env);
}
}
xmlNodePtr
-soap_env_get_body (SoapEnv * env)
+soap_env_get_body(SoapEnv * env)
{
xmlNodePtr node;
if (env == NULL)
{
- log_error1 ("env object is NULL");
+ log_error1("env object is NULL");
return NULL;
}
if (env->root == NULL)
{
- log_error1 ("env has no xml");
+ log_error1("env has no xml");
return NULL;
}
- node = soap_xml_get_children (env->root);
+ node = soap_xml_get_children(env->root);
while (node != NULL)
{
- if (!xmlStrcmp (node->name, BAD_CAST "Body"))
+ if (!xmlStrcmp(node->name, BAD_CAST "Body"))
return node;
- node = soap_xml_get_next (node);
+ node = soap_xml_get_next(node);
}
- log_error1 ("Node Body tag found!");
+ log_error1("Node Body tag found!");
return NULL;
}
xmlNodePtr
-soap_env_get_fault (SoapEnv * env)
+soap_env_get_fault(SoapEnv * env)
{
xmlNodePtr node;
- node = soap_env_get_body (env);
+ node = soap_env_get_body(env);
if (!node)
return NULL;
while (node != NULL)
{
- if (!xmlStrcmp (node->name, BAD_CAST "Fault"))
+ if (!xmlStrcmp(node->name, BAD_CAST "Fault"))
return node;
- node = soap_xml_get_next (node);
+ node = soap_xml_get_next(node);
}
/* log_warn1 ("Node Fault tag found!");*/
@@ -503,26 +500,26 @@ soap_env_get_fault (SoapEnv * env)
xmlNodePtr
-soap_env_get_method (SoapEnv * env)
+soap_env_get_method(SoapEnv * env)
{
xmlNodePtr body;
- body = soap_env_get_body (env);
+ body = soap_env_get_body(env);
if (body == NULL)
{
- log_verbose1 ("body is NULL");
+ log_verbose1("body is NULL");
return NULL;
}
/* mehtod is the first child */
- return soap_xml_get_children (body);
+ return soap_xml_get_children(body);
}
xmlNodePtr
-_soap_env_get_body (SoapEnv * env)
+_soap_env_get_body(SoapEnv * env)
{
xmlNodePtr body;
xmlNodeSetPtr nodeset;
@@ -530,83 +527,83 @@ _soap_env_get_body (SoapEnv * env)
if (env == NULL)
{
- log_error1 ("env object is NULL");
+ log_error1("env object is NULL");
return NULL;
}
if (env->root == NULL)
{
- log_error1 ("env has no xml");
+ log_error1("env has no xml");
return NULL;
}
/*
find <Body> tag find out namespace xpath: //Envelope/Body/ */
- xpathobj = soap_xpath_eval (env->root->doc, "//Envelope/Body");
+ xpathobj = soap_xpath_eval(env->root->doc, "//Envelope/Body");
if (!xpathobj)
{
- log_error1 ("No Body (xpathobj)!");
+ log_error1("No Body (xpathobj)!");
return NULL;
}
nodeset = xpathobj->nodesetval;
if (!nodeset)
{
- log_error1 ("No Body (nodeset)!");
- xmlXPathFreeObject (xpathobj);
+ log_error1("No Body (nodeset)!");
+ xmlXPathFreeObject(xpathobj);
return NULL;
}
if (nodeset->nodeNr < 1)
{
- log_error1 ("No Body (nodeNr)!");
- xmlXPathFreeObject (xpathobj);
+ log_error1("No Body (nodeNr)!");
+ xmlXPathFreeObject(xpathobj);
return NULL;
}
body = nodeset->nodeTab[0]; /* body is <Body> */
- xmlXPathFreeObject (xpathobj);
+ xmlXPathFreeObject(xpathobj);
return body;
}
int
-soap_env_find_urn (SoapEnv * env, char *urn)
+soap_env_find_urn(SoapEnv * env, char *urn)
{
xmlNsPtr ns;
xmlNodePtr body, node;
- body = soap_env_get_body (env);
+ body = soap_env_get_body(env);
if (body == NULL)
{
- log_verbose1 ("body is NULL");
+ log_verbose1("body is NULL");
return 0;
}
/* node is the first child */
- node = soap_xml_get_children (body);
+ node = soap_xml_get_children(body);
if (node == NULL)
{
- log_error1 ("No namespace found");
+ log_error1("No namespace found");
return 0;
}
if (node->ns && node->ns->prefix)
{
- ns = xmlSearchNs (body->doc, node, node->ns->prefix);
+ ns = xmlSearchNs(body->doc, node, node->ns->prefix);
if (ns != NULL)
{
- strcpy (urn, (char *) ns->href);
+ strcpy(urn, (char *) ns->href);
return 1; /* namespace found! */
}
}
else
{
- strcpy (urn, "");
- log_warn1 ("No namespace found");
+ strcpy(urn, "");
+ log_warn1("No namespace found");
return 1;
}
@@ -615,30 +612,30 @@ soap_env_find_urn (SoapEnv * env, char *urn)
int
-soap_env_find_methodname (SoapEnv * env, char *method)
+soap_env_find_methodname(SoapEnv * env, char *method)
{
xmlNodePtr body, node;
- body = soap_env_get_body (env);
+ body = soap_env_get_body(env);
if (body == NULL)
return 0;
- node = soap_xml_get_children (body); /* node is the first child */
+ node = soap_xml_get_children(body); /* node is the first child */
if (node == NULL)
{
- log_error1 ("No method found");
+ log_error1("No method found");
return 0;
}
if (node->name == NULL)
{
- log_error1 ("No methodname found");
+ log_error1("No methodname found");
return 0;
}
- strcpy (method, (const char *) node->name);
+ strcpy(method, (const char *) node->name);
return 1;
}
@@ -651,8 +648,8 @@ soap_env_find_methodname (SoapEnv * env, char *method)
static void
-xmlbuilder_start_element (const xmlChar * element_name, int attr_count,
- xmlChar ** keys, xmlChar ** values, void *userData)
+xmlbuilder_start_element(const xmlChar * element_name, int attr_count,
+ xmlChar ** keys, xmlChar ** values, void *userData)
{
struct XmlNodeHolder *holder = (struct XmlNodeHolder *) userData;
xmlNodePtr parent = NULL;
@@ -663,13 +660,13 @@ xmlbuilder_start_element (const xmlChar * element_name, int attr_count,
if (parent == NULL)
return;
- holder->node = xmlNewChild (parent, NULL, element_name, NULL);
+ holder->node = xmlNewChild(parent, NULL, element_name, NULL);
}
static void
-xmlbuilder_characters (const xmlChar * element_name, const xmlChar * chars,
- void *userData)
+xmlbuilder_characters(const xmlChar * element_name, const xmlChar * chars,
+ void *userData)
{
struct XmlNodeHolder *holder = (struct XmlNodeHolder *) userData;
xmlNodePtr parent = NULL;
@@ -680,11 +677,11 @@ xmlbuilder_characters (const xmlChar * element_name, const xmlChar * chars,
if (parent == NULL)
return;
- xmlNewTextChild (parent, NULL, element_name, chars);
+ xmlNewTextChild(parent, NULL, element_name, chars);
}
static void
-xmlbuilder_end_element (const xmlChar * element_name, void *userData)
+xmlbuilder_end_element(const xmlChar * element_name, void *userData)
{
struct XmlNodeHolder *holder = (struct XmlNodeHolder *) userData;
diff --git a/libcsoap/soap-env.h b/libcsoap/soap-env.h
index 6a3d909..72dd999 100644
--- a/libcsoap/soap-env.h
+++ b/libcsoap/soap-env.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-env.h,v 1.10 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-env.h,v 1.11 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -73,10 +73,10 @@ typedef struct _SoapEnv
*/
herror_t
-soap_env_new_with_fault (fault_code_t faultcode,
- const char *faultstring,
- const char *faultactor,
- const char *detail, SoapEnv ** out);
+soap_env_new_with_fault(fault_code_t faultcode,
+ const char *faultstring,
+ const char *faultactor,
+ const char *detail, SoapEnv ** out);
/**
Creates an envelope with a method to invoke a soap service.
@@ -104,8 +104,7 @@ soap_env_new_with_fault (fault_code_t faultcode,
*/
herror_t
-soap_env_new_with_method (const char *urn, const char *method,
- SoapEnv ** out);
+soap_env_new_with_method(const char *urn, const char *method, SoapEnv ** out);
/**
@@ -138,7 +137,7 @@ soap_env_new_with_method (const char *urn, const char *method,
*/
-herror_t soap_env_new_with_response (SoapEnv * req, SoapEnv ** out);
+herror_t soap_env_new_with_response(SoapEnv * req, SoapEnv ** out);
/**
@@ -150,7 +149,7 @@ herror_t soap_env_new_with_response (SoapEnv * req, SoapEnv ** out);
@returns H_OK if success
*/
-herror_t soap_env_new_from_doc (xmlDocPtr doc, SoapEnv ** out);
+herror_t soap_env_new_from_doc(xmlDocPtr doc, SoapEnv ** out);
/**
@@ -161,7 +160,7 @@ herror_t soap_env_new_from_doc (xmlDocPtr doc, SoapEnv ** out);
@param out the output envelope object
@returns H_OK if success
*/
-herror_t soap_env_new_from_buffer (const char *buffer, SoapEnv ** out);
+herror_t soap_env_new_from_buffer(const char *buffer, SoapEnv ** out);
/**
@@ -171,21 +170,16 @@ herror_t soap_env_new_from_buffer (const char *buffer, SoapEnv ** out);
@param out the output envelope object
@returns H_OK if success
*/
-herror_t soap_env_new_from_stream (http_input_stream_t * in, SoapEnv ** out);
+herror_t soap_env_new_from_stream(http_input_stream_t * in, SoapEnv ** out);
/* --------------------------------------------------- */
/* XML Serializer functions and typedefs */
/* --------------------------------------------------- */
-typedef void (*XmlSerializerCallback)
- (void * /* obj */ , const xmlChar * /* root_element_name */ ,
- void (*OnStartElement) (const xmlChar * element_name, int attr_count,
- xmlChar ** keys, xmlChar ** values,
- void *userData),
- void (*OnCharacters) (const xmlChar * element_name, const xmlChar * chars,
- void *userData),
- void (*OnEndElement) (const xmlChar * element_name, void *userData),
- void * /* userdata */ );
+typedef void (*XmlSerializerCallback) (void * /* obj */ , const xmlChar * /* root_element_name
+ */ ,
+ void (*OnStartElement) (const xmlChar * element_name, int attr_count, xmlChar ** keys, xmlChar ** values, void *userData), void (*OnCharacters) (const xmlChar * element_name, const xmlChar * chars, void *userData), void (*OnEndElement) (const xmlChar * element_name, void *userData), void * /* userdata
+ */ );
/* ------------------------------------------------------ */
@@ -211,8 +205,8 @@ typedef void (*XmlSerializerCallback)
@see tutorial
*/
xmlNodePtr
-soap_env_add_item (SoapEnv * env, const char *type,
- const char *name, const char *value);
+soap_env_add_item(SoapEnv * env, const char *type,
+ const char *name, const char *value);
/**
@@ -232,7 +226,7 @@ soap_env_add_item (SoapEnv * env, const char *type,
@see soap_ctx_add_file tutorial
*/
xmlNodePtr
-soap_env_add_attachment (SoapEnv * env, const char *name, const char *href);
+soap_env_add_attachment(SoapEnv * env, const char *name, const char *href);
/**
@@ -243,8 +237,8 @@ soap_env_add_attachment (SoapEnv * env, const char *name, const char *href);
*/
void
-soap_env_add_custom (SoapEnv * env, void *obj, XmlSerializerCallback cb,
- const char *type, const char *name);
+soap_env_add_custom(SoapEnv * env, void *obj, XmlSerializerCallback cb,
+ const char *type, const char *name);
/**
Same as soap_env_add_item() with c style arguments
@@ -256,8 +250,8 @@ soap_env_add_custom (SoapEnv * env, void *obj, XmlSerializerCallback cb,
@see soap_env_add_item
*/
xmlNodePtr
-soap_env_add_itemf (SoapEnv * env, const char *type,
- const char *name, const char *value, ...);
+soap_env_add_itemf(SoapEnv * env, const char *type,
+ const char *name, const char *value, ...);
/**
@@ -285,7 +279,7 @@ soap_env_add_itemf (SoapEnv * env, const char *type,
@see tutorial
*/
xmlNodePtr
-soap_env_push_item (SoapEnv * env, const char *type, const char *name);
+soap_env_push_item(SoapEnv * env, const char *type, const char *name);
/**
Sets the xml pointer 1 level higher.
@@ -293,14 +287,14 @@ soap_env_push_item (SoapEnv * env, const char *type, const char *name);
@param env The envelope object
@see soap_env_push_item
*/
-void soap_env_pop_item (SoapEnv * env);
+void soap_env_pop_item(SoapEnv * env);
/**
Free the envelope.
@param env The envelope object
*/
-void soap_env_free (SoapEnv * env);
+void soap_env_free(SoapEnv * env);
/* --------------------------------------------------- */
@@ -311,29 +305,29 @@ void soap_env_free (SoapEnv * env);
/**
Gets the xml node pointing to SOAP Body.
*/
-xmlNodePtr soap_env_get_body (SoapEnv * env);
+xmlNodePtr soap_env_get_body(SoapEnv * env);
/**
Get the xml node pointing to SOAP method (call)
*/
-xmlNodePtr soap_env_get_method (SoapEnv * env);
+xmlNodePtr soap_env_get_method(SoapEnv * env);
/**
Get the xml node pointing to SOAP Fault
*/
-xmlNodePtr soap_env_get_fault (SoapEnv * env);
+xmlNodePtr soap_env_get_fault(SoapEnv * env);
/**
Get the xml node pointing to SOAP Header
*/
-xmlNodePtr soap_env_get_header (SoapEnv * env);
+xmlNodePtr soap_env_get_header(SoapEnv * env);
-int soap_env_find_urn (SoapEnv * env, char *urn);
-int soap_env_find_methodname (SoapEnv * env, char *methodname);
+int soap_env_find_urn(SoapEnv * env, char *urn);
+int soap_env_find_methodname(SoapEnv * env, char *methodname);
diff --git a/libcsoap/soap-fault.c b/libcsoap/soap-fault.c
index 3c8f5c1..1e6cae8 100644
--- a/libcsoap/soap-fault.c
+++ b/libcsoap/soap-fault.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-fault.c,v 1.7 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-fault.c,v 1.8 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -63,9 +63,9 @@ static char *fault_client = "Client";
static char *fault_server = "Server";
xmlDocPtr
-soap_fault_build (fault_code_t fcode,
- const char *faultstring,
- const char *faultactor, const char *detail)
+soap_fault_build(fault_code_t fcode,
+ const char *faultstring,
+ const char *faultactor, const char *detail)
{
/* variables */
@@ -74,7 +74,7 @@ soap_fault_build (fault_code_t fcode,
char *buffer;
xmlDocPtr fault; /* result */
- log_verbose1 ("Build fault");
+ log_verbose1("Build fault");
switch (fcode)
{
@@ -96,33 +96,33 @@ soap_fault_build (fault_code_t fcode,
/* calculate buffer length */
if (faultstring)
- bufferlen += strlen (faultstring);
+ bufferlen += strlen(faultstring);
if (faultactor)
- bufferlen += strlen (faultactor);
+ bufferlen += strlen(faultactor);
if (detail)
- bufferlen += strlen (detail);
+ bufferlen += strlen(detail);
- log_verbose2 ("Creating buffer with %d bytes", bufferlen);
- buffer = (char *) malloc (bufferlen);
+ log_verbose2("Creating buffer with %d bytes", bufferlen);
+ buffer = (char *) malloc(bufferlen);
- sprintf (buffer, _SOAP_FAULT_TEMPLATE_,
- soap_env_ns, soap_env_enc, soap_xsi_ns,
- soap_xsd_ns, faultcode,
- faultstring ? faultstring : "error",
- faultactor ? faultactor : "", detail ? detail : "");
+ sprintf(buffer, _SOAP_FAULT_TEMPLATE_,
+ soap_env_ns, soap_env_enc, soap_xsi_ns,
+ soap_xsd_ns, faultcode,
+ faultstring ? faultstring : "error",
+ faultactor ? faultactor : "", detail ? detail : "");
- fault = xmlParseDoc (BAD_CAST buffer);
- free (buffer);
+ fault = xmlParseDoc(BAD_CAST buffer);
+ free(buffer);
if (fault == NULL)
{
- log_error1 ("Can not create xml document!");
+ log_error1("Can not create xml document!");
- return soap_fault_build (fcode, "Can not create fault object in xml",
- "soap_fault_build()", NULL);
+ return soap_fault_build(fcode, "Can not create fault object in xml",
+ "soap_fault_build()", NULL);
}
- log_verbose2 ("Returning fault (%p)", fault);
+ log_verbose2("Returning fault (%p)", fault);
return fault;
}
diff --git a/libcsoap/soap-fault.h b/libcsoap/soap-fault.h
index 46471a0..7f01e9f 100644
--- a/libcsoap/soap-fault.h
+++ b/libcsoap/soap-fault.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-fault.h,v 1.3 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-fault.h,v 1.4 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -37,9 +37,9 @@ typedef enum _fault_code
} fault_code_t;
-xmlDocPtr soap_fault_build (fault_code_t faultcode,
- const char *faultstring,
- const char *faultactor, const char *detail);
+xmlDocPtr soap_fault_build(fault_code_t faultcode,
+ const char *faultstring,
+ const char *faultactor, const char *detail);
#endif
diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c
index 74c53be..1e57850 100644
--- a/libcsoap/soap-router.c
+++ b/libcsoap/soap-router.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-router.c,v 1.4 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-router.c,v 1.5 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,11 +25,11 @@
#include <string.h>
SoapRouter *
-soap_router_new ()
+soap_router_new()
{
SoapRouter *router;
- router = (SoapRouter *) malloc (sizeof (SoapRouter));
+ router = (SoapRouter *) malloc(sizeof(SoapRouter));
router->service_head = NULL;
router->service_tail = NULL;
@@ -38,30 +38,30 @@ soap_router_new ()
void
-soap_router_register_service (SoapRouter * router,
- SoapServiceFunc func,
- const char *method, const char *urn)
+soap_router_register_service(SoapRouter * router,
+ SoapServiceFunc func,
+ const char *method, const char *urn)
{
SoapService *service;
- service = soap_service_new (urn, method, func);
+ service = soap_service_new(urn, method, func);
if (router->service_tail == NULL)
{
router->service_head =
- router->service_tail = soap_service_node_new (service, NULL);
+ router->service_tail = soap_service_node_new(service, NULL);
}
else
{
- router->service_tail->next = soap_service_node_new (service, NULL);
+ router->service_tail->next = soap_service_node_new(service, NULL);
router->service_tail = router->service_tail->next;
}
}
SoapService *
-soap_router_find_service (SoapRouter * router,
- const char *urn, const char *method)
+soap_router_find_service(SoapRouter * router,
+ const char *urn, const char *method)
{
SoapServiceNode *node;
@@ -75,8 +75,8 @@ soap_router_find_service (SoapRouter * router,
if (node->service && node->service->urn && node->service->method)
{
- if (!strcmp (node->service->urn, urn)
- && !strcmp (node->service->method, method))
+ if (!strcmp(node->service->urn, urn)
+ && !strcmp(node->service->method, method))
return node->service;
}
@@ -89,10 +89,10 @@ soap_router_find_service (SoapRouter * router,
void
-soap_router_free (SoapRouter * router)
+soap_router_free(SoapRouter * router)
{
SoapServiceNode *node;
- log_verbose2 ("enter: router=%p", router);
+ log_verbose2("enter: router=%p", router);
if (router == NULL)
return;
@@ -101,11 +101,11 @@ soap_router_free (SoapRouter * router)
node = router->service_head->next;
/* log_verbose2("soap_service_free(%p)\n",
router->service_head->service); */
- soap_service_free (router->service_head->service);
- free (router->service_head);
+ soap_service_free(router->service_head->service);
+ free(router->service_head);
router->service_head = node;
}
- free (router);
- log_verbose1 ("leave with success");
+ free(router);
+ log_verbose1("leave with success");
}
diff --git a/libcsoap/soap-router.h b/libcsoap/soap-router.h
index f82d43c..5b0c7ab 100644
--- a/libcsoap/soap-router.h
+++ b/libcsoap/soap-router.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-router.h,v 1.3 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-router.h,v 1.4 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -47,7 +47,7 @@ typedef struct _SoapRouter
@returns Soap router
@see soap_router_free
*/
-SoapRouter *soap_router_new ();
+SoapRouter *soap_router_new();
/**
@@ -60,9 +60,9 @@ SoapRouter *soap_router_new ();
the client side.
@param urn The urn for this service
*/
-void soap_router_register_service (SoapRouter * router,
- SoapServiceFunc func,
- const char *method, const char *urn);
+void soap_router_register_service(SoapRouter * router,
+ SoapServiceFunc func,
+ const char *method, const char *urn);
/**
@@ -74,8 +74,8 @@ void soap_router_register_service (SoapRouter * router,
@return The service if found, NULL otherwise.
*/
-SoapService *soap_router_find_service (SoapRouter * router,
- const char *urn, const char *method);
+SoapService *soap_router_find_service(SoapRouter * router,
+ const char *urn, const char *method);
/**
@@ -83,6 +83,6 @@ SoapService *soap_router_find_service (SoapRouter * router,
@param router The router object to free
*/
-void soap_router_free (SoapRouter * router);
+void soap_router_free(SoapRouter * router);
#endif
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index 9daf639..74ff251 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.13 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-server.c,v 1.14 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -38,46 +38,45 @@ SoapRouterNode *head = NULL;
SoapRouterNode *tail = NULL;
static
- SoapRouterNode *router_node_new (SoapRouter * router,
- const char *context,
- SoapRouterNode * next);
+ SoapRouterNode *router_node_new(SoapRouter * router,
+ const char *context, SoapRouterNode * next);
-static SoapRouter *router_find (const char *context);
+static SoapRouter *router_find(const char *context);
-static void _soap_server_send_ctx (httpd_conn_t * conn, SoapCtx * ctxres);
+static void _soap_server_send_ctx(httpd_conn_t * conn, SoapCtx * ctxres);
/*---------------------------------*/
-void soap_server_entry (httpd_conn_t * conn, hrequest_t * req);
-static void _soap_server_send_env (http_output_stream_t * out, SoapEnv * env);
+void soap_server_entry(httpd_conn_t * conn, hrequest_t * req);
+static void _soap_server_send_env(http_output_stream_t * out, SoapEnv * env);
static
- void _soap_server_send_fault (httpd_conn_t * conn, hpair_t * header,
- const char *errmsg);
+ void _soap_server_send_fault(httpd_conn_t * conn, hpair_t * header,
+ const char *errmsg);
/*---------------------------------*/
herror_t
-soap_server_init_args (int argc, char *argv[])
+soap_server_init_args(int argc, char *argv[])
{
- return httpd_init (argc, argv);
+ return httpd_init(argc, argv);
}
int
-soap_server_register_router (SoapRouter * router, const char *context)
+soap_server_register_router(SoapRouter * router, const char *context)
{
- if (!httpd_register (context, soap_server_entry))
+ if (!httpd_register(context, soap_server_entry))
{
return 0;
}
if (tail == NULL)
{
- head = tail = router_node_new (router, context, NULL);
+ head = tail = router_node_new(router, context, NULL);
}
else
{
- tail->next = router_node_new (router, context, NULL);
+ tail->next = router_node_new(router, context, NULL);
tail = tail->next;
}
@@ -86,14 +85,14 @@ soap_server_register_router (SoapRouter * router, const char *context)
herror_t
-soap_server_run ()
+soap_server_run()
{
- return httpd_run ();
+ return httpd_run();
}
void
-soap_server_destroy ()
+soap_server_destroy()
{
SoapRouterNode *node = head;
SoapRouterNode *tmp;
@@ -101,18 +100,18 @@ soap_server_destroy ()
while (node != NULL)
{
tmp = node->next;
- log_verbose2 ("soap_router_free(%p)", node->router);
- soap_router_free (node->router);
- free (node->context);
- free (node);
+ log_verbose2("soap_router_free(%p)", node->router);
+ soap_router_free(node->router);
+ free(node->context);
+ free(node);
node = tmp;
}
- httpd_destroy ();
+ httpd_destroy();
}
void
-soap_server_entry (httpd_conn_t * conn, hrequest_t * req)
+soap_server_entry(httpd_conn_t * conn, hrequest_t * req)
{
hpair_t *header = NULL;
char buffer[1054];
@@ -127,23 +126,23 @@ soap_server_entry (httpd_conn_t * conn, hrequest_t * req)
if (req->method != HTTP_REQUEST_POST)
{
- httpd_send_header (conn, 200, "OK");
- http_output_stream_write_string (conn->out, "<html><head></head><body>");
- http_output_stream_write_string (conn->out, "<h1>Sorry! </h1><hr>");
- http_output_stream_write_string (conn->out,
- "I only speak with 'POST' method");
- http_output_stream_write_string (conn->out, "</body></html>");
+ httpd_send_header(conn, 200, "OK");
+ http_output_stream_write_string(conn->out, "<html><head></head><body>");
+ http_output_stream_write_string(conn->out, "<h1>Sorry! </h1><hr>");
+ http_output_stream_write_string(conn->out,
+ "I only speak with 'POST' method");
+ http_output_stream_write_string(conn->out, "</body></html>");
return;
}
- header = hpairnode_new (HEADER_CONTENT_TYPE, "text/xml", NULL);
+ header = hpairnode_new(HEADER_CONTENT_TYPE, "text/xml", NULL);
- err = soap_env_new_from_stream (req->in, &env);
+ err = soap_env_new_from_stream(req->in, &env);
if (err != H_OK)
{
- _soap_server_send_fault (conn, header, herror_message (err));
- herror_release (err);
+ _soap_server_send_fault(conn, header, herror_message(err));
+ herror_release(err);
return;
}
@@ -151,19 +150,19 @@ soap_server_entry (httpd_conn_t * conn, hrequest_t * req)
if (env == NULL)
{
- _soap_server_send_fault (conn, header, "Can not receive POST data!");
+ _soap_server_send_fault(conn, header, "Can not receive POST data!");
}
else
{
- ctx = soap_ctx_new (env);
- soap_ctx_add_files (ctx, req->attachments);
+ ctx = soap_ctx_new(env);
+ soap_ctx_add_files(ctx, req->attachments);
if (ctx->env == NULL)
{
- _soap_server_send_fault (conn, header, "Can not parse POST data!");
+ _soap_server_send_fault(conn, header, "Can not parse POST data!");
}
else
@@ -171,76 +170,76 @@ soap_server_entry (httpd_conn_t * conn, hrequest_t * req)
/* soap_xml_doc_print(env->root->doc); */
- router = router_find (req->path);
+ router = router_find(req->path);
if (router == NULL)
{
- _soap_server_send_fault (conn, header, "Can not find router!");
+ _soap_server_send_fault(conn, header, "Can not find router!");
}
else
{
- if (!soap_env_find_urn (ctx->env, urn))
+ if (!soap_env_find_urn(ctx->env, urn))
{
- _soap_server_send_fault (conn, header, "No URN found!");
- soap_ctx_free (ctx);
+ _soap_server_send_fault(conn, header, "No URN found!");
+ soap_ctx_free(ctx);
return;
}
else
{
- log_verbose2 ("urn: '%s'", urn);
+ log_verbose2("urn: '%s'", urn);
}
- if (!soap_env_find_methodname (ctx->env, method))
+ if (!soap_env_find_methodname(ctx->env, method))
{
- _soap_server_send_fault (conn, header, "No method found!");
- soap_ctx_free (ctx);
+ _soap_server_send_fault(conn, header, "No method found!");
+ soap_ctx_free(ctx);
return;
}
else
{
- log_verbose2 ("method: '%s'", method);
+ log_verbose2("method: '%s'", method);
}
- service = soap_router_find_service (router, urn, method);
+ service = soap_router_find_service(router, urn, method);
if (service == NULL)
{
- sprintf (buffer, "URN '%s' not found", urn);
- _soap_server_send_fault (conn, header, buffer);
- soap_ctx_free (ctx);
+ sprintf(buffer, "URN '%s' not found", urn);
+ _soap_server_send_fault(conn, header, buffer);
+ soap_ctx_free(ctx);
return;
}
else
{
- log_verbose2 ("func: %p", service->func);
- ctxres = soap_ctx_new (NULL);
+ log_verbose2("func: %p", service->func);
+ ctxres = soap_ctx_new(NULL);
/* ===================================== */
/* CALL SERVICE FUNCTION */
/* ===================================== */
- err = service->func (ctx, ctxres);
+ err = service->func(ctx, ctxres);
if (err != H_OK)
{
- sprintf (buffer, "Service returned following error message: '%s'",
- herror_message (err));
- herror_release (err);
- _soap_server_send_fault (conn, header, buffer);
- soap_ctx_free (ctx);
+ sprintf(buffer, "Service returned following error message: '%s'",
+ herror_message(err));
+ herror_release(err);
+ _soap_server_send_fault(conn, header, buffer);
+ soap_ctx_free(ctx);
return;
}
if (ctxres->env == NULL)
{
- sprintf (buffer, "Service '%s' returned no envelope", urn);
- _soap_server_send_fault (conn, header, buffer);
- soap_ctx_free (ctx);
+ sprintf(buffer, "Service '%s' returned no envelope", urn);
+ _soap_server_send_fault(conn, header, buffer);
+ soap_ctx_free(ctx);
return;
}
@@ -250,22 +249,22 @@ soap_server_entry (httpd_conn_t * conn, hrequest_t * req)
/* httpd_send_header(conn, 200, "OK");
_soap_server_send_env(conn->out, ctxres->env);
*/
- _soap_server_send_ctx (conn, ctxres);
+ _soap_server_send_ctx(conn, ctxres);
/* free envctx */
- soap_ctx_free (ctxres);
+ soap_ctx_free(ctxres);
}
}
}
}
- soap_ctx_free (ctx);
+ soap_ctx_free(ctx);
}
}
static void
-_soap_server_send_ctx (httpd_conn_t * conn, SoapCtx * ctx)
+_soap_server_send_ctx(httpd_conn_t * conn, SoapCtx * ctx)
{
xmlBufferPtr buffer;
static int counter = 1;
@@ -275,118 +274,116 @@ _soap_server_send_ctx (httpd_conn_t * conn, SoapCtx * ctx)
if (ctx->env == NULL || ctx->env->root == NULL)
return;
- buffer = xmlBufferCreate ();
+ buffer = xmlBufferCreate();
/* xmlIndentTreeOutput = 1;*/
- xmlThrDefIndentTreeOutput (1);
+ xmlThrDefIndentTreeOutput(1);
/* xmlKeepBlanksDefault(0);*/
- xmlNodeDump (buffer, ctx->env->root->doc, ctx->env->root, 1, 1);
+ xmlNodeDump(buffer, ctx->env->root->doc, ctx->env->root, 1, 1);
if (ctx->attachments)
{
- sprintf (strbuffer, "000128590350940924234%d", counter++);
- httpd_mime_send_header (conn, strbuffer, "", "text/xml", 200, "OK");
- httpd_mime_next (conn, strbuffer, "text/xml", "binary");
- http_output_stream_write_string (conn->out,
- (const char *)
- xmlBufferContent (buffer));
+ sprintf(strbuffer, "000128590350940924234%d", counter++);
+ httpd_mime_send_header(conn, strbuffer, "", "text/xml", 200, "OK");
+ httpd_mime_next(conn, strbuffer, "text/xml", "binary");
+ http_output_stream_write_string(conn->out,
+ (const char *) xmlBufferContent(buffer));
part = ctx->attachments->parts;
while (part)
{
- httpd_mime_send_file (conn, part->id, part->content_type,
- part->transfer_encoding, part->filename);
+ httpd_mime_send_file(conn, part->id, part->content_type,
+ part->transfer_encoding, part->filename);
part = part->next;
}
- httpd_mime_end (conn);
+ httpd_mime_end(conn);
}
else
{
char buflen[100];
xmlXPathContextPtr xpathCtx;
xmlXPathObjectPtr xpathObj;
- xpathCtx = xmlXPathNewContext (ctx->env->root->doc);
- xpathObj = xmlXPathEvalExpression ("//Fault", xpathCtx);
+ xpathCtx = xmlXPathNewContext(ctx->env->root->doc);
+ xpathObj = xmlXPathEvalExpression("//Fault", xpathCtx);
#ifdef WIN32
#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
#endif
- snprintf (buflen, 100, "%d",
- strlen ((const char *) xmlBufferContent (buffer)));
- httpd_set_header (conn, HEADER_CONTENT_LENGTH, buflen);
+ snprintf(buflen, 100, "%d",
+ strlen((const char *) xmlBufferContent(buffer)));
+ httpd_set_header(conn, HEADER_CONTENT_LENGTH, buflen);
if ((xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0)
{
- httpd_send_header (conn, 500, "FAILED");
+ httpd_send_header(conn, 500, "FAILED");
}
else
{
- httpd_send_header (conn, 200, "OK");
+ httpd_send_header(conn, 200, "OK");
}
- http_output_stream_write_string (conn->out,
- (const char *)
- xmlBufferContent (buffer));
- xmlXPathFreeObject (xpathObj);
- xmlXPathFreeContext (xpathCtx);
+ http_output_stream_write_string(conn->out,
+ (const char *) xmlBufferContent(buffer));
+ xmlXPathFreeObject(xpathObj);
+ xmlXPathFreeContext(xpathCtx);
}
- xmlBufferFree (buffer);
+ xmlBufferFree(buffer);
}
static void
-_soap_server_send_env (http_output_stream_t * out, SoapEnv * env)
+_soap_server_send_env(http_output_stream_t * out, SoapEnv * env)
{
xmlBufferPtr buffer;
if (env == NULL || env->root == NULL)
return;
- buffer = xmlBufferCreate ();
- xmlNodeDump (buffer, env->root->doc, env->root, 1, 1);
- http_output_stream_write_string (out,
- (const char *) xmlBufferContent (buffer));
- xmlBufferFree (buffer);
+ buffer = xmlBufferCreate();
+ xmlNodeDump(buffer, env->root->doc, env->root, 1, 1);
+ http_output_stream_write_string(out,
+ (const char *) xmlBufferContent(buffer));
+ xmlBufferFree(buffer);
}
static void
-_soap_server_send_fault (httpd_conn_t * conn, hpair_t * header,
- const char *errmsg)
+_soap_server_send_fault(httpd_conn_t * conn, hpair_t * header,
+ const char *errmsg)
{
SoapEnv *envres;
herror_t err;
char buffer[45];
- httpd_set_headers (conn, header);
- err = httpd_send_header (conn, 500, "FAILED");
+ httpd_set_headers(conn, header);
+ err = httpd_send_header(conn, 500, "FAILED");
if (err != H_OK)
{
/* WARNING: unhandled exception ! */
- log_error4 ("%s():%s [%d]", herror_func (err), herror_message (err),
- herror_code (err));
+ log_error4("%s():%s [%d]", herror_func(err), herror_message(err),
+ herror_code(err));
return;
}
- err = soap_env_new_with_fault (Fault_Server,
- errmsg ? errmsg : "General error",
- "cSOAP_Server", NULL, &envres);
+ err = soap_env_new_with_fault(Fault_Server,
+ errmsg ? errmsg : "General error",
+ "cSOAP_Server", NULL, &envres);
if (err != H_OK)
{
- log_error1 (herror_message (err));
- http_output_stream_write_string (conn->out, "<html><head></head><body>");
- http_output_stream_write_string (conn->out, "<h1>Error</h1><hr>");
- http_output_stream_write_string (conn->out,
- "Error while sending fault object:<br>Message: ");
- http_output_stream_write_string (conn->out, herror_message (err));
- http_output_stream_write_string (conn->out, "<br>Function: ");
- http_output_stream_write_string (conn->out, herror_func (err));
- http_output_stream_write_string (conn->out, "<br>Error code: ");
- sprintf (buffer, "%d", herror_code (err));
- http_output_stream_write_string (conn->out, buffer);
- http_output_stream_write_string (conn->out, "</body></html>");
+ log_error1(herror_message(err));
+ http_output_stream_write_string(conn->out, "<html><head></head><body>");
+ http_output_stream_write_string(conn->out, "<h1>Error</h1><hr>");
+ http_output_stream_write_string(conn->out,
+ "Error while sending fault object:<br>Message: ");
+ http_output_stream_write_string(conn->out, herror_message(err));
+ http_output_stream_write_string(conn->out, "<br>Function: ");
+ http_output_stream_write_string(conn->out, herror_func(err));
+ http_output_stream_write_string(conn->out, "<br>Error code: ");
+ sprintf(buffer, "%d", herror_code(err));
+ http_output_stream_write_string(conn->out, buffer);
+ http_output_stream_write_string(conn->out, "</body></html>");
return;
- herror_release (err);
+ herror_release(err);
}
else
{
- _soap_server_send_env (conn->out, envres);
+ _soap_server_send_env(conn->out, envres);
}
}
@@ -394,23 +391,23 @@ _soap_server_send_fault (httpd_conn_t * conn, hpair_t * header,
static SoapRouterNode *
-router_node_new (SoapRouter * router,
- const char *context, SoapRouterNode * next)
+router_node_new(SoapRouter * router,
+ const char *context, SoapRouterNode * next)
{
SoapRouterNode *node;
const char *noname = "/lost_found";
- node = (SoapRouterNode *) malloc (sizeof (SoapRouterNode));
+ node = (SoapRouterNode *) malloc(sizeof(SoapRouterNode));
if (context)
{
- node->context = (char *) malloc (strlen (context) + 1);
- strcpy (node->context, context);
+ node->context = (char *) malloc(strlen(context) + 1);
+ strcpy(node->context, context);
}
else
{
- log_warn2 ("context is null. Using '%s'", noname);
- node->context = (char *) malloc (strlen (noname) + 1);
- strcpy (node->context, noname);
+ log_warn2("context is null. Using '%s'", noname);
+ node->context = (char *) malloc(strlen(noname) + 1);
+ strcpy(node->context, noname);
}
node->router = router;
@@ -421,13 +418,13 @@ router_node_new (SoapRouter * router,
static SoapRouter *
-router_find (const char *context)
+router_find(const char *context)
{
SoapRouterNode *node = head;
while (node != NULL)
{
- if (!strcmp (node->context, context))
+ if (!strcmp(node->context, context))
return node->router;
node = node->next;
}
diff --git a/libcsoap/soap-server.h b/libcsoap/soap-server.h
index b829909..9306f1a 100644
--- a/libcsoap/soap-server.h
+++ b/libcsoap/soap-server.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-server.h,v 1.6 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-server.h,v 1.7 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -44,7 +44,7 @@
@returns 1 if success, 0 otherwise
*/
-herror_t soap_server_init_args (int argc, char *argv[]);
+herror_t soap_server_init_args(int argc, char *argv[]);
/**
@@ -61,20 +61,20 @@ herror_t soap_server_init_args (int argc, char *argv[]);
@see soap_router_register_service
*/
-int soap_server_register_router (SoapRouter * router, const char *context);
+int soap_server_register_router(SoapRouter * router, const char *context);
/**
Enters the server loop and starts to listen to
http requests.
*/
-herror_t soap_server_run ();
+herror_t soap_server_run();
/**
Frees the soap server.
*/
-void soap_server_destroy ();
+void soap_server_destroy();
#endif
diff --git a/libcsoap/soap-service.c b/libcsoap/soap-service.c
index 91be66e..376daa7 100644
--- a/libcsoap/soap-service.c
+++ b/libcsoap/soap-service.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-service.c,v 1.5 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-service.c,v 1.6 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -26,11 +26,11 @@
#include <string.h>
SoapServiceNode *
-soap_service_node_new (SoapService * service, SoapServiceNode * next)
+soap_service_node_new(SoapService * service, SoapServiceNode * next)
{
SoapServiceNode *node;
- node = (SoapServiceNode *) malloc (sizeof (SoapServiceNode));
+ node = (SoapServiceNode *) malloc(sizeof(SoapServiceNode));
node->service = service;
node->next = next;
@@ -41,33 +41,33 @@ soap_service_node_new (SoapService * service, SoapServiceNode * next)
SoapService *
-soap_service_new (const char *urn, const char *method, SoapServiceFunc f)
+soap_service_new(const char *urn, const char *method, SoapServiceFunc f)
{
SoapService *service;
- service = (SoapService *) malloc (sizeof (SoapService));
+ service = (SoapService *) malloc(sizeof(SoapService));
service->func = f;
if (urn != NULL)
{
- service->urn = (char *) malloc (strlen (urn) + 1);
- strcpy (service->urn, urn);
+ service->urn = (char *) malloc(strlen(urn) + 1);
+ strcpy(service->urn, urn);
}
else
{
- log_warn1 ("urn is NULL");
+ log_warn1("urn is NULL");
service->urn = "";
}
if (method != NULL)
{
- service->method = (char *) malloc (strlen (method) + 1);
- strcpy (service->method, method);
+ service->method = (char *) malloc(strlen(method) + 1);
+ strcpy(service->method, method);
}
else
{
- log_warn1 ("method is NULL");
+ log_warn1("method is NULL");
service->method = "";
}
@@ -77,19 +77,19 @@ soap_service_new (const char *urn, const char *method, SoapServiceFunc f)
void
-soap_service_free (SoapService * service)
+soap_service_free(SoapService * service)
{
- log_verbose2 ("enter: service=%p", service);
+ log_verbose2("enter: service=%p", service);
if (service == NULL)
return;
- if (strcmp (service->urn, ""))
- free (service->urn);
+ if (strcmp(service->urn, ""))
+ free(service->urn);
- if (strcmp (service->method, ""))
- free (service->method);
+ if (strcmp(service->method, ""))
+ free(service->method);
- free (service);
- log_verbose1 ("leave with success");
+ free(service);
+ log_verbose1("leave with success");
}
diff --git a/libcsoap/soap-service.h b/libcsoap/soap-service.h
index 497e77b..798f842 100644
--- a/libcsoap/soap-service.h
+++ b/libcsoap/soap-service.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-service.h,v 1.4 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-service.h,v 1.5 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -28,7 +28,7 @@
#include <libcsoap/soap-env.h>
#include <libcsoap/soap-ctx.h>
-typedef herror_t (*SoapServiceFunc) (SoapCtx *, SoapCtx *);
+typedef herror_t(*SoapServiceFunc) (SoapCtx *, SoapCtx *);
typedef struct _SoapService
@@ -45,12 +45,12 @@ typedef struct _SoapServiceNode
struct _SoapServiceNode *next;
} SoapServiceNode;
-SoapServiceNode *soap_service_node_new (SoapService * service,
- SoapServiceNode * next);
+SoapServiceNode *soap_service_node_new(SoapService * service,
+ SoapServiceNode * next);
-SoapService *soap_service_new (const char *urn, const char *method,
- SoapServiceFunc f);
-void soap_service_free (SoapService * service);
+SoapService *soap_service_new(const char *urn, const char *method,
+ SoapServiceFunc f);
+void soap_service_free(SoapService * service);
diff --git a/libcsoap/soap-xml.c b/libcsoap/soap-xml.c
index 288e5ff..7b6ba87 100644
--- a/libcsoap/soap-xml.c
+++ b/libcsoap/soap-xml.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-xml.c,v 1.7 2006/01/10 11:21:55 snowdrop Exp $
+* $Id: soap-xml.c,v 1.8 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -26,13 +26,13 @@
static const char *soap_env_ns = "http://schemas.xmlsoap.org/soap/envelope/";
xmlNodePtr
-soap_xml_get_children (xmlNodePtr param)
+soap_xml_get_children(xmlNodePtr param)
{
xmlNodePtr children;
if (param == NULL)
{
- log_error1 ("Invalid parameter 'param' (null)");
+ log_error1("Invalid parameter 'param' (null)");
return NULL;
}
@@ -49,7 +49,7 @@ soap_xml_get_children (xmlNodePtr param)
}
xmlNodePtr
-soap_xml_get_next (xmlNodePtr param)
+soap_xml_get_next(xmlNodePtr param)
{
xmlNodePtr node = param->next;
@@ -67,33 +67,33 @@ soap_xml_get_next (xmlNodePtr param)
xmlXPathObjectPtr
-soap_xpath_eval (xmlDocPtr doc, const char *xpath)
+soap_xpath_eval(xmlDocPtr doc, const char *xpath)
{
xmlXPathContextPtr context;
xmlXPathObjectPtr result;
- context = xmlXPathNewContext (doc);
- result = xmlXPathEvalExpression (BAD_CAST xpath, context);
- if (xmlXPathNodeSetIsEmpty (result->nodesetval))
+ context = xmlXPathNewContext(doc);
+ result = xmlXPathEvalExpression(BAD_CAST xpath, context);
+ if (xmlXPathNodeSetIsEmpty(result->nodesetval))
{
/* no result */
return NULL;
}
- xmlXPathFreeContext (context);
+ xmlXPathFreeContext(context);
return result;
}
int
-soap_xpath_foreach (xmlDocPtr doc, const char *xpath,
- soap_xmlnode_callback cb, void *userdata)
+soap_xpath_foreach(xmlDocPtr doc, const char *xpath,
+ soap_xmlnode_callback cb, void *userdata)
{
int i = 0;
xmlNodeSetPtr nodeset;
xmlXPathObjectPtr xpathobj;
- xpathobj = soap_xpath_eval (doc, xpath);
+ xpathobj = soap_xpath_eval(doc, xpath);
if (!xpathobj)
return 0;
@@ -104,44 +104,44 @@ soap_xpath_foreach (xmlDocPtr doc, const char *xpath,
for (i = 0; i < nodeset->nodeNr; i++)
{
- if (!cb (nodeset->nodeTab[i], userdata))
+ if (!cb(nodeset->nodeTab[i], userdata))
break;
}
- xmlXPathFreeObject ((xmlXPathObjectPtr) nodeset);
+ xmlXPathFreeObject((xmlXPathObjectPtr) nodeset);
return i;
}
void
-soap_xml_doc_print (xmlDocPtr doc)
+soap_xml_doc_print(xmlDocPtr doc)
{
xmlBufferPtr buffer;
xmlNodePtr root;
if (doc == NULL)
{
- puts ("xmlDocPtr is NULL!");
+ puts("xmlDocPtr is NULL!");
return;
}
- root = xmlDocGetRootElement (doc);
+ root = xmlDocGetRootElement(doc);
if (root == NULL)
{
- puts ("Empty document!");
+ puts("Empty document!");
return;
}
- buffer = xmlBufferCreate ();
- xmlNodeDump (buffer, doc, root, 1, 0);
- puts ((const char *) xmlBufferContent (buffer));
- xmlBufferFree (buffer);
+ buffer = xmlBufferCreate();
+ xmlNodeDump(buffer, doc, root, 1, 0);
+ puts((const char *) xmlBufferContent(buffer));
+ xmlBufferFree(buffer);
}
char *
-soap_xml_get_text (xmlNodePtr node)
+soap_xml_get_text(xmlNodePtr node)
{
- return (char *) xmlNodeListGetString (node->doc, node->xmlChildrenNode, 1);
+ return (char *) xmlNodeListGetString(node->doc, node->xmlChildrenNode, 1);
}
diff --git a/libcsoap/soap-xml.h b/libcsoap/soap-xml.h
index de11e2d..9ab07ea 100644
--- a/libcsoap/soap-xml.h
+++ b/libcsoap/soap-xml.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-xml.h,v 1.6 2006/01/10 11:21:55 snowdrop Exp $
+ * $Id: soap-xml.h,v 1.7 2006/01/10 11:29:04 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -32,17 +32,17 @@
typedef int (*soap_xmlnode_callback) (xmlNodePtr, void *);
-xmlNodePtr soap_xml_get_children (xmlNodePtr param);
-xmlNodePtr soap_xml_get_next (xmlNodePtr param);
+xmlNodePtr soap_xml_get_children(xmlNodePtr param);
+xmlNodePtr soap_xml_get_next(xmlNodePtr param);
-xmlXPathObjectPtr soap_xpath_eval (xmlDocPtr doc, const char *xpath);
+xmlXPathObjectPtr soap_xpath_eval(xmlDocPtr doc, const char *xpath);
int
-soap_xpath_foreach (xmlDocPtr doc, const char *xpath,
- soap_xmlnode_callback cb, void *userdata);
+soap_xpath_foreach(xmlDocPtr doc, const char *xpath,
+ soap_xmlnode_callback cb, void *userdata);
-void soap_xml_doc_print (xmlDocPtr doc);
-char *soap_xml_get_text (xmlNodePtr node);
+void soap_xml_doc_print(xmlDocPtr doc);
+char *soap_xml_get_text(xmlNodePtr node);
#endif