summaryrefslogtreecommitdiffstats
path: root/libcsoap/soap-server.h
diff options
context:
space:
mode:
authorGravatar m0gg2006-12-10 19:21:05 +0000
committerGravatar m0gg2006-12-10 19:21:05 +0000
commitf4c29af542bbded2fe36d9bdc80808c3a7f5d92b (patch)
tree4e131c9e14555cce9dcb9af7298d88953a230e7a /libcsoap/soap-server.h
parenta1267cdc17db793dbd3d960d1da0b6cf397e2b3e (diff)
downloadcsoap-f4c29af542bbded2fe36d9bdc80808c3a7f5d92b.tar.gz
csoap-f4c29af542bbded2fe36d9bdc80808c3a7f5d92b.tar.bz2
nhttp client fix and documentation update
Diffstat (limited to 'libcsoap/soap-server.h')
-rw-r--r--libcsoap/soap-server.h128
1 files changed, 124 insertions, 4 deletions
diff --git a/libcsoap/soap-server.h b/libcsoap/soap-server.h
index e858db9..8cad6ff 100644
--- a/libcsoap/soap-server.h
+++ b/libcsoap/soap-server.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-server.h,v 1.19 2006/12/10 12:23:45 m0gg Exp $
+ * $Id: soap-server.h,v 1.20 2006/12/10 19:21:06 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -56,9 +56,129 @@
* @see http://www.aleksey.com/xmlsec/
*/
-/** @file
- *
- * @version $Revision: 1.19 $
+/** @page soap_server_page Howto write an SOAP server
+ *
+ * @section soap_server_toc_sec Table of contents
+ *
+ * - @ref soap_server_init_sec
+ * - @ref soap_server_router_sec
+ * - @ref soap_server_registration_sec
+ * - @ref soap_server_running_sec
+ * - @ref soap_server_cleanup_sec
+ * - @ref soap_server_function_sec
+ *
+ * @section soap_server_init_sec Server initialization
+ *
+ * @code
+ * int main(int argc, char **argv)
+ * {
+ * herror_t err;
+ * struct SoapRouter *router;
+ *
+ * if ((err = soap_server_init_args(argc, argv)) != H_OK)
+ * {
+ * printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err));
+ * herror_release(err);
+ * exit(1);
+ * }
+ * @endcode
+ *
+ * @section soap_server_router_sec Router creation
+ *
+ * @code
+ * if (!(router = soap_router_new()))
+ * {
+ * printf("soap_router_new failed (router == %p)\n", router);
+ * herror_release(err);
+ * exit(1);
+ * }
+ * @endcode
+ *
+ * @section soap_server_registration_sec Service registration
+ *
+ * @code
+ * if ((err = soap_router_register_service(router, say_hello, method, urn)) != H_OK)
+ * {
+ * printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err));
+ * herror_release(err);
+ * exit(1);
+ * }
+ * @endcode
+ *
+ * @code
+ * if ((err = soap_server_register_router(router, url)))
+ * {
+ * printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err));
+ * herror_release(err);
+ * exit(1);
+ * }
+ * printf("router (%p) registered for \"%s\"\n", router, url);
+ * @endcode
+ *
+ * @section soap_server_running_sec Serving requests
+ *
+ * @code
+ * printf("press ctrl-c to shutdown\n");
+ * if ((err = soap_server_run()) != H_OK)
+ * {
+ * printf("%s(): %s [%d]\n", herror_func(err), herror_message(err), herror_code(err));
+ * herror_release(err);
+ * exit(1);
+ * }
+ * @endcode
+ *
+ * @section soap_server_cleanup_sec Server cleanup
+ *
+ * @code
+ * soap_server_destroy();
+ *
+ * exit(0);
+ * }
+ * @endcode
+ *
+ * @section soap_server_function_sec Service function
+ *
+ * @code
+ * herror_t say_hello(struct SoapCtx *req, struct SoapCtx *res)
+ * {
+ * herror_t err;
+ * char *name;
+ * xmlNodePtr method, node;
+ *
+ * printf("processing service request\n");
+ *
+ * xmlDocFormatDump(stdout, req->env->root->doc, 1);
+ *
+ * err = soap_env_new_with_response(req->env, &res->env);
+ * if (err != H_OK)
+ * {
+ * printf("soap_env_new_with_response failed (%s)\n", herror_message(err));
+ * return err;
+ * }
+ * printf("empty response created\n");
+ *
+ * if (!(method = soap_env_get_method(req->env)))
+ * {
+ * printf("soap_env_get_method failed\n");
+ * return herror_new("say_hello", 0, "There may be a bug in the library...");
+ * }
+ * printf("method found\n");
+ *
+ * printf("adding response content...\n");
+ * node = soap_xml_get_children(method);
+ *
+ * while (node)
+ * {
+ * name = (char *) xmlNodeListGetString(node->doc, node->xmlChildrenNode, 1);
+ * soap_env_add_itemf(res->env, "xsd:string", "echo", "Hello '%s'", name);
+ * node = soap_xml_get_next(node);
+ * if (name)
+ * xmlFree(name);
+ * }
+ * printf("service request done\n");
+ * return H_OK;
+ * }
+ * @endcode
*
*/