diff options
author | snowdrop | 2004-11-02 23:09:19 +0000 |
---|---|---|
committer | snowdrop | 2004-11-02 23:09:19 +0000 |
commit | 402e8748593a42cf6d42fda772f207e3e9300a3e (patch) | |
tree | 8c87ecde3498891a6de178f2a77dc4d9cf20fe57 /libcsoap/soap-client.c | |
parent | 15b392f1e21d3dae8f83da401199959e9f0b0db6 (diff) | |
download | csoap-402e8748593a42cf6d42fda772f207e3e9300a3e.tar.gz csoap-402e8748593a42cf6d42fda772f207e3e9300a3e.tar.bz2 |
dos2unix
Diffstat (limited to 'libcsoap/soap-client.c')
-rw-r--r-- | libcsoap/soap-client.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/libcsoap/soap-client.c b/libcsoap/soap-client.c index bec9044..fa65864 100644 --- a/libcsoap/soap-client.c +++ b/libcsoap/soap-client.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: soap-client.c,v 1.13 2004/11/02 22:42:52 snowdrop Exp $ +* $Id: soap-client.c,v 1.14 2004/11/02 23:09:26 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -25,21 +25,21 @@ #include <nanohttp/nanohttp-client.h> #include <string.h> -/*--------------------------------- */
+/*--------------------------------- */ static int _block_socket = 0; static herror_t _soap_client_build_result(hresponse_t *res, SoapEnv **out); /*--------------------------------- */ -
-void soap_client_block_socket(int block)
-{
- _block_socket = block;
-}
-
-int soap_client_get_blockmode()
-{
- return _block_socket;
-}
-
+ +void soap_client_block_socket(int block) +{ + _block_socket = block; +} + +int soap_client_get_blockmode() +{ + return _block_socket; +} + herror_t soap_client_init_args(int argc, char *argv[]) @@ -50,10 +50,10 @@ herror_t soap_client_init_args(int argc, char *argv[]) } -void soap_client_destroy()
-{
- httpc_destroy();
-}
+void soap_client_destroy() +{ + httpc_destroy(); +} static long _file_get_size(const char* filename) @@ -69,7 +69,7 @@ long _file_get_size(const char* filename) return size; } -
+ herror_t soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const char *soap_action) { @@ -93,17 +93,17 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha static int counter=1; part_t *part; int file_count=0; -
+ /* for copy attachments */ - char href[MAX_HREF_SIZE];
-
+ char href[MAX_HREF_SIZE]; + /* Create buffer */ buffer = xmlBufferCreate(); xmlNodeDump(buffer, call->env->root->doc,call->env->root, 1 ,0); content = (char*)xmlBufferContent(buffer); /* Transport via HTTP */ - conn = httpc_new();
+ conn = httpc_new(); conn->block = soap_client_get_blockmode(); /* Set soap action */ @@ -123,7 +123,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha if (status != H_OK) { httpc_free(conn); - xmlBufferFree(buffer);
+ xmlBufferFree(buffer); return status; } @@ -131,14 +131,14 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha if (status != H_OK) { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } status = httpc_post_end(conn, &res); if (status != H_OK) { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } } else @@ -152,21 +152,21 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha if (status != H_OK) { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } status = httpc_mime_next(conn, start_id, "text/xml", "binary"); if (status != H_OK) { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } status = http_output_stream_write(conn->out, content, strlen(content)); if (status != H_OK) { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } @@ -178,7 +178,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha log_error2("Send file failed. Status:%d", status); httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } } @@ -187,7 +187,7 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha { httpc_free(conn); xmlBufferFree(buffer); - return status;
+ return status; } } @@ -196,58 +196,58 @@ soap_client_invoke(SoapCtx *call, SoapCtx** response, const char *url, const cha /* Build result */ status = _soap_client_build_result(res, &res_env); - if (status != H_OK) {
- hresponse_free(res);
- httpc_free(conn);
- return status;
- }
+ if (status != H_OK) { + hresponse_free(res); + httpc_free(conn); + return status; + } /* Create Context */ *response = soap_ctx_new(res_env); -/* soap_ctx_add_files(*response, res->attachments);*/
-
- if (res->attachments!=NULL) {
- part = res->attachments->parts;
- while (part) {
- soap_ctx_add_file(*response, part->filename, part->content_type, href);
- part->deleteOnExit = 0;
- part = part->next;
- }
- part = (*response)->attachments->parts;
- while (part) {
- part->deleteOnExit = 1;
- part = part->next;
- }
- }
-
-
+/* soap_ctx_add_files(*response, res->attachments);*/ + + if (res->attachments!=NULL) { + part = res->attachments->parts; + while (part) { + soap_ctx_add_file(*response, part->filename, part->content_type, href); + part->deleteOnExit = 0; + part = part->next; + } + part = (*response)->attachments->parts; + while (part) { + part->deleteOnExit = 1; + part = part->next; + } + } + + hresponse_free(res); - httpc_free(conn);
+ httpc_free(conn); return H_OK; } -static
+static herror_t _soap_client_build_result(hresponse_t *res, SoapEnv** env) -{
+{ herror_t err; log_verbose2("Building result (%p)", res); if (res == NULL) - return herror_new("_soap_client_build_result",
+ return herror_new("_soap_client_build_result", GENERAL_INVALID_PARAM, "hresponse_t is NULL"); if (res->in == NULL) - return herror_new("_soap_client_build_result",
+ return herror_new("_soap_client_build_result", GENERAL_INVALID_PARAM, "Empty response from server"); err = soap_env_new_from_stream(res->in, env); - if (err != H_OK) {
+ if (err != H_OK) { return err; } |