00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027
00028 #ifdef HAVE_STDLIB_H
00029 #include <stdlib.h>
00030 #endif
00031
00032 #ifdef HAVE_STDIO_H
00033 #include <stdio.h>
00034 #endif
00035
00036 #ifdef HAVE_STRING_H
00037 #include <string.h>
00038 #endif
00039
00040 #ifdef HAVE_ERRNO_H
00041 #include <errno.h>
00042 #endif
00043
00044 #ifdef HAVE_NETINET_IN_H
00045 #include <netinet/in.h>
00046 #endif
00047
00048 #include <libxml/tree.h>
00049 #include <libxml/uri.h>
00050
00051 #include <nanohttp/nanohttp-error.h>
00052 #include <nanohttp/nanohttp-logging.h>
00053
00054 #include "soap-fault.h"
00055 #include "soap-env.h"
00056 #include "soap-ctx.h"
00057 #include "soap-service.h"
00058 #include "soap-router.h"
00059
00060 SoapServiceNode *
00061 soap_service_node_new(SoapService * service, SoapServiceNode * next)
00062 {
00063 SoapServiceNode *node;
00064
00065 if (!(node = (SoapServiceNode *) malloc(sizeof(SoapServiceNode)))) {
00066
00067 log_error2("malloc failed (%s)", strerror(errno));
00068 return NULL;
00069 }
00070 node->service = service;
00071 node->next = next;
00072
00073 return node;
00074 }
00075
00076 SoapService *
00077 soap_service_new(const char *urn, const char *method, SoapServiceFunc f)
00078 {
00079 SoapService *service;
00080
00081 if (!(service = (SoapService *) malloc(sizeof(SoapService)))) {
00082
00083 log_error2("malloc failed (%s)", strerror(errno));
00084 return NULL;
00085 }
00086
00087 service->func = f;
00088
00089 if (urn == NULL) {
00090
00091 log_warn1("urn is NULL");
00092 urn = "";
00093 }
00094 service->urn = strdup(urn);
00095
00096 if (method == NULL) {
00097
00098 log_warn1("method is NULL");
00099 method = "";
00100 }
00101 service->method = strdup(method);
00102
00103 service->status = CSOAP_SERVICE_UP;
00104
00105 return service;
00106 }
00107
00108 void
00109 soap_service_free(SoapService * service)
00110 {
00111 if (!service)
00112 return;
00113
00114 if (service->urn)
00115 free(service->urn);
00116
00117 if (service->method)
00118 free(service->method);
00119
00120 free(service);
00121
00122 return;
00123 }