summaryrefslogtreecommitdiffstats
path: root/libcsoap/soap-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcsoap/soap-server.c')
-rw-r--r--libcsoap/soap-server.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index 8313eb8..2ebefef 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.8 2004/11/02 22:42:52 snowdrop Exp $
+* $Id: soap-server.c,v 1.9 2004/11/02 23:09:26 snowdrop Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -100,7 +100,7 @@ void soap_server_destroy()
free(node->context);
free(node);
node = tmp;
- }
+ }
httpd_destroy();
}
@@ -114,7 +114,7 @@ void soap_server_entry(httpd_conn_t *conn, hrequest_t *req)
SoapCtx *ctx, *ctxres;
SoapRouter *router;
SoapService *service;
- SoapEnv *env;
+ SoapEnv *env;
herror_t err;
if (req->method != HTTP_REQUEST_POST) {
@@ -128,15 +128,15 @@ void soap_server_entry(httpd_conn_t *conn, hrequest_t *req)
}
- header = hpairnode_new(HEADER_CONTENT_TYPE, "text/xml", NULL);
-
- err = soap_env_new_from_stream(req->in, &env);
- if (err != H_OK)
- {
- _soap_server_send_fault(conn, header, herror_message(err));
- herror_release(err);
- return;
- }
+ header = hpairnode_new(HEADER_CONTENT_TYPE, "text/xml", NULL);
+
+ err = soap_env_new_from_stream(req->in, &env);
+ if (err != H_OK)
+ {
+ _soap_server_send_fault(conn, header, herror_message(err));
+ herror_release(err);
+ return;
+ }
if (env == NULL) {
@@ -192,20 +192,20 @@ void soap_server_entry(httpd_conn_t *conn, hrequest_t *req)
return;
} else {
- log_verbose2("func: %p", service->func);
+ log_verbose2("func: %p", service->func);
ctxres = soap_ctx_new(NULL);
/* ===================================== */
/* CALL SERVICE FUNCTION */
/* ===================================== */
- err = service->func(ctx, ctxres);
- if (err != H_OK) {
- sprintf(buffer, "Service returned following error message: '%s'",
- herror_message(err));
- herror_release(err);
- _soap_server_send_fault(conn, header, buffer);
- soap_ctx_free(ctx);
- return;
- }
+ err = service->func(ctx, ctxres);
+ if (err != H_OK) {
+ sprintf(buffer, "Service returned following error message: '%s'",
+ herror_message(err));
+ herror_release(err);
+ _soap_server_send_fault(conn, header, buffer);
+ soap_ctx_free(ctx);
+ return;
+ }
if (ctxres->env == NULL) {
@@ -289,37 +289,37 @@ static
void _soap_server_send_fault(httpd_conn_t *conn, hpair_t *header,
const char* errmsg)
{
- SoapEnv *envres;
- herror_t err;
+ SoapEnv *envres;
+ herror_t err;
char buffer[45];
httpd_set_headers(conn, header);
- err = httpd_send_header(conn, 500, "FAILED");
- if (err != H_OK) {
- /* WARNING: unhandled exception !*/
- log_error4("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err));
- return;
- }
+ err = httpd_send_header(conn, 500, "FAILED");
+ if (err != H_OK) {
+ /* WARNING: unhandled exception !*/
+ log_error4("%s():%s [%d]", herror_func(err), herror_message(err), herror_code(err));
+ return;
+ }
err = soap_env_new_with_fault(Fault_Server,
errmsg?errmsg:"General error",
- "cSOAP_Server", NULL, &envres);
- if (err != H_OK) {
- log_error1(herror_message(err));
- http_output_stream_write_string(conn->out, "<html><head></head><body>");
- http_output_stream_write_string(conn->out, "<h1>Error</h1><hr>");
- http_output_stream_write_string(conn->out, "Error while sending fault object:<br>Message: ");
- http_output_stream_write_string(conn->out, herror_message(err));
- http_output_stream_write_string(conn->out, "<br>Function: ");
- http_output_stream_write_string(conn->out, herror_func(err));
- http_output_stream_write_string(conn->out, "<br>Error code: ");
- sprintf(buffer, "%d", herror_code(err));
- http_output_stream_write_string(conn->out, buffer);
- http_output_stream_write_string(conn->out, "</body></html>");
- return;
-
- herror_release(err);
+ "cSOAP_Server", NULL, &envres);
+ if (err != H_OK) {
+ log_error1(herror_message(err));
+ http_output_stream_write_string(conn->out, "<html><head></head><body>");
+ http_output_stream_write_string(conn->out, "<h1>Error</h1><hr>");
+ http_output_stream_write_string(conn->out, "Error while sending fault object:<br>Message: ");
+ http_output_stream_write_string(conn->out, herror_message(err));
+ http_output_stream_write_string(conn->out, "<br>Function: ");
+ http_output_stream_write_string(conn->out, herror_func(err));
+ http_output_stream_write_string(conn->out, "<br>Error code: ");
+ sprintf(buffer, "%d", herror_code(err));
+ http_output_stream_write_string(conn->out, buffer);
+ http_output_stream_write_string(conn->out, "</body></html>");
+ return;
+
+ herror_release(err);
} else {
- _soap_server_send_env(conn->out, envres);
+ _soap_server_send_env(conn->out, envres);
}
}