summaryrefslogtreecommitdiffstats
path: root/libcsoap/soap-router.c
diff options
context:
space:
mode:
authorGravatar m0gg2006-03-07 16:22:24 +0000
committerGravatar m0gg2006-03-07 16:22:24 +0000
commitb48bca92b89568d50e1b5c2fe23ebe913058ad0a (patch)
tree733cbde1169288a431bdf3256071fd75e727c921 /libcsoap/soap-router.c
parent0f477f227836a1a79597f4a64c50030f742785db (diff)
downloadcsoap-b48bca92b89568d50e1b5c2fe23ebe913058ad0a.tar.gz
csoap-b48bca92b89568d50e1b5c2fe23ebe913058ad0a.tar.bz2
WSDL registration
Diffstat (limited to 'libcsoap/soap-router.c')
-rw-r--r--libcsoap/soap-router.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/libcsoap/soap-router.c b/libcsoap/soap-router.c
index 7b93b03..c4252c2 100644
--- a/libcsoap/soap-router.c
+++ b/libcsoap/soap-router.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-router.c,v 1.7 2006/02/27 22:26:02 snowdrop Exp $
+* $Id: soap-router.c,v 1.8 2006/03/07 16:22:24 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -29,6 +29,10 @@
#include <string.h>
#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#include "soap-router.h"
SoapRouter *
@@ -36,10 +40,12 @@ soap_router_new(void)
{
SoapRouter *router;
- router = (SoapRouter *) malloc(sizeof(SoapRouter));
- router->service_head = NULL;
- router->service_tail = NULL;
- router->default_service = NULL;
+ if (!(router = (SoapRouter *) malloc(sizeof(SoapRouter))))
+ {
+ log_error2("malloc failed (%s)", strerror(errno));
+ return NULL;
+ }
+ memset(router, 0, sizeof(SoapRouter));
return router;
}
@@ -68,6 +74,17 @@ soap_router_register_service(SoapRouter * router,
}
void
+soap_router_register_description(SoapRouter * router, xmlDocPtr wsdl)
+{
+ if (router->wsdl)
+ xmlFreeDoc(router->wsdl);
+
+ router->wsdl = xmlCopyDoc(wsdl, 1);
+
+ return;
+}
+
+void
soap_router_register_default_service(SoapRouter *router, SoapServiceFunc func, const char *method, const char *urn) {
SoapService *service;
@@ -123,7 +140,8 @@ soap_router_free(SoapRouter * router)
{
SoapServiceNode *node;
log_verbose2("enter: router=%p", router);
- if (router == NULL)
+
+ if (!router)
return;
while (router->service_head)
@@ -135,7 +153,11 @@ soap_router_free(SoapRouter * router)
free(router->service_head);
router->service_head = node;
}
+ if (router->wsdl)
+ xmlFreeDoc(router->wsdl);
free(router);
log_verbose1("leave with success");
+
+ return;
}