From 278aa71a7cb98723ed8092d1218df2c22352494a Mon Sep 17 00:00:00 2001 From: snowdrop Date: Thu, 13 Nov 2003 10:44:10 +0000 Subject: *** empty log message *** --- libcsoap/csoap.c | 29 +++++++++++++++++++++++++++-- libcsoap/csoapcall.c | 8 +++++--- libcsoap/csoapenv.c | 4 ++-- libcsoap/csoaphttp.c | 20 ++++++++++++++++---- libcsoap/csoaplog.c | 7 ++++--- libcsoap/csoapparam.c | 29 ++++++++++++++++++++++++++++- libcsoap/csoapparam.h | 32 ++++++++++++++++++++++++++++++-- libcsoap/csoapurl.c | 21 +++++++++++++-------- 8 files changed, 125 insertions(+), 25 deletions(-) diff --git a/libcsoap/csoap.c b/libcsoap/csoap.c index e876d07..a38e81b 100644 --- a/libcsoap/csoap.c +++ b/libcsoap/csoap.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoap.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoap.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -27,11 +27,36 @@ /*----------------------------------------------------------------- - FUNCTION: SoapFreeStr + FUNCTION: SoapInit /-----------------------------------------------------------------*/ +int SoapInit(int argc, char *argv[]) +{ + return CSOAP_OK; +} + +/*----------------------------------------------------------------- + FUNCTION: SoapFreeStr +/-----------------------------------------------------------------*/ void SoapFreeStr(char* str) { if (str) xmlFree(str); } + + + + + + + + + + + + + + + + + diff --git a/libcsoap/csoapcall.c b/libcsoap/csoapcall.c index d74b51c..1756d29 100644 --- a/libcsoap/csoapcall.c +++ b/libcsoap/csoapcall.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoapcall.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoapcall.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -185,15 +185,17 @@ HSOAPRES SoapCallInvoke(HSOAPCALL call) (xmlNodePtr)call->m_env, 1 ,2); printf("\n%s\n", (const char*)xmlBufferContent(buffer)); xmlBufferFree(buffer); -*/ + printf("Sending ...\n"); +*/ status = SoapHttpSend(call->m_url, call->m_env, &env); if (status != CSOAP_OK) { printf("can not send. code = %d\n", status); } - printf("Sending finished\n"); /* + printf("Sending finished\n"); + printf("Length: %d\nResponse: \n%s\n\n\r", strlen(buf), buf?buf:"null"); */ SoapEnvDump(env); diff --git a/libcsoap/csoapenv.c b/libcsoap/csoapenv.c index 47a3872..303bf46 100644 --- a/libcsoap/csoapenv.c +++ b/libcsoap/csoapenv.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoapenv.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoapenv.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -161,7 +161,7 @@ void SoapEnvDump(HSOAPENV env) xmlNodeDump(buffer, ((xmlNodePtr)env)->doc, (xmlNodePtr)env, 1 ,1); str = (char*)xmlBufferContent(buffer); - printf("%s\n", str?str:"null"); + SoapLog(LOG_DEBUG, FUNC, "%s\n", str?str:"null"); xmlBufferFree(buffer); SoapTraceLeave(FUNC, "Leaving"); diff --git a/libcsoap/csoaphttp.c b/libcsoap/csoaphttp.c index 68b6cd3..404d4b6 100644 --- a/libcsoap/csoaphttp.c +++ b/libcsoap/csoaphttp.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoaphttp.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoaphttp.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -74,7 +74,7 @@ HSOAPENV SoapHttpCreateEnv(char* httpResponse) /* SoapLog(LOG_DEBUG, FUNC, "xml = %s\n",tmp?tmp:"null"); */ - SoapLog(LOG_DEBUG, FUNC, "Starting parsing\n"); + SoapLog(LOG_DEBUG, FUNC, "Starting parsing \n"); env = xmlParseMemory((const char*)tmp, len); if (env == NULL) { SoapLog(LOG_ERROR, FUNC, @@ -128,11 +128,13 @@ CSOAP_STATUS SoapHttpSend(HSOAPURL url, HSOAPENV env, HSOAPENV* res) if (status != CSOAP_OK) return status; /*SoapSocketGetResponse(http);*/ - sprintf(tmp2, "POST %s HTTP/1.0\n", url->m_context?url->m_context:"/"); + sprintf(tmp2, "POST %s HTTP/1.1\n", url->m_context?url->m_context:"/"); sprintf(tmp2, "%sContent-Type: text/xml\n", tmp2); - sprintf(tmp2, "%sContent-Length: %d\n\n", tmp2, len); + sprintf(tmp2, "%sContent-Length: %d\n", tmp2, len); + sprintf(tmp2, "%sHost: %s\n\n", tmp2, url->m_host); sprintf(tmp, "%s%s", tmp2, (const char*)xmlBufferContent(buffer)); + /*printf((const char*)xmlBufferContent(buffer));*/ SoapLog(LOG_DEBUG, FUNC, "sending request\n"); status = SoapSocketSend(http, tmp, &size); @@ -140,6 +142,7 @@ CSOAP_STATUS SoapHttpSend(HSOAPURL url, HSOAPENV env, HSOAPENV* res) status = SoapSocketRecv(http, &response, &size); SoapLog(LOG_DEBUG, FUNC, "response returned status = %d\n", status); + SoapLog(LOG_DEBUG, FUNC, "Response string:'%s'", response); if (status != CSOAP_OK) return status; *res = SoapHttpCreateEnv(response); @@ -151,3 +154,12 @@ CSOAP_STATUS SoapHttpSend(HSOAPURL url, HSOAPENV env, HSOAPENV* res) return CSOAP_OK; } + + + + + + + + + diff --git a/libcsoap/csoaplog.c b/libcsoap/csoaplog.c index 3d5b127..2bc78e2 100644 --- a/libcsoap/csoaplog.c +++ b/libcsoap/csoaplog.c @@ -9,13 +9,14 @@ void _SoapLogWrite(SoapLogLevel level, const char* format, va_list ap) { + /* char buffer[1054]; char buffer2[1054]; sprintf(buffer, "[%s] [%d] %s\n", function, level, format); vsprintf(buffer2, buffer, ap); -/* printf(buffer2); - fflush(stdout); -*/ + printf(buffer2); + fflush(stdout); + */ } diff --git a/libcsoap/csoapparam.c b/libcsoap/csoapparam.c index 27b06e3..6fd7057 100644 --- a/libcsoap/csoapparam.c +++ b/libcsoap/csoapparam.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoapparam.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoapparam.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -236,6 +236,33 @@ int SoapParamGetString(HSOAPPARAM param, char *dest) return len; } +/*----------------------------------------------------------------- + FUNCTION: SoapParamToString +/-----------------------------------------------------------------*/ + +char* SoapParamToString(HSOAPPARAM param) +{ + char *value; + int len; + xmlNodePtr xmlNode; + const char* FUNC = "SoapParamToString"; + SoapTraceEnter(FUNC,""); + + if (param == NULL) { + SoapTraceLeaveWithError(FUNC, + "Invalid parameter 'param' (null)"); + return ""; + } + + xmlNode = (xmlNodePtr)param; + value = (char*)xmlNodeListGetString(xmlNode->doc, + xmlNode->xmlChildrenNode,1); + + SoapTraceLeave(FUNC, "Value = '%s'\n", value?value:"null"); + + return value; +} + /*----------------------------------------------------------------- FUNCTION: SoapParamGetInt diff --git a/libcsoap/csoapparam.h b/libcsoap/csoapparam.h index fcc1a4c..75889e4 100644 --- a/libcsoap/csoapparam.h +++ b/libcsoap/csoapparam.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoapparam.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoapparam.h,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Email: ayaz@jprogrammet.net + * Email: ayaz@jprogrammer.net ******************************************************************/ #ifndef CSOAP_PARAM_H #define CSOAP_PARAM_H @@ -106,6 +106,20 @@ void SoapParamSetValue(HSOAPPARAM param,const char* type, int SoapParamGetString(HSOAPPARAM param, char *buffer); +/** + * Convert the value of a soap parameter + * to string. Note that this is the same + * as SoapParamGetString except that you + * must free the result manually. + * + * @param param the soap parameter object + * + * @return the parameter in string format. + * Must be free manually!. + */ +char* SoapParamToString(HSOAPPARAM param); + + /** * Get the value of a soap parameter * in integer format @@ -185,3 +199,17 @@ HSOAPPARAM SoapParamCreate(HSOAPPARAM parent, const char *type, const char *format, ...); #endif + + + + + + + + + + + + + + diff --git a/libcsoap/csoapurl.c b/libcsoap/csoapurl.c index 96928e5..6a305e1 100644 --- a/libcsoap/csoapurl.c +++ b/libcsoap/csoapurl.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: csoapurl.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ + * $Id: csoapurl.c,v 1.2 2003/11/13 10:44:10 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -60,13 +60,16 @@ HSOAPURL CreateUrlFromIndex(const char* urlstr, int iprotocol, int ihost, int ip if (len > iport ) { size = len - iport; - url->m_context = (char*)malloc(sizeof(char)*size); + url->m_context = (char*)malloc(sizeof(char)*size+1); strncpy(url->m_context, &urlstr[iport], size); + url->m_context[size]='\0'; } else { url->m_context = NULL; } - SoapTraceEnter(FUNC, "Leaving url = %p", url); + SoapUrlDump(url); + + SoapTraceLeave(FUNC, "Leaving url(%p)", url); return url; }; @@ -88,7 +91,7 @@ HSOAPURL SoapUrlCreate(const char* urlstr) iprotocol = 0; len = strlen(urlstr); - printf("len = %d\n", len); + /* find protocol */ while (urlstr[iprotocol] != ':' && urlstr[iprotocol] != '\0') { @@ -172,14 +175,16 @@ void SoapUrlFree(HSOAPURL url) void SoapUrlDump(HSOAPURL url) { + const char *FUNC = "SoapUrlDump"; + if (url == NULL) { printf("(null)\n"); return ; } - printf("PROTOCOL : %s\n", url->m_protocol?url->m_protocol:"(null)"); - printf(" HOST : %s\n", url->m_host?url->m_host:"(null)"); - printf(" PORT : %d\n", url->m_port); - printf(" CONTEXT : %s\n", url->m_context?url->m_context:"(null)"); + SoapLog(LOG_DEBUG, FUNC, "PROTOCOL : %s\n", url->m_protocol?url->m_protocol:"(null)"); + SoapLog(LOG_DEBUG, FUNC, " HOST : %s\n", url->m_host?url->m_host:"(null)"); + SoapLog(LOG_DEBUG, FUNC, " PORT : %d\n", url->m_port); + SoapLog(LOG_DEBUG, FUNC, " CONTEXT : %s\n", url->m_context?url->m_context:"(null)"); } -- cgit v1.1-32-gdbae