summaryrefslogtreecommitdiffstats
path: root/libcsoap
diff options
context:
space:
mode:
Diffstat (limited to 'libcsoap')
-rw-r--r--libcsoap/Makefile.am4
-rw-r--r--libcsoap/soap-addressing.c93
-rw-r--r--libcsoap/soap-addressing.h60
-rw-r--r--libcsoap/soap-admin.c15
-rw-r--r--libcsoap/soap-admin.h22
-rw-r--r--libcsoap/soap-client.c17
-rw-r--r--libcsoap/soap-client.h63
-rwxr-xr-xlibcsoap/soap-ctx.c22
-rwxr-xr-xlibcsoap/soap-ctx.h21
-rw-r--r--libcsoap/soap-env.c118
-rw-r--r--libcsoap/soap-env.h470
-rw-r--r--libcsoap/soap-fault.c10
-rw-r--r--libcsoap/soap-nhttp.c75
-rw-r--r--libcsoap/soap-nhttp.h6
-rw-r--r--libcsoap/soap-nudp.c14
-rw-r--r--libcsoap/soap-nudp.h6
-rw-r--r--libcsoap/soap-router.c41
-rw-r--r--libcsoap/soap-router.h117
-rw-r--r--libcsoap/soap-server.c54
-rw-r--r--libcsoap/soap-server.h17
-rw-r--r--libcsoap/soap-service.c3
-rw-r--r--libcsoap/soap-service.h11
-rw-r--r--libcsoap/soap-transport.c61
-rw-r--r--libcsoap/soap-transport.h12
-rw-r--r--libcsoap/soap-wsil.c43
-rw-r--r--libcsoap/soap-xml.c62
-rw-r--r--libcsoap/soap-xml.h27
27 files changed, 728 insertions, 736 deletions
diff --git a/libcsoap/Makefile.am b/libcsoap/Makefile.am
index b2c73f5..a0dc62e 100644
--- a/libcsoap/Makefile.am
+++ b/libcsoap/Makefile.am
@@ -6,12 +6,12 @@ libcsoap_ladir=$(includedir)/libcsoap-@csoap_release@/libcsoap
libcsoap_la_SOURCES=soap-xml.c soap-fault.c soap-env.c soap-service.c \
soap-router.c soap-client.c soap-server.c soap-ctx.c \
soap-admin.c soap-addressing.c soap-transport.c \
- soap-nudp.c soap-nhttp.c
+ soap-nudp.c soap-nhttp.c soap-wsil.c
libcsoap_la_HEADERS=soap-xml.h soap-fault.h soap-env.h soap-service.h \
soap-router.h soap-client.h soap-server.h soap-ctx.h \
soap-admin.h soap-addressing.h soap-transport.h \
- soap-nudp.h soap-nhttp.c
+ soap-nudp.h soap-nhttp.h soap-wsil.h
libcsoap_la_LDFLAGS= -version-info @csoap_version@ -release @csoap_release@
libcsoap_la_CFLAGS=-I${top_srcdir} -D__CSOAP_INTERNAL=1
diff --git a/libcsoap/soap-addressing.c b/libcsoap/soap-addressing.c
index b1b9d30..dc75d18 100644
--- a/libcsoap/soap-addressing.c
+++ b/libcsoap/soap-addressing.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-addressing.c,v 1.2 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-addressing.c,v 1.3 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2006 Heiko Ronsdorf
@@ -61,7 +61,7 @@
#include "soap-env.h"
#include "soap-addressing.h"
-static const char *
+static const xmlChar *
_soap_addressing_uuid_error(uint32_t status)
{
switch(status)
@@ -261,7 +261,7 @@ soap_addressing_set_metadata(xmlNodePtr endpoint_reference, xmlNodePtr metadata)
}
xmlURI *
-soap_addressing_get_message_id(SoapEnv *envelope)
+soap_addressing_get_message_id(struct SoapEnv *envelope)
{
xmlNodePtr id;
@@ -273,7 +273,7 @@ soap_addressing_get_message_id(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_message_id(SoapEnv *envelope, xmlURI *id)
+soap_addressing_set_message_id(struct SoapEnv *envelope, xmlURI *id)
{
xmlNodePtr node;
@@ -285,13 +285,50 @@ soap_addressing_set_message_id(SoapEnv *envelope, xmlURI *id)
}
xmlNodePtr
-soap_addressing_get_relates_to(SoapEnv *envelope)
+soap_addressing_set_message_id_string(struct SoapEnv *envelope, xmlChar *id)
+{
+ xmlNodePtr node;
+ xmlChar *tmp;
+
+ if (id == NULL)
+ tmp = _soap_addressing_generate_id();
+ else
+ tmp = id;
+
+ node = _soap_addressing_get_child_element(envelope->header, WSA_MESSAGE_ID);
+ if (node == NULL)
+ node = _soap_addressing_add_node(envelope->header, WSA_MESSAGE_ID, tmp);
+ else
+ xmlNodeSetContent(node, tmp);
+
+ if (id == NULL)
+ xmlFree(tmp);
+
+ return node;
+}
+
+xmlChar *soap_addressing_get_message_id_string(struct SoapEnv *envelope)
+{
+ xmlURI *uri;
+ xmlChar *ret;
+
+ if (!(uri = soap_addressing_get_message_id(envelope)))
+ return NULL;
+
+ ret = xmlSaveUri(uri);
+ xmlFreeURI(uri);
+
+ return ret;
+}
+
+xmlNodePtr
+soap_addressing_get_relates_to(struct SoapEnv *envelope)
{
return _soap_addressing_get_child_element(envelope->header, WSA_RELATES_TO);
}
xmlNodePtr
-soap_addressing_add_relates_to(SoapEnv *envelope, xmlURI *id, xmlURI *type)
+soap_addressing_add_relates_to(struct SoapEnv *envelope, xmlURI *id, xmlURI *type)
{
xmlNodePtr node;
@@ -310,13 +347,13 @@ soap_addressing_add_relates_to(SoapEnv *envelope, xmlURI *id, xmlURI *type)
}
xmlNodePtr
-soap_addressing_get_reply_to(SoapEnv *envelope)
+soap_addressing_get_reply_to(struct SoapEnv *envelope)
{
return _soap_addressing_get_child_element(envelope->header, WSA_REPLY_TO);
}
xmlNodePtr
-soap_addressing_set_reply_to(SoapEnv *envelope, xmlNodePtr address)
+soap_addressing_set_reply_to(struct SoapEnv *envelope, xmlNodePtr address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -337,7 +374,7 @@ soap_addressing_set_reply_to(SoapEnv *envelope, xmlNodePtr address)
}
xmlURI *
-soap_addressing_get_reply_to_address(SoapEnv *envelope)
+soap_addressing_get_reply_to_address(struct SoapEnv *envelope)
{
xmlNodePtr reply_to;
@@ -349,7 +386,7 @@ soap_addressing_get_reply_to_address(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_reply_to_address(SoapEnv *envelope, xmlURI *address)
+soap_addressing_set_reply_to_address(struct SoapEnv *envelope, xmlURI *address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -368,13 +405,13 @@ soap_addressing_set_reply_to_address(SoapEnv *envelope, xmlURI *address)
}
xmlNodePtr
-soap_addressing_get_from(SoapEnv *envelope)
+soap_addressing_get_from(struct SoapEnv *envelope)
{
return _soap_addressing_get_child_element(envelope->header, WSA_FROM);
}
xmlNodePtr
-soap_addressing_set_from(SoapEnv *envelope, xmlNodePtr address)
+soap_addressing_set_from(struct SoapEnv *envelope, xmlNodePtr address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -395,7 +432,7 @@ soap_addressing_set_from(SoapEnv *envelope, xmlNodePtr address)
}
xmlURI *
-soap_addressing_get_from_address(SoapEnv *envelope)
+soap_addressing_get_from_address(struct SoapEnv *envelope)
{
xmlNodePtr from;
@@ -407,7 +444,7 @@ soap_addressing_get_from_address(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_from_address(SoapEnv *envelope, xmlURI *address)
+soap_addressing_set_from_address(struct SoapEnv *envelope, xmlURI *address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -426,13 +463,13 @@ soap_addressing_set_from_address(SoapEnv *envelope, xmlURI *address)
}
xmlNodePtr
-soap_addressing_get_fault_to(SoapEnv *envelope)
+soap_addressing_get_fault_to(struct SoapEnv *envelope)
{
return _soap_addressing_get_child_element(envelope->header, WSA_FAULT_TO);
}
xmlNodePtr
-soap_addressing_set_fault_to(SoapEnv *envelope, xmlNodePtr address)
+soap_addressing_set_fault_to(struct SoapEnv *envelope, xmlNodePtr address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -453,7 +490,7 @@ soap_addressing_set_fault_to(SoapEnv *envelope, xmlNodePtr address)
}
xmlURI *
-soap_addressing_get_fault_to_address(SoapEnv *envelope)
+soap_addressing_get_fault_to_address(struct SoapEnv *envelope)
{
xmlNodePtr fault_to;
@@ -465,7 +502,7 @@ soap_addressing_get_fault_to_address(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_fault_to_address(SoapEnv *envelope, xmlURI *address)
+soap_addressing_set_fault_to_address(struct SoapEnv *envelope, xmlURI *address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -484,13 +521,13 @@ soap_addressing_set_fault_to_address(SoapEnv *envelope, xmlURI *address)
}
xmlNodePtr
-soap_addressing_get_to(SoapEnv *envelope)
+soap_addressing_get_to(struct SoapEnv *envelope)
{
return _soap_addressing_get_child_element(envelope->header, WSA_TO);
}
xmlNodePtr
-soap_addressing_set_to(SoapEnv *envelope, xmlNodePtr address)
+soap_addressing_set_to(struct SoapEnv *envelope, xmlNodePtr address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -511,7 +548,7 @@ soap_addressing_set_to(SoapEnv *envelope, xmlNodePtr address)
}
xmlURI *
-soap_addressing_get_to_address(SoapEnv *envelope)
+soap_addressing_get_to_address(struct SoapEnv *envelope)
{
xmlNodePtr to;
@@ -522,7 +559,7 @@ soap_addressing_get_to_address(SoapEnv *envelope)
}
xmlChar *
-soap_addressing_get_to_address_string(SoapEnv *envelope)
+soap_addressing_get_to_address_string(struct SoapEnv *envelope)
{
xmlURI *uri;
xmlChar *ret;
@@ -537,7 +574,7 @@ soap_addressing_get_to_address_string(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_to_address_string(SoapEnv *envelope, const char *to)
+soap_addressing_set_to_address_string(struct SoapEnv *envelope, const char *to)
{
xmlURI *uri;
xmlNodePtr ret;
@@ -552,7 +589,7 @@ soap_addressing_set_to_address_string(SoapEnv *envelope, const char *to)
}
xmlNodePtr
-soap_addressing_set_to_address(SoapEnv *envelope, xmlURI *address)
+soap_addressing_set_to_address(struct SoapEnv *envelope, xmlURI *address)
{
xmlNodePtr ret;
xmlNodePtr node;
@@ -571,7 +608,7 @@ soap_addressing_set_to_address(SoapEnv *envelope, xmlURI *address)
}
xmlURI *
-soap_addressing_get_action(SoapEnv *envelope)
+soap_addressing_get_action(struct SoapEnv *envelope)
{
xmlNodePtr action;
@@ -583,7 +620,7 @@ soap_addressing_get_action(SoapEnv *envelope)
}
xmlChar *
-soap_addressing_get_action_string(SoapEnv *envelope)
+soap_addressing_get_action_string(struct SoapEnv *envelope)
{
xmlURI *uri;
xmlChar *ret;
@@ -598,7 +635,7 @@ soap_addressing_get_action_string(SoapEnv *envelope)
}
xmlNodePtr
-soap_addressing_set_action(SoapEnv *envelope, xmlURI *action)
+soap_addressing_set_action(struct SoapEnv *envelope, xmlURI *action)
{
xmlNodePtr node;
@@ -610,7 +647,7 @@ soap_addressing_set_action(SoapEnv *envelope, xmlURI *action)
}
xmlNodePtr
-soap_addressing_set_action_string(SoapEnv *envelope, const char *action)
+soap_addressing_set_action_string(struct SoapEnv *envelope, const char *action)
{
xmlURI *uri;
xmlNodePtr ret;
diff --git a/libcsoap/soap-addressing.h b/libcsoap/soap-addressing.h
index 0677244..224fd33 100644
--- a/libcsoap/soap-addressing.h
+++ b/libcsoap/soap-addressing.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-addressing.h,v 1.2 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-addressing.h,v 1.3 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2006 Heiko Ronsdorf
@@ -35,7 +35,7 @@
* in a transport-neutral manner.
*
* @author H. Ronsdorf
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @see http://www.w3.org/TR/ws-addr-core/
*
*/
@@ -196,45 +196,45 @@ xmlNodePtr soap_addressing_set_reference_properties(xmlNodePtr endpoint_referenc
xmlNodePtr soap_addressing_get_metadata(xmlNodePtr endpoint_reference);
xmlNodePtr soap_addressing_set_metadata(xmlNodePtr endpoint_reference, xmlNodePtr parameter);
-xmlURI *soap_addressing_get_message_id(SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_message_id(SoapEnv *envelope, xmlURI *id);
+xmlURI *soap_addressing_get_message_id(struct SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_message_id(struct SoapEnv *envelope, xmlURI *id);
-xmlNodePtr soap_addressing_get_relates_to(SoapEnv *envelope);
-xmlNodePtr soap_addressing_add_relates_to(SoapEnv *envelope, xmlURI *id, xmlURI *type);
+xmlNodePtr soap_addressing_get_relates_to(struct SoapEnv *envelope);
+xmlNodePtr soap_addressing_add_relates_to(struct SoapEnv *envelope, xmlURI *id, xmlURI *type);
-xmlNodePtr soap_addressing_get_reply_to(SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_reply_to(SoapEnv *envelope, xmlNodePtr address);
+xmlNodePtr soap_addressing_get_reply_to(struct SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_reply_to(struct SoapEnv *envelope, xmlNodePtr address);
-xmlURI *soap_addressing_get_reply_to_address(SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_reply_to_address(SoapEnv *envelope, xmlURI *address);
+xmlURI *soap_addressing_get_reply_to_address(struct SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_reply_to_address(struct SoapEnv *envelope, xmlURI *address);
-xmlNodePtr soap_addressing_get_from(SoapEnv *envelope);
-xmlURI *soap_addressing_get_from_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_get_from(struct SoapEnv *envelope);
+xmlURI *soap_addressing_get_from_address(struct SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_from(SoapEnv *envelope, xmlNodePtr address);
-xmlNodePtr soap_addressing_set_from_address(SoapEnv *envelope, xmlURI *address);
-xmlNodePtr soap_addressing_set_from_string(SoapEnv *envelope, const char *from);
+xmlNodePtr soap_addressing_set_from(struct SoapEnv *envelope, xmlNodePtr address);
+xmlNodePtr soap_addressing_set_from_address(struct SoapEnv *envelope, xmlURI *address);
+xmlNodePtr soap_addressing_set_from_string(struct SoapEnv *envelope, const char *from);
-xmlNodePtr soap_addressing_get_fault_to(SoapEnv *envelope);
-xmlURI *soap_addressing_get_fault_to_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_get_fault_to(struct SoapEnv *envelope);
+xmlURI *soap_addressing_get_fault_to_address(struct SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_fault_to(SoapEnv *envelope, xmlNodePtr address);
-xmlNodePtr soap_addressing_set_fault_to_address(SoapEnv *envelope, xmlURI *address);
-xmlNodePtr soap_addressing_set_fault_to_string(SoapEnv *envelope, const char *fault_to);
+xmlNodePtr soap_addressing_set_fault_to(struct SoapEnv *envelope, xmlNodePtr address);
+xmlNodePtr soap_addressing_set_fault_to_address(struct SoapEnv *envelope, xmlURI *address);
+xmlNodePtr soap_addressing_set_fault_to_string(struct SoapEnv *envelope, const char *fault_to);
-xmlNodePtr soap_addressing_get_to(SoapEnv *envelope);
-xmlURI *soap_addressing_get_to_address(SoapEnv *envelope);
-xmlChar *soap_addressing_get_to_address_string(SoapEnv *envelope);
+xmlNodePtr soap_addressing_get_to(struct SoapEnv *envelope);
+xmlURI *soap_addressing_get_to_address(struct SoapEnv *envelope);
+xmlChar *soap_addressing_get_to_address_string(struct SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_to(SoapEnv *envelope, xmlNodePtr address);
-xmlNodePtr soap_addressing_set_to_address(SoapEnv *envelope, xmlURI *address);
-xmlNodePtr soap_addressing_set_to_address_string(SoapEnv *envelope, const char *to);
+xmlNodePtr soap_addressing_set_to(struct SoapEnv *envelope, xmlNodePtr address);
+xmlNodePtr soap_addressing_set_to_address(struct SoapEnv *envelope, xmlURI *address);
+xmlNodePtr soap_addressing_set_to_address_string(struct SoapEnv *envelope, const char *to);
-xmlURI *soap_addressing_get_action(SoapEnv *envelope);
-xmlChar *soap_addressing_get_action_string(SoapEnv *envelope);
+xmlURI *soap_addressing_get_action(struct SoapEnv *envelope);
+xmlChar *soap_addressing_get_action_string(struct SoapEnv *envelope);
-xmlNodePtr soap_addressing_set_action(SoapEnv *envelope, xmlURI *action);
-xmlNodePtr soap_addressing_set_action_string(SoapEnv *envelope, const char *action);
+xmlNodePtr soap_addressing_set_action(struct SoapEnv *envelope, xmlURI *action);
+xmlNodePtr soap_addressing_set_action_string(struct SoapEnv *envelope, const char *action);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-admin.c b/libcsoap/soap-admin.c
index 5558c75..b792ae6 100644
--- a/libcsoap/soap-admin.c
+++ b/libcsoap/soap-admin.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-admin.c,v 1.6 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-admin.c,v 1.7 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -45,17 +45,11 @@
#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-server.h>
#include <nanohttp/nanohttp-admin.h>
-#define __CSOAP_INTERNAL
-
-#include "soap-fault.h"
#include "soap-env.h"
-#include "soap-ctx.h"
#include "soap-service.h"
#include "soap-router.h"
#include "soap-server.h"
@@ -109,7 +103,7 @@ _soap_admin_list_routers(httpd_conn_t *conn)
static void
_soap_admin_list_services(httpd_conn_t *conn, const char *routername)
{
- SoapRouter *router;
+ struct SoapRouter *router;
SoapServiceNode *node;
char buffer[1024];
@@ -144,7 +138,7 @@ _soap_admin_list_services(httpd_conn_t *conn, const char *routername)
static void
-_soap_admin_handle_get(httpd_conn_t * conn, hrequest_t * req)
+_soap_admin_handle_get(httpd_conn_t * conn, struct hrequest_t * req)
{
char *param;
@@ -163,6 +157,7 @@ _soap_admin_handle_get(httpd_conn_t * conn, hrequest_t * req)
http_output_stream_write_string(conn->out,
"<ul>"
"<li><a href=\"?" SOAP_ADMIN_QUERY_ROUTERS "\">Routers</a></li>"
+ "<li><a href=\"../inspection.wsil\">inspection.wsil</a> (try: -CSOAPwsil)</li>"
"<li><a href=\"../nhttp\">nanoHTTP</a></li>"
"</ul>");
@@ -174,7 +169,7 @@ _soap_admin_handle_get(httpd_conn_t * conn, hrequest_t * req)
static void
-_soap_admin_entry(httpd_conn_t * conn, hrequest_t * req)
+_soap_admin_entry(httpd_conn_t * conn, struct hrequest_t * req)
{
if (req->method == HTTP_REQUEST_GET)
{
diff --git a/libcsoap/soap-admin.h b/libcsoap/soap-admin.h
index e49fbba..1d121b3 100644
--- a/libcsoap/soap-admin.h
+++ b/libcsoap/soap-admin.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-admin.h,v 1.3 2006/11/19 09:40:14 m0gg Exp $
+ * $Id: soap-admin.h,v 1.4 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -21,8 +21,8 @@
*
* Email: ferhatayaz@yahoo.com
******************************************************************/
-#ifndef cSOAP_ADMIN_H
-#define cSOAP_ADMIN_H
+#ifndef __csoap_admin_h
+#define __csoap_admin_h
#define CSOAP_ENABLE_ADMIN "-CSOAPadmin"
@@ -35,14 +35,16 @@ extern "C" {
#endif
/**
- Initializes the soap admin HTTP interface with commandline arguments.
-
- @param argc commandline arg count
- @param argv commandline arg vector
-
- @returns 1 if success, 0 otherwise
+ *
+ * Initializes the soap admin HTTP interface with commandline arguments.
+ *
+ * @param argc commandline arg count
+ * @param argv commandline arg vector
+ *
+ * @returns 1 if success, 0 otherwise
+ *
*/
-herror_t soap_admin_init_args(int argc, char *argv[]);
+extern herror_t soap_admin_init_args(int argc, char **argv);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c
index 4e12650..a49ba2a 100644
--- a/libcsoap/soap-client.c
+++ b/libcsoap/soap-client.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-client.c,v 1.29 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-client.c,v 1.30 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,16 +25,10 @@
#include <config.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#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-server.h>
#include <nanohttp/nanohttp-logging.h>
@@ -63,13 +57,20 @@ soap_client_destroy(void)
}
herror_t
-soap_client_invoke(SoapCtx *req, SoapCtx **res, const char *url, const char *action)
+soap_client_invoke(struct SoapCtx *req, struct SoapCtx **res, const char *url, const char *action)
{
+ char *id;
+
log_verbose2("action = \"%s\"", action);
soap_addressing_set_action_string(req->env, action);
log_verbose2("url = \"%s\"", url);
soap_addressing_set_to_address_string(req->env, url);
+ soap_addressing_set_message_id_string(req->env, NULL);
+ id = soap_addressing_get_message_id_string(req->env);
+ log_verbose2("message id = \"%s\"", id);
+ free(id);
+
return soap_transport_client_invoke(req, res);
}
diff --git a/libcsoap/soap-client.h b/libcsoap/soap-client.h
index d8bf6ee..f74d881 100644
--- a/libcsoap/soap-client.h
+++ b/libcsoap/soap-client.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-client.h,v 1.13 2006/03/06 13:37:38 m0gg Exp $
+ * $Id: soap-client.h,v 1.14 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -21,11 +21,8 @@
*
* Email: ayaz@jprogrammer.net
******************************************************************/
-#ifndef cSOAP_CLIENT_H
-#define cSOAP_CLIENT_H
-
-#include <libcsoap/soap-env.h>
-#include <libcsoap/soap-ctx.h>
+#ifndef __csoap_client_h
+#define __csoap_client_h
#define SOAP_ERROR_CLIENT_INIT 5001
@@ -34,44 +31,32 @@ extern "C" {
#endif
/**
- Initializes the client side soap engine
-*/
-herror_t soap_client_init_args(int argc, char *argv[]);
-
-
-/**
- Destroy the soap client module
-*/
-void soap_client_destroy();
-
+ *
+ * Initializes the client side soap engine
+ *
+ */
+extern herror_t soap_client_init_args(int argc, char **argv);
/**
- Establish connection to the soap server and send
- the given envelope.
-
- @param env envelope to send
- @param response the result envelope
- @param url url to the soap server
- @soap_action value for "SoapAction:" in the
- HTTP request header.
-
- @returns H_OK if success
+ *
+ * Establish connection to the soap server and send the given envelope.
+ *
+ * @param env envelope to send
+ * @param response the result envelope
+ * @param url url to the soap server
+ * @soap_action value for "SoapAction:" in the HTTP request header.
+ *
+ * @returns H_OK if success
+ *
*/
-herror_t soap_client_invoke(SoapCtx * ctx, SoapCtx ** response,
- const char *url, const char *soap_action);
-
-
+extern herror_t soap_client_invoke(struct SoapCtx * ctx, struct SoapCtx **response, const char *url, const char *soap_action);
/**
- Sets the underlaying socket to use while connecting
- into block mode or not block mode.
- The default mode is always non-blocking mode.
-
- @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();
+ *
+ * Destroy the soap client module
+ *
+ */
+extern void soap_client_destroy(void);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-ctx.c b/libcsoap/soap-ctx.c
index 2db0e7e..25c34dd 100755
--- a/libcsoap/soap-ctx.c
+++ b/libcsoap/soap-ctx.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.c,v 1.12 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-ctx.c,v 1.13 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -50,12 +50,12 @@
#include "soap-env.h"
#include "soap-ctx.h"
-SoapCtx *
-soap_ctx_new(SoapEnv * env) /* should only be used internally */
+struct SoapCtx *
+soap_ctx_new(struct SoapEnv * env) /* should only be used internally */
{
- SoapCtx *ctx;
+ struct SoapCtx *ctx;
- if (!(ctx = (SoapCtx *) malloc(sizeof(SoapCtx))))
+ if (!(ctx = (struct SoapCtx *) malloc(sizeof(struct SoapCtx))))
{
log_error2("malloc failed (%s)", strerror(errno));
return NULL;
@@ -69,7 +69,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(struct SoapCtx * ctx, attachments_t * attachments)
{
part_t *part;
char href[MAX_HREF_SIZE];
@@ -87,7 +87,7 @@ soap_ctx_add_files(SoapCtx * ctx, attachments_t * attachments)
herror_t
-soap_ctx_add_file(SoapCtx * ctx, const char *filename,
+soap_ctx_add_file(struct SoapCtx * ctx, const char *filename,
const char *content_type, char *dest_href)
{
char cid[250];
@@ -116,7 +116,7 @@ soap_ctx_add_file(SoapCtx * ctx, const char *filename,
}
part_t *
-soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node)
+soap_ctx_get_file(struct SoapCtx * ctx, xmlNodePtr node)
{
xmlChar *prop;
char href[MAX_HREF_SIZE];
@@ -156,7 +156,7 @@ soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node)
}
void
-soap_ctx_free(SoapCtx * ctx)
+soap_ctx_free(struct SoapCtx * ctx)
{
if (!ctx)
return;
@@ -174,9 +174,9 @@ soap_ctx_free(SoapCtx * 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, struct SoapCtx ** out)
{
- SoapEnv *env;
+ struct SoapEnv *env;
herror_t err;
err = soap_env_new_with_method(urn, method, &env);
if (err != H_OK)
diff --git a/libcsoap/soap-ctx.h b/libcsoap/soap-ctx.h
index 93631d2..b8bfb3d 100755
--- a/libcsoap/soap-ctx.h
+++ b/libcsoap/soap-ctx.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-ctx.h,v 1.11 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-ctx.h,v 1.12 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -29,26 +29,25 @@
#define MAX_HREF_SIZE 150
-typedef struct _SoapCtx
+struct SoapCtx
{
- SoapEnv *env;
+ struct SoapEnv *env;
attachments_t *attachments;
-} SoapCtx;
+};
#ifdef __cplusplus
extern "C" {
#endif
/* should only be used internally */
-extern SoapCtx *soap_ctx_new(SoapEnv * env);
+extern struct SoapCtx *soap_ctx_new(struct SoapEnv * env);
/**
Creates a new soap context object.
*/
-extern herror_t soap_ctx_new_with_method(const char *urn, const char *method,
- SoapCtx ** out);
+extern herror_t soap_ctx_new_with_method(const char *urn, const char *method, struct SoapCtx ** out);
-extern void soap_ctx_free(SoapCtx * ctx);
+extern void soap_ctx_free(struct SoapCtx * ctx);
/**
Returns the attached file if any found.
@param ctx the SoapCtx object which should contain the part
@@ -57,16 +56,16 @@ extern void soap_ctx_free(SoapCtx * ctx);
@returns a part_t object of attachment was found, NULL otherwise.
*/
-extern part_t *soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node);
+extern part_t *soap_ctx_get_file(struct SoapCtx * ctx, xmlNodePtr node);
/* Size of destination dest_href should be MAX_HREF_SIZE */
-extern herror_t soap_ctx_add_file(SoapCtx * ctx, const char *filename,
+extern herror_t soap_ctx_add_file(struct 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.
*/
-extern void soap_ctx_add_files(SoapCtx * ctx, attachments_t * attachments);
+extern void soap_ctx_add_files(struct SoapCtx * ctx, attachments_t * attachments);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index 9882cfb..6bdce39 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.23 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-env.c,v 1.24 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -50,6 +50,7 @@
#endif
#include <libxml/tree.h>
+#include <libxml/xpath.h>
#include <libxml/xmlstring.h>
#include <nanohttp/nanohttp-common.h>
@@ -164,14 +165,14 @@ 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, struct SoapEnv ** out)
{
xmlNodePtr node;
- SoapEnv *env;
+ struct SoapEnv *env;
if (doc == NULL)
{
- log_error1("Can not create xml document!");
+ log_error1("Cannot create XML document!");
return herror_new("soap_env_new_from_doc",
GENERAL_INVALID_PARAM,
"XML Document (xmlDocPtr) is NULL");
@@ -184,10 +185,10 @@ soap_env_new_from_doc(xmlDocPtr doc, SoapEnv ** out)
XML_ERROR_EMPTY_DOCUMENT, "XML Document is empty!");
}
- if (!(env = (SoapEnv *) malloc(sizeof(SoapEnv))))
+ if (!(env = (struct SoapEnv *) malloc(sizeof(struct SoapEnv))))
{
log_error2("malloc failed (%s)", strerror(errno));
- return herror_new("soap_env_from_doc", GENERAL_INVALID_PARAM, "malloc failed");
+ return herror_new("soap_env_from_doc", GENERAL_INVALID_PARAM, "malloc failed (%s)", strerror(errno));
}
env->root = node;
@@ -202,7 +203,7 @@ 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, struct SoapEnv **out)
{
xmlDocPtr doc;
herror_t err;
@@ -213,7 +214,7 @@ soap_env_new_from_buffer(const char *buffer, SoapEnv ** out)
if (!(doc = xmlParseDoc(BAD_CAST buffer)))
return herror_new("soap_env_new_from_buffer",
- XML_ERROR_PARSE, "Can not parse xml");
+ XML_ERROR_PARSE, "Cannot parse XML");
if ((err = soap_env_new_from_doc(doc, out)) != H_OK)
{
@@ -224,13 +225,13 @@ soap_env_new_from_buffer(const char *buffer, SoapEnv ** out)
herror_t
-soap_env_new_with_fault(int faultcode, const char *faultstring, const char *faultactor, const char *detail, SoapEnv **out)
+soap_env_new_with_fault(int faultcode, const char *faultstring, const char *faultactor, const char *detail, struct SoapEnv **out)
{
xmlDocPtr doc;
herror_t err;
if (!(doc = soap_fault_build(faultcode, faultstring, faultactor, detail)))
- 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, "Cannot parse fault XML");
if ((err = soap_env_new_from_doc(doc, out)) != H_OK)
xmlFreeDoc(doc);
@@ -240,11 +241,12 @@ soap_env_new_with_fault(int faultcode, const char *faultstring, const char *faul
herror_t
-soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
+soap_env_new_with_response(struct SoapEnv * request, struct SoapEnv ** out)
{
- char *method, *res_method;
+ const char *method;
+ char *res_method;
herror_t ret;
- char *urn;
+ const char *urn;
if (request == NULL)
{
@@ -256,7 +258,7 @@ soap_env_new_with_response(SoapEnv * request, SoapEnv ** out)
{
return herror_new("soap_env_new_with_response",
GENERAL_INVALID_PARAM,
- "request (first param) has no xml structure");
+ "request (first param) has no XML structure");
}
if (!(method = soap_env_find_methodname(request)))
@@ -289,7 +291,7 @@ soap_env_new_with_response(SoapEnv * request, SoapEnv ** 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, struct SoapEnv ** out)
{
xmlDocPtr env;
xmlChar buffer[1054];
@@ -312,47 +314,45 @@ soap_env_new_with_method(const char *urn, const char *method, SoapEnv ** out)
if (!(env = xmlParseDoc(buffer)))
return herror_new("soap_env_new_with_method",
- XML_ERROR_PARSE, "Can not parse xml");
+ XML_ERROR_PARSE, "Can not parse XML");
return soap_env_new_from_doc(env, out);
}
xmlNodePtr
-soap_env_add_item(SoapEnv * call, const char *type, const char *name, const char *value)
+soap_env_add_item(struct SoapEnv * call, const char *type, const char *name, const char *value)
{
- xmlNodePtr newnode;
+ 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)
+ 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;
}
}
- return newnode;
+ return newNode;
}
xmlNodePtr
-soap_env_add_itemf(SoapEnv * call, const char *type,
- const char *name, const char *format, ...)
+soap_env_add_itemf(struct 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);
@@ -362,13 +362,13 @@ soap_env_add_itemf(SoapEnv * call, const char *type,
xmlNodePtr
-soap_env_add_attachment(SoapEnv * call, const char *name, const char *href)
+soap_env_add_attachment(struct SoapEnv * call, const char *name, const char *href)
{
- xmlNodePtr newnode;
+ 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)
+ if (newNode == NULL)
{
log_error1("Can not create new xml node");
return NULL;
@@ -376,19 +376,19 @@ soap_env_add_attachment(SoapEnv * call, const char *name, const char *href)
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");
return NULL;
}
}
- return newnode;
+ return newNode;
}
void
-soap_env_add_custom(SoapEnv * call, void *obj, XmlSerializerCallback cb, const char *type, const char *name)
+soap_env_add_custom(struct SoapEnv * call, void *obj, XmlSerializerCallback cb, const char *type, const char *name)
{
struct XmlNodeHolder holder;
@@ -403,7 +403,7 @@ soap_env_add_custom(SoapEnv * call, void *obj, XmlSerializerCallback cb, const c
xmlNodePtr
-soap_env_push_item(SoapEnv * call, const char *type, const char *name)
+soap_env_push_item(struct SoapEnv * call, const char *type, const char *name)
{
xmlNodePtr node;
@@ -416,7 +416,7 @@ soap_env_push_item(SoapEnv * call, const char *type, const char *name)
void
-soap_env_pop_item(SoapEnv * call)
+soap_env_pop_item(struct SoapEnv * call)
{
call->cur = call->cur->parent;
@@ -425,7 +425,7 @@ soap_env_pop_item(SoapEnv * call)
void
-soap_env_free(SoapEnv * env)
+soap_env_free(struct SoapEnv * env)
{
if (env)
{
@@ -441,7 +441,7 @@ soap_env_free(SoapEnv * env)
xmlNodePtr
-soap_env_get_body(SoapEnv * env)
+soap_env_get_body(struct SoapEnv * env)
{
xmlNodePtr node;
@@ -470,7 +470,7 @@ soap_env_get_body(SoapEnv * env)
xmlNodePtr
-soap_env_get_header(SoapEnv *env)
+soap_env_get_header(struct SoapEnv *env)
{
xmlNodePtr node;
@@ -498,7 +498,7 @@ soap_env_get_header(SoapEnv *env)
xmlNodePtr
-soap_env_get_fault(SoapEnv * env)
+soap_env_get_fault(struct SoapEnv * env)
{
xmlNodePtr node;
@@ -520,7 +520,7 @@ soap_env_get_fault(SoapEnv * env)
xmlNodePtr
-soap_env_get_method(SoapEnv * env)
+soap_env_get_method(struct SoapEnv * env)
{
xmlNodePtr body;
@@ -537,7 +537,7 @@ soap_env_get_method(SoapEnv * env)
/* XXX: unused function? */
xmlNodePtr
-_soap_env_get_body(SoapEnv * env)
+_soap_env_get_body(struct SoapEnv * env)
{
xmlNodePtr body;
xmlNodeSetPtr nodeset;
@@ -545,13 +545,13 @@ _soap_env_get_body(SoapEnv * env)
if (env == NULL)
{
- log_error1("SoapEnv is NULL");
+ log_error1("struct SoapEnv is NULL");
return NULL;
}
if (env->root == NULL)
{
- log_error1("SoapEnv contains no XML document");
+ log_error1("struct SoapEnv contains no XML document");
return NULL;
}
@@ -582,12 +582,11 @@ _soap_env_get_body(SoapEnv * env)
body = nodeset->nodeTab[0]; /* body is <Body> */
xmlXPathFreeObject(xpathobj);
return body;
-
}
-char *
-soap_env_find_urn(SoapEnv * env)
+const char *
+soap_env_find_urn(struct SoapEnv * env)
{
xmlNsPtr ns;
xmlNodePtr body, node;
@@ -595,14 +594,14 @@ soap_env_find_urn(SoapEnv * env)
if (!(body = soap_env_get_body(env)))
{
log_verbose1("body is NULL");
- return 0;
+ return NULL;
}
/* node is the first child */
if (!(node = soap_xml_get_children(body)))
{
log_error1("No namespace found");
- return 0;
+ return NULL;
}
/* if (node->ns && node->ns->prefix) MRC 1/25/2006 */
@@ -611,7 +610,7 @@ soap_env_find_urn(SoapEnv * env)
ns = xmlSearchNs(body->doc, node, node->ns->prefix);
if (ns != NULL)
{
- return((char *) ns->href); /* namespace found! */
+ return ((char *) ns->href); /* namespace found! */
}
}
else
@@ -621,35 +620,32 @@ soap_env_find_urn(SoapEnv * env)
return(empty);
}
- return 0;
+ return NULL;
}
-char *
-soap_env_find_methodname(SoapEnv * env)
+const char *
+soap_env_find_methodname(struct SoapEnv * env)
{
xmlNodePtr body, node;
- body = soap_env_get_body(env);
- if (body == NULL)
- return 0;
+ if (!(body = soap_env_get_body(env)))
+ return NULL;
node = soap_xml_get_children(body); /* node is the first child */
if (node == NULL)
{
log_error1("No method found");
- return 0;
+ return NULL;
}
if (node->name == NULL)
{
log_error1("No methodname found");
- return 0;
+ return NULL;
}
- return((char *) node->name);
+ return ((char *) node->name);
}
-
-
diff --git a/libcsoap/soap-env.h b/libcsoap/soap-env.h
index 2da9528..b73bb38 100644
--- a/libcsoap/soap-env.h
+++ b/libcsoap/soap-env.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-env.h,v 1.16 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-env.h,v 1.17 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -21,300 +21,306 @@
*
* Email: ayaz@jprogrammer.net
******************************************************************/
-#ifndef cSOAP_ENV_H
-#define cSOAP_ENV_H
+#ifndef __csoap_env_h
+#define __csoap_env_h
/**
- The SOAP envelope object.
+ *
+ * The SOAP envelope namespace
+ *
*/
-typedef struct _SoapEnv
+static const char * const soap_env_ns = "http://schemas.xmlsoap.org/soap/envelope/";
+
+/**
+ *
+ * The SOAP envelope object.
+ *
+ */
+struct SoapEnv
{
xmlNodePtr root; /** Pointer to the firts xml element (envelope) */
xmlNodePtr header;
xmlNodePtr body;
xmlNodePtr cur; /** Pointer to the current xml element. (stack) */
-} SoapEnv;
+};
+
+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);
#ifdef __cplusplus
extern "C" {
#endif
-
-/* -------------------------------------------------------------- */
-/* Envelope creation methods */
-/* -------------------------------------------------------------- */
-
/**
- Creates an envelope with a fault object.
-
- @param faultcode The fault code @see fault_code_t
- @param faultstring A fault message
- @param faultactor The fault actor (This can be NULL)
- @param detail The detail of the error (This can be NULL)
- @param out the result envelope out parameter like follows
- @returns H_OK if success
-
- <pre>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
- xmlns:xsi="..."
- xmlns:xsd="...">
- <SOAP-ENV:Body>
-
- <Fault>
- <faultcode>...</faultcode>
- <faultstring>...</faultstring>
- <faultactor>...</faultactor>
- <faultdetail>..</faultdetail>
- </Fault>
-
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
-
- </pre>
-
+ *
+ * Creates an envelope with a fault object.
+ *
+ * @param faultcode The fault code @see fault_code_t
+ * @param faultstring A fault message
+ * @param faultactor The fault actor (This can be NULL)
+ * @param detail The detail of the error (This can be NULL)
+ * @param out the result envelope out parameter like follows
+ *
+ * <pre>
+ * <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
+ * xmlns:xsi="..."
+ * xmlns:xsd="...">
+ * <SOAP-ENV:Body>
+ *
+ * <Fault>
+ * <faultcode>...</faultcode>
+ * <faultstring>...</faultstring>
+ * <faultactor>...</faultactor>
+ * <faultdetail>..</faultdetail>
+ * </Fault>
+ *
+ * </SOAP-ENV:Body>
+ * </SOAP-ENV:Envelope>
+ * </pre>
+ *
+ * @returns H_OK if success
+ *
+ * @see soap_fault_new
+ *
*/
-herror_t
-soap_env_new_with_fault(int faultcode,
- const char *faultstring,
- const char *faultactor,
- const char *detail, SoapEnv ** out);
+extern herror_t soap_env_new_with_fault(int faultCode, const char *faultString, const char *faultActor, const char *detail, struct SoapEnv **out);
/**
- Creates an envelope with a method to invoke a soap service.
- Use this function to create a client call.
-
- @param urn The urn of the soap service to invoke
- @param method The method name of the soap service
-
- @param out the result envelope out parameter like follows
- @returns H_OK if success
-
- <pre>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
- xmlns:xsi="..."
- xmlns:xsd="...">
- <SOAP-ENV:Body>
-
- <m:[method] xmlns:m="[urn]">
- </m:[method]>
-
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
-
- </pre>
-
+ *
+ * Creates an envelope with a method to invoke a soap service.
+ * Use this function to create a client call.
+ *
+ * @param urn The urn of the soap service to invoke
+ * @param method The method name of the soap service
+ *
+ * @param out the result envelope out parameter like follows
+ * @returns H_OK if success
+ *
+ * <pre>
+ * <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
+ * xmlns:xsi="..."
+ * xmlns:xsd="...">
+ * <SOAP-ENV:Body>
+ *
+ * <m:[method] xmlns:m="[urn]">
+ * </m:[method]>
+ *
+ * </SOAP-ENV:Body>
+ * </SOAP-ENV:Envelope>
+ *
+ * </pre>
+ *
*/
-herror_t
-soap_env_new_with_method(const char *urn, const char *method, SoapEnv ** out);
-
+extern herror_t soap_env_new_with_method(const char *urn, const char *method, struct SoapEnv ** out);
/**
- Creates a soap envelope with a response.
- Use this function to create a response envelope object
- for a request. This function is only relevant for soap
- service implementors.
-
- @see example csoap/simpleserver.c
-
- @param req The request object. A response object will be created
- to this request.
-
- @param out the result envelope out paramter like follows
- @returns H_OK if success
-
- <pre>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
- xmlns:xsi="..."
- xmlns:xsd="...">
- <SOAP-ENV:Body>
-
- <m:[req-method]Response xmlns:m="[req-urn]">
- </m:[req-method]>
-
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
-
- </pre>
-
-
+ *
+ * Creates a soap envelope with a response.
+ * Use this function to create a response envelope object
+ * for a request. This function is only relevant for soap
+ * service implementors.
+ *
+ * @see example csoap/simpleserver.c
+ *
+ * @param req The request object. A response object will be created
+ * to this request.
+ *
+ * @param out the result envelope out paramter like follows
+ * @returns H_OK if success
+ *
+ * <pre>
+ * <SOAP-ENV:Envelope xmlns:SOAP-ENV="..." SOAP-ENV:encoding="..."
+ * xmlns:xsi="..."
+ * xmlns:xsd="...">
+ * <SOAP-ENV:Body>
+ *
+ * <m:[req-method]Response xmlns:m="[req-urn]">
+ * </m:[req-method]>
+ *
+ * </SOAP-ENV:Body>
+ * </SOAP-ENV:Envelope>
+ *
+ * </pre>
+ *
+ *
*/
-herror_t soap_env_new_with_response(SoapEnv * req, SoapEnv ** out);
-
+extern herror_t soap_env_new_with_response(struct SoapEnv * req, struct SoapEnv ** out);
/**
- Creates an envelope from a given libxml2 xmlDoc
- pointer.
-
- @param doc the xml document pointer
- @param out the output envelope object
- @returns H_OK if success
-
+ *
+ * Creates an envelope from a given libxml2 xmlDocPtr.
+ *
+ * @param doc the xml document pointer
+ * @param out the output envelope object
+ *
+ * @returns H_OK if success
+ *
*/
-herror_t soap_env_new_from_doc(xmlDocPtr doc, SoapEnv ** out);
-
+extern herror_t soap_env_new_from_doc(xmlDocPtr doc, struct SoapEnv ** out);
/**
- Create an envelop object from a string.
- The string must be in xml format.
-
- @param buffer The string to parse into a envelope.
- @param out the output envelope object
- @returns H_OK if success
+ *
+ * Create an envelop object from a string.
+ * The string must be in xml format.
+ *
+ * @param buffer The string to parse into a envelope.
+ * @param out the output envelope object
+ * @returns H_OK if success
*/
-herror_t soap_env_new_from_buffer(const char *buffer, 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);
-
-/* ------------------------------------------------------ */
-/* XML build and stack function */
-/* ------------------------------------------------------ */
-
+extern herror_t soap_env_new_from_buffer(const char *buffer, struct SoapEnv ** out);
/**
- Adds a new xml node under the current parent.
-
- <pre>
- <m:[name] type=[type]>[value]</m:[name]>
- </pre>
-
- @param env The envelope object
- @param type Type of the parameter. Something like "xsd:string" or
- "xsd:int" or custom types.
- @param name Name of the xml node
- @param value Text value of the xml node
-
- @returns The added xmlNode pointer.
-
- @see tutorial
+ *
+ * Adds a new xml node under the current parent.
+ *
+ * <pre>
+ * <m:[name] type=[type]>[value]</m:[name]>
+ * </pre>
+ *
+ * @param env The envelope object
+ * @param type Type of the parameter. Something like "xsd:string" or
+ * "xsd:int" or custom types.
+ * @param name Name of the xml node
+ * @param value Text value of the xml node
+ *
+ * @returns The added xmlNode pointer.
+ *
+ * @see tutorial
+ *
*/
-xmlNodePtr
-soap_env_add_item(SoapEnv * env, const char *type,
- const char *name, const char *value);
-
+extern xmlNodePtr soap_env_add_item(struct SoapEnv * env, const char *type, const char *name, const char *value);
/**
- Adds attachment href node to the envelope current parent.
-
- <pre>
- <m:[name] href=[href]/>
- </pre>
-
- @param env The envelope object
- @param name Name of the xml node
- @param href href. A CID string filled by
- soap_ctx_add_attachment()
-
- @returns The added xmlNode pointer.
-
- @see soap_ctx_add_file tutorial
+ *
+ * Adds attachment href node to the envelope current parent.
+ *
+ * <pre>
+ * <m:[name] href=[href]/>
+ * </pre>
+ *
+ * @param env The envelope object
+ * @param name Name of the xml node
+ * @param href href. A CID string filled by
+ * soap_ctx_add_attachment()
+ *
+ * @returns The added xmlNode pointer.
+ *
+ * @see soap_ctx_add_file tutorial
*/
-xmlNodePtr
-soap_env_add_attachment(SoapEnv * env, const char *name, const char *href);
-
+extern xmlNodePtr
+soap_env_add_attachment(struct SoapEnv * env, const char *name, const char *href);
/**
- Serialize and adds obj to the envelope.
- TODO: Document this function !
- <br>
- <b>Important: </b>
-
+ *
+ * Serialize and adds obj to the envelope.
+ * TODO: Document this function !
+ * <br>
+ * <b>Important: </b>
+ *
*/
-void
-soap_env_add_custom(SoapEnv * env, void *obj, XmlSerializerCallback cb,
- const char *type, const char *name);
+extern void soap_env_add_custom(struct SoapEnv * env, void *obj, XmlSerializerCallback cb, const char *type, const char *name);
/**
- Same as soap_env_add_item() with c style arguments
- like in printf(). "value" is the format string.
- <br>
- <b>Important: </b> The totally length of value (incl. args)
- must be lower the 1054.
-
- @see soap_env_add_item
+ *
+ * Same as soap_env_add_item() with c style arguments
+ * like in printf(). "value" is the format string.
+ * <br>
+ * <b>Important: </b> The totally length of value (incl. args)
+ * must be lower the 1054.
+ *
+ * @see soap_env_add_item
*/
-xmlNodePtr
-soap_env_add_itemf(SoapEnv * env, const char *type,
- const char *name, const char *value, ...);
-
+extern xmlNodePtr
+soap_env_add_itemf(struct SoapEnv * env, const char *type, const char *name, const char *value, ...);
/**
- Push the current xml node in the soap envelope one level
- deeper. Here an example:
-
- <pre>
- soap_env_push_item(env, "my:custom", "Person");
- soap_env_add_item(env, "xsd:string", "name", "Mickey");
- soap_env_add_item(env, "xsd:string", "lastname", "Mouse");
- soap_env_pop_item(env);
- </pre>
-
- This will create the xml like follows.
-
- <pre>
- <Person type="my:custom">
- <name>Mickey</name>
- <lastname>Mouse</lastname>
- </Person>
- </pre>
-
- @returns The added xmlNode pointer.
-
- @see tutorial
+ *
+ * Push the current xml node in the soap envelope one level
+ * deeper. Here an example:
+ *
+ * <pre>
+ * soap_env_push_item(env, "my:custom", "Person");
+ * soap_env_add_item(env, "xsd:string", "name", "Mickey");
+ * soap_env_add_item(env, "xsd:string", "lastname", "Mouse");
+ * soap_env_pop_item(env);
+ * </pre>
+ *
+ * This will create the xml like follows.
+ *
+ * <pre>
+ * <Person type="my:custom">
+ * <name>Mickey</name>
+ * <lastname>Mouse</lastname>
+ * </Person>
+ * </pre>
+ *
+ * @returns The added xmlNode pointer.
+ *
+ * @see tutorial
+ *
*/
-xmlNodePtr soap_env_push_item(SoapEnv * env, const char *type, const char *name);
+extern xmlNodePtr soap_env_push_item(struct SoapEnv * env, const char *type, const char *name);
/**
- Sets the xml pointer 1 level higher.
-
- @param env The envelope object
- @see soap_env_push_item
+ *
+ * Sets the xml pointer 1 level higher.
+ *
+ * @param env The envelope object
+ *
+ * @see soap_env_push_item
*/
-void soap_env_pop_item(SoapEnv * env);
+extern void soap_env_pop_item(struct SoapEnv * env);
/**
- Free the envelope.
-
- @param env The envelope object
+ *
+ * Free the envelope.
+ *
+ * @param env The envelope object
+ *
*/
-void soap_env_free(SoapEnv * env);
-
-
-/* --------------------------------------------------- */
-/* XML node finder functions */
-/* --------------------------------------------------- */
-
+extern void soap_env_free(struct SoapEnv * env);
/**
- Gets the xml node pointing to SOAP Body.
+ *
+ * Gets the xml node pointing to SOAP Body.
+ *
*/
-xmlNodePtr soap_env_get_body(SoapEnv * env);
+extern xmlNodePtr soap_env_get_body(struct SoapEnv * env);
/**
- Get the xml node pointing to SOAP method (call)
+ *
+ * Get the xml node pointing to SOAP method (call)
+ *
*/
-xmlNodePtr soap_env_get_method(SoapEnv * env);
-
+extern xmlNodePtr soap_env_get_method(struct SoapEnv * env);
/**
- Get the xml node pointing to SOAP Fault
+ *
+ * Get the xml node pointing to SOAP Fault
+ *
*/
-xmlNodePtr soap_env_get_fault(SoapEnv * env);
-
+extern xmlNodePtr soap_env_get_fault(struct SoapEnv * env);
/**
- Get the xml node pointing to SOAP Header
+ *
+ * Get the xml node pointing to SOAP Header
+ *
*/
-xmlNodePtr soap_env_get_header(SoapEnv * env);
+extern xmlNodePtr soap_env_get_header(struct SoapEnv * env);
+/**
+ *
+ * Get the URN of the message.
+ *
+ */
+extern const char *soap_env_find_urn(struct SoapEnv * env);
-char * soap_env_find_urn(SoapEnv * env);
-char * soap_env_find_methodname(SoapEnv * env);
+/**
+ *
+ * Get the method of the message.
+ *
+ */
+extern const char *soap_env_find_methodname(struct SoapEnv * env);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-fault.c b/libcsoap/soap-fault.c
index 6781e1e..242a51a 100644
--- a/libcsoap/soap-fault.c
+++ b/libcsoap/soap-fault.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-fault.c,v 1.12 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-fault.c,v 1.13 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -29,11 +29,17 @@
#include <string.h>
#endif
+#include <libxml/xpath.h>
+
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-xml.h"
-// #include "soap-server.h"
+#include "soap-env.h"
+#include "soap-ctx.h"
+#include "soap-service.h"
+#include "soap-router.h"
+#include "soap-server.h"
#include "soap-fault.h"
/*
diff --git a/libcsoap/soap-nhttp.c b/libcsoap/soap-nhttp.c
index a49800b..b8b0e35 100644
--- a/libcsoap/soap-nhttp.c
+++ b/libcsoap/soap-nhttp.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-nhttp.c,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-nhttp.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -37,38 +37,30 @@
#include <errno.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef WIN32
-#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
-#endif
-
#include <libxml/tree.h>
#include <libxml/uri.h>
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-logging.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-server.h>
-#include "soap-admin.h"
#include "soap-fault.h"
#include "soap-env.h"
#include "soap-ctx.h"
#include "soap-service.h"
-#include "soap-router.h"
-#include "soap-server.h"
#include "soap-client.h"
+#include "soap-transport.h"
#include "soap-addressing.h"
+#include "soap-admin.h"
+#include "soap-wsil.h"
+
#include "soap-nhttp.h"
static herror_t
@@ -98,7 +90,7 @@ _soap_nhttp_send_fault(httpd_conn_t *conn, const char *message)
xmlDocPtr doc;
herror_t ret;
- doc = soap_fault_build(SOAP_FAULT_SENDER, message, soap_server_get_name(), NULL);
+ doc = soap_fault_build(SOAP_FAULT_SENDER, message, soap_transport_get_name(), NULL);
ret = _soap_nhttp_send_document(conn, doc);
xmlFreeDoc(doc);
@@ -106,7 +98,7 @@ _soap_nhttp_send_fault(httpd_conn_t *conn, const char *message)
}
static herror_t
-_soap_nhttp_send(httpd_conn_t *conn, SoapCtx *context, SoapEnv *env)
+_soap_nhttp_send(httpd_conn_t *conn, struct SoapCtx *context, struct SoapEnv *env)
{
return _soap_nhttp_send_document(conn, env->root->doc);
}
@@ -116,7 +108,7 @@ _soap_nhttp_xml_io_read(void *ctx, char *buffer, int len)
{
int ret;
- http_input_stream_t *in = (http_input_stream_t *)ctx;
+ struct http_input_stream_t *in = (struct http_input_stream_t *)ctx;
if (!http_input_stream_is_ready(in))
return 0;
@@ -134,7 +126,7 @@ _soap_nhttp_xml_io_close(void *ctx)
}
static herror_t
-_soap_nhttp_env_new_from_stream(http_input_stream_t *in, SoapEnv **out)
+_soap_nhttp_env_new_from_stream(struct http_input_stream_t *in, struct SoapEnv **out)
{
xmlDocPtr doc;
@@ -143,18 +135,18 @@ _soap_nhttp_env_new_from_stream(http_input_stream_t *in, SoapEnv **out)
return in->err;
if (doc == NULL)
- return herror_new("_soap_nhttp_env_new_from_stream", XML_ERROR_PARSE, "Trying to parse not valid xml");
+ return herror_new("_soap_nhttp_env_new_from_stream", XML_ERROR_PARSE, "Trying to parse invalid XML");
return soap_env_new_from_doc(doc, out);
}
static void
-soap_nhttp_process(httpd_conn_t * conn, hrequest_t * req)
+soap_nhttp_process(httpd_conn_t * conn, struct hrequest_t * req)
{
char *action;
- SoapEnv *env;
- SoapCtx *ctx;
- SoapCtx *response;
+ struct SoapEnv *env;
+ struct SoapCtx *ctx;
+ struct SoapCtx *response;
herror_t err;
/* if (req->method == HTTP_REQUEST_GET && router->wsdl)
@@ -203,14 +195,14 @@ soap_nhttp_process(httpd_conn_t * conn, hrequest_t * req)
xmlFree(uri);
}
- soap_xml_doc_print(ctx->env->root->doc);
+ xmlDocDump(stdout, ctx->env->root->doc);
soap_ctx_add_files(ctx, req->attachments);
/* only local part is interesting... */
soap_addressing_set_to_address_string(ctx->env, req->path);
- soap_server_process(ctx, &response);
+ soap_transport_process(ctx, &response);
_soap_nhttp_send_document(conn, response->env->root->doc);
@@ -227,13 +219,22 @@ soap_nhttp_server_init_args(int argc, char **argv)
herror_t err;
if ((err = httpd_init(argc, argv)) != H_OK)
+ {
+ log_error2("httpd_init failed (%s)", herror_message(err));
+ return err;
+ }
+
+ if ((err = soap_wsil_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_wsil_init_args failed (%s)", herror_message(err));
return err;
-
+ }
+
return soap_admin_init_args(argc, argv);
}
static herror_t
-_soap_nhttp_client_build_result(hresponse_t * res, SoapEnv ** env)
+_soap_nhttp_client_build_result(hresponse_t * res, struct SoapEnv ** env)
{
log_verbose2("Building result (%p)", res);
@@ -253,7 +254,7 @@ _soap_nhttp_client_build_result(hresponse_t * res, SoapEnv ** env)
}
static herror_t
-_soap_nhttp_client_invoke(void *unused, SoapCtx *request, SoapCtx **response)
+_soap_nhttp_client_invoke(void *unused, struct SoapCtx *request, struct SoapCtx **response)
{
herror_t status;
@@ -263,7 +264,7 @@ _soap_nhttp_client_invoke(void *unused, SoapCtx *request, SoapCtx **response)
char tmp[15];
char *action;
char *url;
- SoapEnv *res_env;
+ struct SoapEnv *res_env;
/* Transport variables */
httpc_conn_t *conn;
@@ -284,7 +285,7 @@ _soap_nhttp_client_invoke(void *unused, SoapCtx *request, SoapCtx **response)
xmlNodeDump(buffer, request->env->root->doc, request->env->root, 1, 0);
content = (char *) xmlBufferContent(buffer);
- soap_xml_doc_print(request->env->root->doc);
+ xmlDocDump(stdout, request->env->root->doc);
/* Transport via HTTP */
if (!(conn = httpc_new()))
@@ -412,6 +413,7 @@ _soap_nhttp_client_invoke(void *unused, SoapCtx *request, SoapCtx **response)
return H_OK;
}
+
herror_t
soap_nhttp_client_init_args(int argc, char **argv)
{
@@ -422,14 +424,18 @@ soap_nhttp_client_init_args(int argc, char **argv)
}
herror_t
-soap_nhttp_register_router(SoapRouter * router, const char *context)
+soap_nhttp_register(const void *data)
{
+ herror_t status;
+ const char *context;
+
+ context = (char *)data;
- if (!httpd_register_secure(context, soap_nhttp_process, router->auth))
+ if ((status = httpd_register(context, soap_nhttp_process)) != H_OK)
{
- return /* XXX */ H_OK;
+ log_error2("httpd_register_secure failed (%s)", herror_message(status));
+ return status;
}
-
return H_OK;
}
@@ -447,7 +453,6 @@ soap_nhttp_server_destroy(void)
return;
}
-
void
soap_nhttp_client_destroy(void)
{
diff --git a/libcsoap/soap-nhttp.h b/libcsoap/soap-nhttp.h
index fb060b5..acb5dc3 100644
--- a/libcsoap/soap-nhttp.h
+++ b/libcsoap/soap-nhttp.h
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-nhttp.h,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-nhttp.h,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2007 Heiko Ronsdorf
@@ -47,13 +47,13 @@ extern herror_t soap_nhttp_server_init_args(int argc, char **argv);
extern herror_t soap_nhttp_server_run(void);
extern void soap_nhttp_server_destroy(void);
-extern herror_t soap_nhttp_register_router(SoapRouter *router, const char *context);
+extern herror_t soap_nhttp_register(const void *data);
extern short soap_nhttp_get_port(void);
extern const char *soap_nhttp_get_protocol(void);
extern herror_t soap_nhttp_client_init_args(int argc, char **argv);
-extern herror_t soap_nhttp_client_invoke(void *unused, SoapCtx *req, SoapCtx **res);
+extern herror_t soap_nhttp_client_invoke(void *unused, struct SoapCtx *req, struct SoapCtx **res);
extern void soap_nhttp_client_destroy(void);
#ifdef __cplusplus
diff --git a/libcsoap/soap-nudp.c b/libcsoap/soap-nudp.c
index 985cfd8..4520631 100644
--- a/libcsoap/soap-nudp.c
+++ b/libcsoap/soap-nudp.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-nudp.c,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-nudp.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -33,18 +33,10 @@
#include <errno.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#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-server.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-fault.h"
@@ -62,7 +54,7 @@ soap_nudp_server_init_args(int argc, char **argv)
}
herror_t
-soap_nudp_register_router(SoapRouter *router, const char *context)
+soap_nudp_register(const void *data)
{
return H_OK;
}
@@ -86,7 +78,7 @@ soap_nudp_client_init_args(int argc, char **argv)
}
herror_t
-soap_nudp_client_invoke(SoapCtx *req, SoapCtx **res)
+soap_nudp_client_invoke(struct SoapCtx *req, struct SoapCtx **res)
{
return H_OK;
}
diff --git a/libcsoap/soap-nudp.h b/libcsoap/soap-nudp.h
index 73bc612..9b703ae 100644
--- a/libcsoap/soap-nudp.h
+++ b/libcsoap/soap-nudp.h
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-nudp.h,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-nudp.h,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2007 Heiko Ronsdorf
@@ -33,11 +33,11 @@ extern herror_t soap_nudp_server_run(void);
extern void soap_nudp_server_destroy(void);
#ifdef __CSOAP_INTERNAL
-extern herror_t soap_nudp_register_router(SoapRouter *router, const char *context);
+extern herror_t soap_nudp_register(const void *data);
#endif
extern herror_t soap_nudp_client_init_args(int argc, char **argv);
-extern herror_t soap_nudp_client_invoke(SoapCtx *req, SoapCtx **res);
+extern herror_t soap_nudp_client_invoke(struct SoapCtx *req, struct SoapCtx **res);
extern void soap_nudp_client_destroy(void);
#ifdef __cplusplus
diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c
index 0a9ee63..c0891f6 100644
--- a/libcsoap/soap-router.c
+++ b/libcsoap/soap-router.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-router.c,v 1.12 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-router.c,v 1.13 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -33,10 +33,6 @@
#include <string.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -44,36 +40,31 @@
#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-server.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-fault.h"
-#include "soap-env.h"
#include "soap-ctx.h"
#include "soap-service.h"
#include "soap-router.h"
-SoapRouter *
+struct SoapRouter *
soap_router_new(void)
{
- SoapRouter *router;
+ struct SoapRouter *router;
- if (!(router = (SoapRouter *) malloc(sizeof(SoapRouter))))
+ if (!(router = (struct SoapRouter *) malloc(sizeof(struct SoapRouter))))
{
log_error2("malloc failed (%s)", strerror(errno));
return NULL;
}
- memset(router, 0, sizeof(SoapRouter));
+ memset(router, 0, sizeof(struct SoapRouter));
return router;
}
herror_t
-soap_router_register_service(SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn)
+soap_router_register_service(struct SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn)
{
SoapService *service;
@@ -97,7 +88,7 @@ soap_router_register_service(SoapRouter *router, SoapServiceFunc func, const cha
}
void
-soap_router_register_security(SoapRouter * router, httpd_auth auth)
+soap_router_register_security(struct SoapRouter * router, soap_auth auth)
{
router->auth = auth;
@@ -105,18 +96,18 @@ soap_router_register_security(SoapRouter * router, httpd_auth auth)
}
void
-soap_router_register_description(SoapRouter * router, xmlDocPtr wsdl)
+soap_router_register_description(struct SoapRouter * router, xmlDocPtr description)
{
- if (router->wsdl)
- xmlFreeDoc(router->wsdl);
+ if (router->description)
+ xmlFreeDoc(router->description);
- router->wsdl = xmlCopyDoc(wsdl, 1);
+ router->description = xmlCopyDoc(description, 1);
return;
}
herror_t
-soap_router_register_default_service(SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn) {
+soap_router_register_default_service(struct SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn) {
SoapService *service;
@@ -139,7 +130,7 @@ soap_router_register_default_service(SoapRouter *router, SoapServiceFunc func, c
}
SoapService *
-soap_router_find_service(SoapRouter *router, const char *urn, const char *method)
+soap_router_find_service(struct SoapRouter *router, const char *urn, const char *method)
{
SoapServiceNode *node;
@@ -180,7 +171,7 @@ soap_router_find_service(SoapRouter *router, const char *urn, const char *method
}
void
-soap_router_free(SoapRouter * router)
+soap_router_free(struct SoapRouter * router)
{
SoapServiceNode *node;
log_verbose2("enter: router=%p", router);
@@ -197,8 +188,8 @@ soap_router_free(SoapRouter * router)
free(router->service_head);
router->service_head = node;
}
- if (router->wsdl)
- xmlFreeDoc(router->wsdl);
+ if (router->description)
+ xmlFreeDoc(router->description);
free(router);
log_verbose1("leave with success");
diff --git a/libcsoap/soap-router.h b/libcsoap/soap-router.h
index da6199f..69f0e86 100644
--- a/libcsoap/soap-router.h
+++ b/libcsoap/soap-router.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-router.h,v 1.10 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-router.h,v 1.11 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,72 +25,103 @@
#define __csoap_router_h
/**
- The router object. A router can store a set of
- services. A service is a C function.
+ *
+ * Authentication callback function for a cSOAP service.
+ *
+ */
+typedef int (*soap_auth) (struct SoapEnv *request, const char *user, const char *pass);
+
+/**
+ *
+ * The router object. A router can store a set of
+ * services. A service is a C function.
+ *
*/
-typedef struct _SoapRouter
+struct SoapRouter
{
SoapServiceNode *service_head;
SoapServiceNode *service_tail;
SoapService *default_service;
- httpd_auth auth;
- xmlDocPtr wsdl;
-} SoapRouter;
+ soap_auth auth;
+ xmlDocPtr description;
+};
#ifdef __cplusplus
extern "C" {
#endif
/**
- Creates a new router object. Create a router if
- you are implementing a soap server. Then register
- the services to this router.
- <P>A router points also to http url context.
-
- @returns Soap router
- @see soap_router_free
+ *
+ * Creates a new router object. Create a router if
+ * you are implementing a soap server. Then register
+ * the services to this router.
+ * <P>A router points also to http url context.
+ *
+ * @returns Soap router
+ *
+ * @see soap_router_free
+ *
*/
-extern SoapRouter *soap_router_new(void);
-
+extern struct SoapRouter *soap_router_new(void);
/**
- Registers a SOAP service (in this case a C function)
- to the router.
-
- @param router The router object
- @param func Function to register as a soap service
- @param method Method name to call the function from
- the client side.
- @param urn The urn for this service
+ *
+ * Registers a SOAP service (in this case a C function)
+ * to the router.
+ *
+ * @param router The router object
+ * @param func Function to register as a soap service
+ * @param method Method name to call the function from
+ * the client side.
+ * @param urn The urn for this service
+ *
*/
-extern herror_t soap_router_register_service(SoapRouter * router,
- SoapServiceFunc func,
- const char *method, const char *urn);
-
-extern herror_t soap_router_register_default_service(SoapRouter * router, SoapServiceFunc func, const char *method, const char *urn);
-
-
-extern void soap_router_register_description(SoapRouter *router, xmlDocPtr doc);
-
-extern void soap_router_register_security(SoapRouter *router, httpd_auth auth);
+extern herror_t soap_router_register_service(struct SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn);
/**
- Searches for a registered soap service.
+ *
+ * Register a default service for the router.
+ *
+ */
+extern herror_t soap_router_register_default_service(struct SoapRouter * router, SoapServiceFunc func, const char *method, const char *urn);
- @param router The router object
- @param urn URN of the service
- @param method The name under which the service was registered.
+/**
+ *
+ * Register a service description for the router.
+ *
+ */
+extern void soap_router_register_description(struct SoapRouter *router, xmlDocPtr doc);
- @return The service if found, NULL otherwise.
+/**
+ *
+ * Register a security provider for the router.
+ *
*/
-extern SoapService *soap_router_find_service(SoapRouter * router, const char *urn, const char *method);
+extern void soap_router_register_security(struct SoapRouter *router, soap_auth auth);
/**
- Frees the router object.
+ *
+ * Searches for a registered soap service.
+ *
+ * @param router The router object
+ * @param urn URN of the service
+ * @param method The name under which the service was registered.
+ *
+ * @return The service if found, NULL otherwise.
+ *
+ */
+extern SoapService *soap_router_find_service(struct SoapRouter *router, const char *urn, const char *method);
- @param router The router object to free
+/**
+ *
+ * Frees the router object.
+ *
+ * @param router The router object to free
+ *
+ * @see soap_router_new
+ *
*/
-extern void soap_router_free(SoapRouter * router);
+extern void soap_router_free(struct SoapRouter * router);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index 11dbf53..d8d996d 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.29 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-server.c,v 1.30 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,10 +25,6 @@
#include <config.h>
#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -41,20 +37,10 @@
#include <errno.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#ifdef WIN32
-#define snprintf(buffer, num, s1, s2) sprintf(buffer, s1,s2)
-#endif
-
#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-server.h>
#include <nanohttp/nanohttp-logging.h>
@@ -73,7 +59,7 @@ static SoapRouterNode *head = NULL;
static SoapRouterNode *tail = NULL;
static SoapRouterNode *
-router_node_new(SoapRouter * router, const char *context, SoapRouterNode * next)
+router_node_new(struct SoapRouter * router, const char *context, SoapRouterNode * next)
{
const char *noname = "/lost_found";
SoapRouterNode *node;
@@ -100,7 +86,13 @@ router_node_new(SoapRouter * router, const char *context, SoapRouterNode * next)
return node;
}
-SoapRouter *
+static herror_t
+_soap_server_env_new_with_fault(const char *fault_string, const char *detail, struct SoapEnv **out)
+{
+ return soap_env_new_with_fault(SOAP_FAULT_RECEIVER, fault_string, soap_server_get_name(), detail, out);
+}
+
+struct SoapRouter *
soap_server_find_router(const char *context)
{
SoapRouterNode *node;
@@ -114,25 +106,19 @@ soap_server_find_router(const char *context)
return NULL;
}
-static herror_t
-_soap_server_env_new_with_fault(const char *fault_string, const char *detail, SoapEnv **out)
-{
- return soap_env_new_with_fault(SOAP_FAULT_RECEIVER, fault_string, soap_server_get_name(), detail, out);
-}
-
herror_t
-soap_server_process(SoapCtx *request, SoapCtx **response)
+soap_server_process(struct SoapCtx *request, struct SoapCtx **response)
{
char buffer[1054];
- char *urn;
- char *method;
+ const char *urn;
+ const char *method;
char *to;
- SoapRouter *router;
+ struct SoapRouter *router;
SoapService *service;
herror_t err;
log_verbose1("processing");
- soap_xml_doc_print(request->env->root->doc);
+ xmlDocDump(stdout, request->env->root->doc);
*response = soap_ctx_new(NULL);
@@ -196,12 +182,15 @@ soap_server_process(SoapCtx *request, SoapCtx **response)
}
herror_t
-soap_server_init_args(int argc, char *argv[])
+soap_server_init_args(int argc, char **argv)
{
herror_t status;
if ((status = soap_transport_server_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_transport_server_init_args failed (%s)", herror_message(status));
return status;
+ }
return H_OK;
}
@@ -213,12 +202,15 @@ soap_server_get_name(void)
}
herror_t
-soap_server_register_router(SoapRouter *router, const char *context)
+soap_server_register_router(struct SoapRouter *router, const char *context)
{
herror_t status;
- if ((status = soap_transport_register_router(router, context)) != H_OK)
+ if ((status = soap_transport_register(context)) != H_OK)
+ {
+ log_error2("soap_transport_register failed (%s)", herror_message(status));
return status;
+ }
if (tail == NULL)
{
diff --git a/libcsoap/soap-server.h b/libcsoap/soap-server.h
index 70fc6aa..cafa9a5 100644
--- a/libcsoap/soap-server.h
+++ b/libcsoap/soap-server.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-server.h,v 1.12 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-server.h,v 1.13 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -43,7 +43,6 @@ extern "C" {
*/
herror_t soap_server_init_args(int argc, char **argv);
-
/**
*
* Register a router to the soap server.
@@ -59,8 +58,13 @@ herror_t soap_server_init_args(int argc, char **argv);
* @see soap_router_register_service
*
*/
-extern herror_t soap_server_register_router(SoapRouter * router, const char *context);
+extern herror_t soap_server_register_router(struct SoapRouter * router, const char *context);
+/**
+ *
+ * Returns an URI name of the server.
+ *
+ */
extern const char *soap_server_get_name(void);
/**
@@ -69,6 +73,7 @@ extern const char *soap_server_get_name(void);
*
* @see httpd_run
* @see udpd_run
+ * @see smptd_run
*
*/
extern herror_t soap_server_run(void);
@@ -88,16 +93,16 @@ extern void soap_server_destroy(void);
typedef struct _SoapRouterNode
{
char *context;
- SoapRouter *router;
+ struct SoapRouter *router;
struct _SoapRouterNode *next;
} SoapRouterNode;
-extern SoapRouter *soap_server_find_router(const char *context);
+extern struct SoapRouter *soap_server_find_router(const char *context);
extern SoapRouterNode * soap_server_get_routers(void);
-extern herror_t soap_server_process(SoapCtx *request, SoapCtx **response);
+extern herror_t soap_server_process(struct SoapCtx *request, struct SoapCtx **response);
#endif
diff --git a/libcsoap/soap-service.c b/libcsoap/soap-service.c
index 7a422c5..241eb82 100644
--- a/libcsoap/soap-service.c
+++ b/libcsoap/soap-service.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-service.c,v 1.10 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-service.c,v 1.11 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -55,6 +55,7 @@
#include "soap-env.h"
#include "soap-ctx.h"
#include "soap-service.h"
+#include "soap-router.h"
SoapServiceNode *
soap_service_node_new(SoapService * service, SoapServiceNode * next)
diff --git a/libcsoap/soap-service.h b/libcsoap/soap-service.h
index f507d77..e999e2e 100644
--- a/libcsoap/soap-service.h
+++ b/libcsoap/soap-service.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-service.h,v 1.7 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-service.h,v 1.8 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -24,7 +24,7 @@
#ifndef __csoap_service_h
#define __csoap_service_h
-typedef herror_t(*SoapServiceFunc) (SoapCtx *, SoapCtx *);
+typedef herror_t (*SoapServiceFunc)(struct SoapCtx *request, struct SoapCtx *response);
typedef struct _SoapService
{
@@ -45,12 +45,11 @@ typedef struct _SoapServiceNode
extern "C" {
#endif
-SoapServiceNode *soap_service_node_new(SoapService * service,
- SoapServiceNode * next);
+extern SoapServiceNode *soap_service_node_new(SoapService * service, SoapServiceNode * next);
-SoapService *soap_service_new(const char *urn, const char *method, SoapServiceFunc f);
+extern SoapService *soap_service_new(const char *urn, const char *method, SoapServiceFunc f);
-void soap_service_free(SoapService * service);
+extern void soap_service_free(SoapService * service);
#ifdef __cplusplus
}
diff --git a/libcsoap/soap-transport.c b/libcsoap/soap-transport.c
index 6c84e35..1fc2c51 100644
--- a/libcsoap/soap-transport.c
+++ b/libcsoap/soap-transport.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-transport.c,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-transport.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2007 Heiko Ronsdorf
@@ -33,18 +33,10 @@
#include <string.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#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-server.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-fault.h"
@@ -71,12 +63,6 @@ struct soap_transport
static struct soap_transport *head = NULL;
static char soap_transport_name[512] = "not set";
-herror_t
-soap_transport_receive(SoapCtx *request, SoapCtx **response)
-{
- return soap_server_process(request, response);
-}
-
static struct soap_transport *
_soap_transport_new(const char *scheme, void *data, msg_exchange invoke)
{
@@ -114,6 +100,13 @@ _soap_transport_destroy(struct soap_transport *transport)
return ret;
}
+
+herror_t
+soap_transport_process(struct SoapCtx *request, struct SoapCtx **response)
+{
+ return soap_server_process(request, response);
+}
+
herror_t
soap_transport_server_init_args(int argc, char **argv)
{
@@ -121,27 +114,39 @@ soap_transport_server_init_args(int argc, char **argv)
char hostname[256];
if ((status = soap_nhttp_server_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_nhttp_server_init_args failed (%s)", herror_message(status));
return status;
+ }
if ((status = soap_nudp_server_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_nudp_server_init_args failed (%s)", herror_message(status));
return status;
+ }
gethostname(hostname, 256);
- sprintf(soap_transport_name, "%s://%s:%i/csoap", soap_nhttp_get_protocol(), hostname, soap_nhttp_get_port());
+ sprintf(soap_transport_name, "%s://%s:%i", soap_nhttp_get_protocol(), hostname, soap_nhttp_get_port());
return H_OK;
}
herror_t
-soap_transport_register_router(SoapRouter *router, const char *context)
+soap_transport_register(const void *data)
{
herror_t status;
- if ((status = soap_nhttp_register_router(router, context)) != H_OK)
+ if ((status = soap_nhttp_register(data)) != H_OK)
+ {
+ log_error2("soap_nhttp_register failed (%s)", herror_message(status));
return status;
+ }
- if ((status = soap_nudp_register_router(router, context)) != H_OK)
+ if ((status = soap_nudp_register(data)) != H_OK)
+ {
+ log_error2("soap_nudp_register failed (%s)", herror_message(status));
return status;
+ }
return H_OK;
}
@@ -155,7 +160,7 @@ soap_transport_add(const char *scheme, void *data, msg_exchange invoke)
if (!(transport = _soap_transport_new(scheme, data, invoke)))
{
log_error1("_soap_transport_new failed");
- return H_OK;
+ return herror_new("soap_transport_add", 0, "_soap_transport_new failed");
}
if (head == NULL)
@@ -177,10 +182,16 @@ soap_transport_server_run(void)
herror_t status;
if ((status = soap_nhttp_server_run()) != H_OK)
+ {
+ log_error2("soap_nhttp_server_run failed (%s)", herror_message(status));
return status;
+ }
if ((status = soap_nudp_server_run()) != H_OK)
+ {
+ log_error2("soap_nudp_server_run failed (%s)", herror_message(status));
return status;
+ }
return H_OK;
}
@@ -207,23 +218,29 @@ soap_transport_client_init_args(int argc, char **argv)
herror_t status;
if ((status = soap_nhttp_client_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_nhttp_client_init_args failed (%s)", herror_message(status));
return status;
+ }
if ((status = soap_nudp_client_init_args(argc, argv)) != H_OK)
+ {
+ log_error2("soap_nudp_client_init_args failed (%s)", herror_message(status));
return status;
+ }
return H_OK;
}
herror_t
-soap_transport_client_invoke(SoapCtx *request, SoapCtx **response)
+soap_transport_client_invoke(struct SoapCtx *request, struct SoapCtx **response)
{
struct soap_transport *walker;
herror_t ret;
xmlURI *dest;
log_verbose1(__FUNCTION__);
- soap_xml_doc_print(request->env->root->doc);
+ xmlDocDump(stdout, request->env->root->doc);
dest = soap_addressing_get_to_address(request->env);
diff --git a/libcsoap/soap-transport.h b/libcsoap/soap-transport.h
index 8c31454..5cc3e68 100644
--- a/libcsoap/soap-transport.h
+++ b/libcsoap/soap-transport.h
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-transport.h,v 1.1 2006/11/21 20:59:02 m0gg Exp $
+* $Id: soap-transport.h,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2007 Heiko Ronsdorf
@@ -25,7 +25,7 @@
#define __csoap_transport_h
#ifdef __CSOAP_INTERNAL
-typedef herror_t (*msg_exchange)(void *data, SoapCtx *request, SoapCtx **response);
+typedef herror_t (*msg_exchange)(void *data, struct SoapCtx *request, struct SoapCtx **response);
#ifdef __cplusplus
extern "C" {
@@ -38,13 +38,13 @@ extern void soap_transport_server_destroy(void);
extern const char *soap_transport_get_name(void);
extern herror_t soap_transport_add(const char *protocol, void *data, msg_exchange invoke);
extern herror_t soap_transport_remove(const char *protocol, void *data);
-extern herror_t soap_transport_register_router(SoapRouter *router, const char *context);
+extern herror_t soap_transport_register(const void *data);
-extern herror_t soap_transport_send(SoapCtx *request, SoapCtx **response);
-extern herror_t soap_transport_receive(SoapCtx *request, SoapCtx **response);
+extern herror_t soap_transport_send(struct SoapCtx *request, struct SoapCtx **response);
+extern herror_t soap_transport_process(struct SoapCtx *request, struct SoapCtx **response);
extern herror_t soap_transport_client_init_args(int argc, char **argv);
-extern herror_t soap_transport_client_invoke(SoapCtx *req, SoapCtx **res);
+extern herror_t soap_transport_client_invoke(struct SoapCtx *req, struct SoapCtx **res);
extern void soap_transport_client_destroy(void);
#ifdef __cplusplus
diff --git a/libcsoap/soap-wsil.c b/libcsoap/soap-wsil.c
index ac4add8..7e0a7f2 100644
--- a/libcsoap/soap-wsil.c
+++ b/libcsoap/soap-wsil.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-wsil.c,v 1.1 2006/11/23 13:20:46 m0gg Exp $
+* $Id: soap-wsil.c,v 1.2 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -34,14 +34,11 @@
#endif
#include <libxml/tree.h>
-#include <libxml/uri.h>
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-request.h>
#include <nanohttp/nanohttp-server.h>
-#include "soap-fault.h"
-#include "soap-env.h"
#include "soap-ctx.h"
#include "soap-service.h"
#include "soap-router.h"
@@ -49,38 +46,40 @@
#include "soap-wsil.h"
static void
-_soap_wsil_list_services(httpd_conn_t *conn, struct SoapRouter *router)
+_soap_wsil_list_routers(httpd_conn_t *conn)
{
- SoapServiceNode *node;
+ SoapRouterNode *node;
- for (node=router->service_head; node; node=node->next)
- {
+ for (node=soap_server_get_routers(); node; node=node->next)
+ {
http_output_stream_write_string(conn->out,
"<service>"
"<description "
- "referencedNamespace=\"http://schemas.xmlsoap.org/wsdl/\" "
"location=\"");
http_output_stream_write_string(conn->out, soap_transport_get_name());
- http_output_stream_write_string(conn->out, node->service->method);
+ http_output_stream_write_string(conn->out, node->context);
+ http_output_stream_write_string(conn->out,
+ "\" "
+ "referencedNamespace=\"");
+ if (node->router->description)
+ {
+ xmlNodePtr root;
+
+ root = xmlDocGetRootElement(node->router->description);
+ http_output_stream_write_string(conn->out, root->ns->href);
+ }
+ else
+ {
+ http_output_stream_write_string(conn->out, "http://schemas.xmlsoap.org/wsdl/");
+ }
http_output_stream_write_string(conn->out,
"\" />"
- "</service>\n");
+ "</service>");
}
return;
}
static void
-_soap_wsil_list_routers(httpd_conn_t *conn)
-{
- SoapRouterNode *node;
-
- for (node=soap_server_get_routers(); node; node=node->next)
- _soap_wsil_list_services(conn, node->router);
-
- return;
-}
-
-static void
_soap_wsil_handle_get(httpd_conn_t * conn, struct hrequest_t * req)
{
httpd_set_header(conn, HEADER_CONTENT_TYPE, "text/xml");
diff --git a/libcsoap/soap-xml.c b/libcsoap/soap-xml.c
index 801bdd1..e4cc894 100644
--- a/libcsoap/soap-xml.c
+++ b/libcsoap/soap-xml.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-xml.c,v 1.11 2006/07/09 16:24:19 snowdrop Exp $
+* $Id: soap-xml.c,v 1.12 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -25,6 +25,9 @@
#include <config.h>
#endif
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
#include <nanohttp/nanohttp-logging.h>
#include "soap-xml.h"
@@ -69,7 +72,6 @@ soap_xml_get_next(xmlNodePtr param)
return node;
}
-
xmlXPathObjectPtr
soap_xpath_eval(xmlDocPtr doc, const char *xpath)
{
@@ -88,62 +90,6 @@ soap_xpath_eval(xmlDocPtr doc, const char *xpath)
return result;
}
-
-int
-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);
-
- if (!xpathobj)
- return 0;
-
- nodeset = xpathobj->nodesetval;
- if (!nodeset)
- return 0;
-
- for (i = 0; i < nodeset->nodeNr; i++)
- {
- if (!cb(nodeset->nodeTab[i], userdata))
- break;
- }
-
- xmlXPathFreeObject((xmlXPathObjectPtr) nodeset);
- return i;
-}
-
-
-void
-soap_xml_doc_print(xmlDocPtr doc)
-{
- xmlBufferPtr buffer;
- xmlNodePtr root;
-
- if (doc == NULL)
- {
- puts("xmlDocPtr is NULL!");
- return;
- }
-
- root = xmlDocGetRootElement(doc);
- if (root == NULL)
- {
- puts("Empty document!");
- return;
- }
-
-
- buffer = xmlBufferCreate();
- xmlNodeDump(buffer, doc, root, 1, 0);
- puts((const char *) xmlBufferContent(buffer));
- xmlBufferFree(buffer);
-
-}
-
char *
soap_xml_get_text(xmlNodePtr node)
{
diff --git a/libcsoap/soap-xml.h b/libcsoap/soap-xml.h
index 9b0a7a5..e7167b2 100644
--- a/libcsoap/soap-xml.h
+++ b/libcsoap/soap-xml.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-xml.h,v 1.10 2006/11/21 20:59:02 m0gg Exp $
+ * $Id: soap-xml.h,v 1.11 2006/11/23 15:27:33 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -21,36 +21,23 @@
*
* Email: ayaz@jprogrammer.net
******************************************************************/
-#ifndef cSOAP_XML_H
-#define cSOAP_XML_H
+#ifndef __csoap_xml_h
+#define __csoap_xml_h
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-
-static const char * const soap_env_ns = "http://schemas.xmlsoap.org/soap/envelope/";
static const char * const soap_env_enc = "http://schemas.xmlsoap.org/soap/encoding/";
static const char * const soap_xsi_ns = "http://www.w3.org/1999/XMLSchema-instance";
static const char * const soap_xsd_ns = "http://www.w3.org/1999/XMLSchema";
-
-typedef int (*soap_xmlnode_callback) (xmlNodePtr, void *);
-
#ifdef __cplusplus
extern "C" {
#endif
-xmlNodePtr soap_xml_get_children(xmlNodePtr param);
-xmlNodePtr soap_xml_get_next(xmlNodePtr param);
-
-xmlXPathObjectPtr soap_xpath_eval(xmlDocPtr doc, const char *xpath);
-
-int
-soap_xpath_foreach(xmlDocPtr doc, const char *xpath,
- soap_xmlnode_callback cb, void *userdata);
+extern xmlNodePtr soap_xml_get_children(xmlNodePtr param);
+extern xmlNodePtr soap_xml_get_next(xmlNodePtr param);
+extern xmlXPathObjectPtr soap_xpath_eval(xmlDocPtr doc, const char *xpath);
-void soap_xml_doc_print(xmlDocPtr doc);
-char *soap_xml_get_text(xmlNodePtr node);
+extern char *soap_xml_get_text(xmlNodePtr node);
#ifdef __cplusplus
}