diff options
author | snowdrop | 2004-02-03 08:07:35 +0000 |
---|---|---|
committer | snowdrop | 2004-02-03 08:07:35 +0000 |
commit | 65949d1c0eebfb52a1c860a2fc5acb2df7e8c299 (patch) | |
tree | ea5395d48dc9c90dbbe1195fa341ff287a51f2e1 /libcsoap | |
parent | 977f0fdf9834f391a62f74a67960e8e301c914bb (diff) | |
download | csoap-65949d1c0eebfb52a1c860a2fc5acb2df7e8c299.tar.gz csoap-65949d1c0eebfb52a1c860a2fc5acb2df7e8c299.tar.bz2 |
develop
Diffstat (limited to 'libcsoap')
32 files changed, 35 insertions, 3252 deletions
diff --git a/libcsoap/Makefile.am b/libcsoap/Makefile.am index 1dea69d..289cb1e 100644 --- a/libcsoap/Makefile.am +++ b/libcsoap/Makefile.am @@ -3,11 +3,19 @@ h_sources = soap-xml.h\ soap-fault.h\ -soap-call.h +soap-env.h\ +soap-service.h\ +soap-router.h\ +soap-client.h\ +soap-server.h cc_sources = soap-xml.c\ soap-fault.c\ -soap-call.c +soap-env.c\ +soap-service.c\ +soap-router.c\ +soap-client.c\ +soap-server.c library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)-$(GENERIC_API_VERSION)/$(GENERIC_LIBRARY_NAME) library_include_HEADERS = $(h_sources) diff --git a/libcsoap/csoap.c b/libcsoap/csoap.c deleted file mode 100644 index a38e81b..0000000 --- a/libcsoap/csoap.c +++ /dev/null @@ -1,62 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoap.h" - -#include "libcsoap/csoapxml.h" - - -/*----------------------------------------------------------------- - 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/csoap.h b/libcsoap/csoap.h deleted file mode 100644 index 3df9939..0000000 --- a/libcsoap/csoap.h +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************** - * $Id: csoap.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_H -#define CSOAP_H - - -/* Include csoap headers */ -#include "libcsoap/csoapcall.h" -#include "libcsoap/csoapfault.h" -#include "libcsoap/csoapurl.h" -#include "libcsoap/csoaptypes.h" - -/** - * Initialize routine. Must be called before any - * other csoap API function. - * - * @param argc command line parameter - * @param argv command line parameter - * - * @return CSOAP_OK if successfull. - */ -int SoapInit(int argc, char *argv[]); - - -/** - * Free a string allocated by a csoap - * function. - * - * @param str the string to free - */ -void SoapFreeStr(char* str); - - -#endif diff --git a/libcsoap/csoapbody.c b/libcsoap/csoapbody.c deleted file mode 100644 index 6499837..0000000 --- a/libcsoap/csoapbody.c +++ /dev/null @@ -1,96 +0,0 @@ -/****************************************************************** - * $Id: csoapbody.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapbody.h" -#include "libcsoap/csoaplog.h" - - -/*----------------------------------------------------------------- - FUNCTION: SoapBodyGetMethod -/-----------------------------------------------------------------*/ - -HSOAPMETHOD SoapBodyGetMethod(HSOAPBODY body, const char* method) -{ - HSOAPXML node; - const char* FUNC = "SoapBodyGetMethod"; - SoapTraceEnter(FUNC,"Method = %s", method); - - if (body == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid body (null)"); - return NULL; - } - - SoapLog(LOG_DEBUG, FUNC, "Searching method '%s'", method); - - node = SoapXmlFindNode((HSOAPXML)body, method); - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "Can not find method"); - return NULL; - } -/* - cur = ((xmlNodePtr)body)->xmlChildrenNode; - while (cur != NULL) { - if (!xmlStrcmp(cur->name, (const xmlChar*)method)) { - SoapTraceLeave(FUNC, "Found method (%p)", cur); - return (HSOAPMETHOD)cur; - } - cur = cur->next; - } -*/ - SoapTraceLeave(FUNC, "Method (%p)", node); - return node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapBodyGetFault -/-----------------------------------------------------------------*/ - -HSOAPFAULT SoapBodyGetFault(HSOAPBODY body) -{ - HSOAPXML node; - const char* FUNC = "SoapBodyGetFault"; - SoapTraceEnter(FUNC,"Body (%p)", body); - - if (body == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid body (null)"); - return NULL; - } - -/* - cur = ((xmlNodePtr)body)->xmlChildrenNode; - while (cur != NULL) { - if (!xmlStrcmp(cur->name, (const xmlChar*)"Fault")) { - SoapTraceLeave(FUNC, "Found fault (%p)", cur); - return (HSOAPFAULT)cur; - } - cur = cur->next; - } -*/ - - node = SoapXmlFindNode((HSOAPXML)body, "Fault"); - SoapTraceLeave(FUNC, "Fault (%p)", node); - return node; -} diff --git a/libcsoap/csoapbody.h b/libcsoap/csoapbody.h deleted file mode 100644 index 92d595e..0000000 --- a/libcsoap/csoapbody.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************** - * $Id: csoapbody.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_BODY_H -#define CSOAP_BODY_H - -#include "libcsoap/csoapmethod.h" -#include "libcsoap/csoapfault.h" - -typedef HSOAPXML HSOAPBODY; - - - -/** - * Returns the method object assigned to - * the given body. - * - * @param body handle to the body object - * @param method the method(operation) name - * to call. - * - * @return a handle to the method object or - * NULL if the the method was not found. - */ -HSOAPMETHOD SoapBodyGetMethod(HSOAPBODY body, const char *method); - - -/** - * Returns the fault object if any exist. - * - * @param body handle to the body object - * @return a handle to a fault object or - * NULL if no fault was generated. - */ -HSOAPFAULT SoapBodyGetFault(HSOAPBODY body); - - -#endif diff --git a/libcsoap/csoapcall.c b/libcsoap/csoapcall.c deleted file mode 100644 index 1756d29..0000000 --- a/libcsoap/csoapcall.c +++ /dev/null @@ -1,228 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapcall.h" -#include "libcsoap/csoaplog.h" -#include "libcsoap/csoaphttp.h" - -#include <stdarg.h> -#include <string.h> - -HSOAPCALL SoapCallCreate( - const char* url, - const char* uri, - const char* method) -{ - const char *FUNC = "SoapCallCreate"; - HSOAPCALL call; - - SoapTraceEnter(FUNC, "url=%s;uri=%s;method=%s", - url, uri, method); - call = (HSOAPCALL)malloc(sizeof(struct SOAPCALL)); - call->m_method = (char*)malloc(strlen(method)+1); - - call->m_env = SoapEnvCreate(uri, method); - call->m_url = SoapUrlCreate(url); - strcpy(call->m_method, method); - - SoapTraceLeave(FUNC, "call (%p)", call); - return call; -} - - -HSOAPPARAM SoapCallAddParam( - HSOAPCALL call, - const char* name, - const char* type, - const char* format, - ...) -{ - const char *FUNC = "SoapCallAddParam"; - HSOAPBODY body; - HSOAPMETHOD method; - HSOAPPARAM param, result; - va_list ap; - char buffer[SOAP_MAX_STRING_BUFFER]; - - SoapTraceEnter(FUNC, "name=%s;type=%s;format=%s", - name, type, format); - - va_start(ap, format); - vsprintf(buffer, format, ap); - va_end(ap); - - body = SoapEnvGetBody(call->m_env); - method = SoapBodyGetMethod(body, call->m_method); - param = SoapMethodParamContext(method); - result = SoapParamCreate(param, type, NULL, name, "%s", buffer); - - SoapTraceLeave(FUNC, "created param (%p)", result); - return result; -} - - -HSOAPPARAM SoapCallAddStringParam( - HSOAPCALL call, - const char* name, - const char* format, - ...) -{ - const char *FUNC = "SoapCallAddStringParam"; - HSOAPBODY body; - HSOAPMETHOD method; - HSOAPPARAM param, result; - va_list ap; - char buffer[SOAP_MAX_STRING_BUFFER]; - - SoapTraceEnter(FUNC, "name=%s;format=%s", - name, format); - - va_start(ap, format); - vsprintf(buffer, format, ap); - va_end(ap); - - body = SoapEnvGetBody(call->m_env); - method = SoapBodyGetMethod(body, call->m_method); - param = SoapMethodParamContext(method); - result = SoapParamCreateString(param, name, buffer); - SoapTraceLeave(FUNC, "created param (%p)", result); - return result; -} - - -HSOAPPARAM SoapCallAddIntParam( - HSOAPCALL call, - const char* name, - int value) -{ - const char *FUNC = "SoapCallAddIntParam"; - HSOAPBODY body; - HSOAPMETHOD method; - HSOAPPARAM param, result; - - SoapTraceEnter(FUNC, "name=%s;value=%d", - name, value); - - body = SoapEnvGetBody(call->m_env); - method = SoapBodyGetMethod(body, call->m_method); - param = SoapMethodParamContext(method); - result = SoapParamCreateInt(param, name, value); - SoapTraceLeave(FUNC, "created param (%p)", result); - return result; -} - -HSOAPPARAM SoapCallAddDoubleParam( - HSOAPCALL call, - const char* name, - double value) -{ - const char *FUNC = "SoapCallAddDoubleParam"; - HSOAPBODY body; - HSOAPMETHOD method; - HSOAPPARAM param, result; - - SoapTraceEnter(FUNC, "name=%s;value=%f", - name, value); - - body = SoapEnvGetBody(call->m_env); - method = SoapBodyGetMethod(body, call->m_method); - param = SoapMethodParamContext(method); - result = SoapParamCreateDouble(param, name, value); - SoapTraceLeave(FUNC, "created param (%p)", result); - return result; -} - - -HSOAPRES SoapCallInvoke(HSOAPCALL call) -{ - const char* FUNC = "SoapCallInvoke"; - const char* filename = "libcsoap/csoap-client.xml"; - char *buf; - CSOAP_STATUS status; - HSOAPENV env; - HSOAPRES res; - - SoapTraceEnter(FUNC,"%p", call); - - if (!call) { - SoapTraceLeaveWithError(FUNC, "Call is null!"); - return NULL; - } - - if (!call->m_env) { - SoapTraceLeaveWithError(FUNC, "Invalid envelope!"); - return NULL; - } - - if (!call->m_url) { - SoapTraceLeaveWithError(FUNC, "Invalid URL"); - return NULL; - } - -/* xmlSaveFormatFile(filename, ((xmlNodePtr)call->m_env)->doc, 1); - buffer = xmlBufferCreate(); - xmlNodeDump(buffer, ((xmlNodePtr)call->m_env)->doc, - (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("Length: %d\nResponse: \n%s\n\n\r", strlen(buf), buf?buf:"null"); - */ - SoapEnvDump(env); - /* free(buf);*/ - /* SoapEnvFree(env);*/ - res = SoapResCreate(env, call->m_method); - SoapTraceLeave(FUNC, "res (%p)", res); - return res; -} - - -void SoapCallFree(HSOAPCALL call) -{ - const char* FUNC = "SoapCallFree"; - SoapTraceEnter(FUNC,"%p", call); - - if (!call) { - SoapTraceLeave(FUNC, "Call is null!"); - return; - } - - SoapEnvFree(call->m_env); - - if (call->m_url) SoapUrlFree(call->m_url); - if (call->m_method) free(call->m_method); - - free(call); - SoapTraceLeave(FUNC, "Call destroyed"); -} - diff --git a/libcsoap/csoapcall.h b/libcsoap/csoapcall.h deleted file mode 100644 index bfb15fc..0000000 --- a/libcsoap/csoapcall.h +++ /dev/null @@ -1,90 +0,0 @@ -/****************************************************************** - * $Id: csoapcall.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_CALL_H -#define CSOAP_CALL_H - -#include "libcsoap/csoapparam.h" -#include "libcsoap/csoapres.h" -#include "libcsoap/csoapenv.h" -#include "libcsoap/csoapurl.h" - -typedef struct SOAPCALL* HSOAPCALL; - - -/** - * Stores information to - * send a soap call - */ -struct SOAPCALL -{ - HSOAPENV m_env; /* The soap envelope */ - HSOAPURL m_url; /* The target URL */ - char* m_method; /* The method to to call */ -}; - - -HSOAPCALL SoapCallCreate( - const char* url, - const char* uri, - const char* method -); - - -HSOAPPARAM SoapCallAddParam( - HSOAPCALL call, - const char* name, - const char* type, - const char* format, - ... -); - - -HSOAPPARAM SoapCallAddStringParam( - HSOAPCALL call, - const char* name, - const char* format, - ... -); - - -HSOAPPARAM SoapCallAddIntParam( - HSOAPCALL call, - const char* name, - int value -); - - -HSOAPPARAM SoapCallAddDoubleParam( - HSOAPCALL call, - const char* name, - double value -); - - -HSOAPRES SoapCallInvoke(HSOAPCALL call); - -void SoapCallFree(HSOAPCALL call); - - -#endif diff --git a/libcsoap/csoapenv.c b/libcsoap/csoapenv.c deleted file mode 100644 index 303bf46..0000000 --- a/libcsoap/csoapenv.c +++ /dev/null @@ -1,168 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapenv.h" -#include "libcsoap/csoaplog.h" - -static char *soap_env_ns = "http://schemas.xmlsoap.org/soap/envelope/"; -static char *soap_env_enc = "http://schemas.xmlsoap.org/soap/encoding/"; -static char *soap_xsi_ns = "http://www.w3.org/1999/XMLSchema-instance"; -static char *soap_xsd_ns = "http://www.w3.org/1999/XMLSchema"; - -/* - Parameters: - 1- soap_env_ns - 2- soap_env_enc - 3- xsi_ns - 4- xsd_ns - 3- method name - 4- uri - 5- method name(again) - */ -#define SOAP_MSG_TEMPLATE \ - "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"%s\" SOAP-ENV:encoding=\"%s\"" \ - " xmlns:xsi=\"%s\"" \ - " xmlns:xsd=\"%s\">" \ - " <SOAP-ENV:Body>"\ - " <m:%s xmlns:m=\"%s\">"\ - " </m:%s>" \ - " </SOAP-ENV:Body>"\ - "</SOAP-ENV:Envelope>" - - - -/*----------------------------------------------------------------- - FUNCTION: SoapEnvCreate -/-----------------------------------------------------------------*/ - -HSOAPENV SoapEnvCreate(const char *uri, const char *method) -{ - xmlDocPtr env; - xmlNodePtr node; - char buffer[1054]; - - const char* FUNC = "SoapEnvCreate"; - - SoapTraceEnter( FUNC, - "URI = '%s'\nMethod = '%s'", - uri, method); - - sprintf(buffer, SOAP_MSG_TEMPLATE, - soap_env_ns, soap_env_enc, soap_xsi_ns, - soap_xsd_ns, method, uri, method); - - env = xmlParseDoc(buffer); - if (env == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Can not create xml document!"); - return NULL; - } - - node = xmlDocGetRootElement(env); - if (node == NULL) { - SoapLog(LOG_ERROR, FUNC, - "xml document is empty!"); - return NULL; - } - - SoapLog(LOG_DEBUG, FUNC, - "Envelope created successfully"); - - SoapTraceLeave(FUNC, "Envelope: %p", node); - - return (HSOAPENV)node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapEnvGetBody -/-----------------------------------------------------------------*/ - -HSOAPBODY SoapEnvGetBody(HSOAPENV envelope) -{ - xmlNodePtr cur; - const char* FUNC = "SoapEnvGetBody"; - SoapTraceEnter(FUNC,""); - - if (envelope == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid envelope (null)"); - return NULL; - } - - cur = ((xmlNodePtr)envelope)->xmlChildrenNode; - while (cur != NULL) { - if (!xmlStrcmp(cur->name, (const xmlChar*)"Body")) { - SoapTraceLeave(FUNC, "Found Body (%p)", cur); - return (HSOAPBODY)cur; - } - cur = cur->next; - } - - SoapTraceLeave(FUNC, "No body found!"); - return NULL; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapEnvFree -/-----------------------------------------------------------------*/ - -void SoapEnvFree(HSOAPENV envelope) -{ - const char* FUNC = "SoapEnvFree"; - SoapTraceEnter(FUNC,"%p", envelope); - - if (!envelope) { - SoapTraceLeave(FUNC, "Envelope is null!"); - return; - } - - xmlFreeDoc(((xmlNodePtr)envelope)->doc); - SoapTraceLeave(FUNC, "Envelope destroyed"); -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapEnvDump -/-----------------------------------------------------------------*/ - -void SoapEnvDump(HSOAPENV env) -{ - const char *FUNC = "SoapEnvDump"; - - xmlBufferPtr buffer; - xmlDocPtr doc; - char *str; - - SoapTraceEnter(FUNC, "env (%p)", env); - - buffer = xmlBufferCreate(); - xmlNodeDump(buffer, ((xmlNodePtr)env)->doc, (xmlNodePtr)env, 1 ,1); - str = (char*)xmlBufferContent(buffer); - - SoapLog(LOG_DEBUG, FUNC, "%s\n", str?str:"null"); - - xmlBufferFree(buffer); - SoapTraceLeave(FUNC, "Leaving"); -} diff --git a/libcsoap/csoapenv.h b/libcsoap/csoapenv.h deleted file mode 100644 index 2046fff..0000000 --- a/libcsoap/csoapenv.h +++ /dev/null @@ -1,86 +0,0 @@ -/****************************************************************** - * $Id: csoapenv.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ -#ifndef CSOAP_ENV_H -#define CSOAP_ENV_H - -#include "libcsoap/csoapxml.h" -#include "libcsoap/csoapbody.h" - -typedef HSOAPXML HSOAPENV; - - -/** - * Creates a new soap envelope object - * - * @param uri the URI - * @param method the method name to call - * - * @return handle to an envelope object if - * creation was successfull or NULL otherwise. - */ -HSOAPENV SoapEnvCreate(const char *uri, const char *method); - - -/** - * Creates a new soap envelope object - * - * @param uri the URI - * @param method the method name to call - * - * @return handle to an envelope object if - * creation was successfull or NULL otherwise. - */ -HSOAPENV SoapEnvCreateWithFault(const char *uri, const char *method); - - -/** - * Returns the soap body object to - * a given envelope object. - * - * @param envelope the envelope - * @return handle to a body object if - * any exist or NULL otherwise - */ -HSOAPBODY SoapEnvGetBody(HSOAPENV envelope); - - -/** - * Free a given envelope object - * - * @param envelope the envelope object - * to free - */ -void SoapEnvFree(HSOAPENV envelope); - - -/** - * Dumps an envelope object to the stdout. - * For debug puposes only. - * - * @param env the envelope object to dump - */ -void SoapEnvDump(HSOAPENV env); - - -#endif diff --git a/libcsoap/csoaperror.h b/libcsoap/csoaperror.h deleted file mode 100644 index 6ee3b14..0000000 --- a/libcsoap/csoaperror.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************** - * $Id: csoaperror.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_ERROR_H -#define CSOAP_ERROR_H - -typedef int CSOAP_STATUS; - -/* Ok status */ -#define CSOAP_OK 0 - -/* Socket related errors */ -#define ERROR_SOCKET_CAN_NOT_GET_HOSTNAME 100001 -#define ERROR_SOCKET_CAN_NOT_CONNECT 100002 -#define ERROR_SOCKET_CAN_NOT_CREATE_SOCKET 100003 -#define ERROR_SOCKET_CAN_NOT_RECEIVE 100004 -#define ERROR_SOCKET_CAN_NOT_SEND 100005 - - -/* Generic errors */ -#define ERROR_NO_MEM 110001 - - -/* xml related error */ -#define ERROR_XML_CAN_NOT_PARSE 12001 - -#endif diff --git a/libcsoap/csoapfault.c b/libcsoap/csoapfault.c deleted file mode 100644 index 6755e7a..0000000 --- a/libcsoap/csoapfault.c +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************** - * $Id: csoapfault.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapfault.h" - - - -/*----------------------------------------------------------------- - FUNCTION: SoapFaultGetFaultCode -/-----------------------------------------------------------------*/ - -char* SoapFaultGetFaultCode(HSOAPFAULT fault) -{ - xmlNodePtr node; - const char *FUNC = "SoapFaultGetFaultCode"; - - SoapTraceEnter(FUNC, "Entering"); - - node = SoapXmlFindNode((HSOAPXML)fault, "faultcode"); - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "Can not find faultcode"); - return NULL; - } - - SoapTraceLeave(FUNC, "Leaving"); - return SoapXmlGetNodeValueAlloc(node); -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapFaultGetFaultString -/-----------------------------------------------------------------*/ - -char* SoapFaultGetFaultString(HSOAPFAULT fault) -{ - xmlNodePtr node; - const char *FUNC = "SoapFaultGetFaultString"; - - SoapTraceEnter(FUNC, "Entering"); - - node = SoapXmlFindNode((HSOAPXML)fault, "faultstring"); - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "Can not find faultstring"); - return NULL; - } - - SoapTraceLeave(FUNC, "Leaving"); - return SoapXmlGetNodeValueAlloc(node); -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapFaultGetFaultActor -/-----------------------------------------------------------------*/ - -char* SoapFaultGetFaultActor(HSOAPFAULT fault) -{ - xmlNodePtr node; - const char *FUNC = "SoapFaultGetFaultActor"; - - SoapTraceEnter(FUNC, "Entering"); - - node = SoapXmlFindNode((HSOAPXML)fault, "faultactor"); - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "Can not find faultactor"); - return NULL; - } - - SoapTraceLeave(FUNC, "Leaving"); - return SoapXmlGetNodeValueAlloc(node); -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapFaultGetFaultDetail -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapFaultGetDetail(HSOAPFAULT fault) -{ - xmlNodePtr node; - const char *FUNC = "SoapFaultGetFaultCode"; - - SoapTraceEnter(FUNC, "Entering"); - - node = SoapXmlFindNode((HSOAPXML)fault, "detail"); - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "Can not find detail"); - return NULL; - } - - SoapTraceLeave(FUNC, "Leaving"); - return (HSOAPPARAM)node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapFaultPrint -/-----------------------------------------------------------------*/ - -void SoapFaultPrint(FILE* f, HSOAPFAULT fault) -{ - char *str; - - if (fault == NULL) { - fprintf(f, "Fault object is null!.\n"); - return; - } - - str = SoapFaultGetFaultCode(fault); - fprintf(f, "FaultCode: %s\n", str?str:"null"); - SoapFreeStr(str); - - str = SoapFaultGetFaultString(fault); - fprintf(f, "FaultString: %s\n", str?str:"null"); - SoapFreeStr(str); - - str = SoapFaultGetFaultActor(fault); - fprintf(f, "FaultActor: %s\n", str?str:"null"); - SoapFreeStr(str); -} diff --git a/libcsoap/csoapfault.h b/libcsoap/csoapfault.h deleted file mode 100644 index fc706cb..0000000 --- a/libcsoap/csoapfault.h +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************** - * $Id: csoapfault.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_FAULT_H -#define CSOAP_FAULT_H - - -#include "libcsoap/csoapxml.h" -#include "libcsoap/csoapparam.h" - -typedef HSOAPXML HSOAPFAULT; - - -/** - * Returns the [faultcode] - * - * @param fault handle to a soap fault object - * @return an allocated string or NULL - * if no [faultcode] was set. - */ -char* SoapFaultGetFaultCode(HSOAPFAULT fault); - - -/** - * Returns the [faultstring] - * - * @param fault handle to a soap fault object - * @return an allocated string or NULL - * if no [faultstring] was set. - */ -char* SoapFaultGetFaultString(HSOAPFAULT fault); - - -/** - * Returns the [faultactor] - * - * @param fault handle to a soap fault object - * @return an allocated string or NULL - * if no [faultactor] was set. - */ -char* SoapFaultGetFaultActor(HSOAPFAULT fault); - - -/** - * Returns the [detail] - * - * @param fault handle to a soap fault object - * @return handle to a soap param object - */ -HSOAPPARAM SoapFaultGetDetail(HSOAPFAULT fault); - - -/** - * Sets the a [faultcode] field. - * This will be called internally. - * - * @param fault handle to a soap fault object - * @param faultcode the faultcode to set - */ -void SoapFaultSetFaultCode(HSOAPFAULT fault, const char* faultCode); - - -/** - * Sets the a [faultstring] field. - * This will be called internally. - * - * @param fault handle to a soap fault object - * @param faultstring the faultstring to set - */ -void SoapFaultSetFaultString(HSOAPFAULT fault, const char* faultString); - - -/** - * Sets the a [faultactor] field. - * This will be called internally. - * - * @param fault handle to a soap fault object - * @param faultactor the faultactor to set - */ -void SoapFaultSetFaultActor(HSOAPFAULT fault, const char* faultActor); - - -/** - * Sets the a [faultdetail] field. - * This will be called internally. - * - * @param fault handle to a soap fault object - * @param faultcode the detail to set - */ -void SoapFaultSetFaultDetail(HSOAPFAULT fault, HSOAPPARAM param); - - -/** - * Prints a fault object into the - * given file. This is for debug puposes. - * - * @param f the file to print into - * @param fault the fault object to print - */ -void SoapFaultPrint(FILE* f, HSOAPFAULT fault); - - -#endif - diff --git a/libcsoap/csoaphttp.c b/libcsoap/csoaphttp.c deleted file mode 100644 index 404d4b6..0000000 --- a/libcsoap/csoaphttp.c +++ /dev/null @@ -1,165 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ -#include "libcsoap/csoaphttp.h" -#include "libcsoap/csoaplog.h" -#include "libcsoap/csoapxml.h" - -/*----------------------------------------------------------------- - FUNCTION: SoapHttpCreateEnv -/-----------------------------------------------------------------*/ - -static -HSOAPENV SoapHttpCreateEnv(char* httpResponse) -{ - const char *FUNC = "SoapHttpCreateEnv"; - int count = 0; - int newline = 0; - xmlDocPtr env; - xmlNodePtr node; - int len; - char *tmp; - - SoapTraceEnter(FUNC, "Entering response =\n"); - while (*(httpResponse+count) != '\0') { - if (httpResponse[count]=='\r') { - count++; - continue; - } - if (httpResponse[count]=='\n') { - if (newline) break; - else newline = 1; - } else newline = 0; - - count++; - } - - len = strlen(httpResponse); - SoapLog(LOG_DEBUG, FUNC, "count = %d\n", count); - SoapLog(LOG_DEBUG, FUNC, "response length = %d\n", len); - - len = strlen(&httpResponse[count]); - SoapLog(LOG_DEBUG, FUNC, "xml response length = %d\n", len); - - while (httpResponse[count] == '\n' - || httpResponse[count] == '\r') { - count++; - } - - SoapLog(LOG_DEBUG, FUNC, "count = %d\n", count); - - SoapLog(LOG_DEBUG, FUNC, "casting\n"); - tmp = (char*)(&httpResponse[count]); - SoapLog(LOG_DEBUG, FUNC, "casting ok\n"); - - /* SoapLog(LOG_DEBUG, FUNC, "xml = %s\n",tmp?tmp:"null"); - */ - SoapLog(LOG_DEBUG, FUNC, "Starting parsing \n"); - env = xmlParseMemory((const char*)tmp, len); - if (env == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Can not create xml document!"); - return NULL; - } - - node = xmlDocGetRootElement(env); - if (node == NULL) { - SoapLog(LOG_ERROR, FUNC, - "xml document is empty!"); - return NULL; - } - - SoapLog(LOG_DEBUG, FUNC, - "Envelope created successfully"); - - SoapTraceLeave(FUNC, "env (%p)", node); - return (HSOAPENV)node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapHttpSend -/-----------------------------------------------------------------*/ - -CSOAP_STATUS SoapHttpSend(HSOAPURL url, HSOAPENV env, HSOAPENV* res) -{ - const char *FUNC = "SoapHttpSend"; - HSOAPSOCKET http; - int len; - ssize_t size; - char *tmp; - char *response; - char tmp2[1054]; - CSOAP_STATUS status; - xmlBufferPtr buffer; - xmlDocPtr doc; - - SoapTraceEnter(FUNC, "env (%p)", env); - - buffer = xmlBufferCreate(); - xmlNodeDump(buffer, ((xmlNodePtr)env)->doc, (xmlNodePtr)env, 1 ,1); - len = strlen((const char*)xmlBufferContent(buffer)); - - tmp = (char*)malloc(1054 + len); - if (tmp == NULL) - return ERROR_NO_MEM; - - status = SoapSocketCreate(url->m_host, url->m_port, &http); - if (status != CSOAP_OK) return status; - - /*SoapSocketGetResponse(http);*/ - 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", 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); - if (status != CSOAP_OK) return status; - - 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); - free(tmp); - free(response); - xmlBufferFree(buffer); - - SoapTraceLeave(FUNC, ""); - return CSOAP_OK; -} - - - - - - - - - - diff --git a/libcsoap/csoaphttp.h b/libcsoap/csoaphttp.h deleted file mode 100644 index 7d8f047..0000000 --- a/libcsoap/csoaphttp.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************** - * $Id: csoaphttp.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ -#ifndef CSOAP_HTTP_H -#define CSOAP_HTTP_H - -#include "libcsoap/csoapenv.h" -#include "libcsoap/csoapsocket.h" -#include "libcsoap/csoapurl.h" - -/** - * Sends a soap envelope to the given - * host and receives a soap envelope. - * - * @param url The target url - * @param env The soap envelope to send - * @param res The destination soap handle to - * receive the the envelope. - * - * @return CSOAP_OK if it was successfull. - */ -CSOAP_STATUS SoapHttpSend(HSOAPURL url, HSOAPENV env, HSOAPENV* res); - - -#endif diff --git a/libcsoap/csoaplog.c b/libcsoap/csoaplog.c deleted file mode 100644 index 2bc78e2..0000000 --- a/libcsoap/csoaplog.c +++ /dev/null @@ -1,66 +0,0 @@ -#include "libcsoap/csoaplog.h" - -#include <stdarg.h> -#include <stdio.h> - -static -void _SoapLogWrite(SoapLogLevel level, - const char* function, - 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); - */ -} - - -void SoapTraceEnter(const char* function, - const char* format, ...) -{ - va_list ap; - - va_start(ap, format); - _SoapLogWrite(LOG_TRACE, function, format, ap); - va_end(ap); -} - - -void SoapTraceLeave(const char* function, - const char* format, ...) -{ - va_list ap; - - va_start(ap, format); - _SoapLogWrite(LOG_TRACE, function, format, ap); - va_end(ap); -} - - -void SoapTraceLeaveWithError(const char* function, - const char* format, ...) -{ - va_list ap; - - va_start(ap, format); - _SoapLogWrite(LOG_ERROR, function, format, ap); - va_end(ap); -} - - -void SoapLog(SoapLogLevel level, const char* function, - const char* format, ...) -{ - va_list ap; - - va_start(ap, format); - _SoapLogWrite(level, function, format, ap); - va_end(ap); -} - - diff --git a/libcsoap/csoaplog.h b/libcsoap/csoaplog.h deleted file mode 100644 index 6d7edb6..0000000 --- a/libcsoap/csoaplog.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CSOAP_LOG_H -#define CSOAP_LOG_H - - -typedef enum tagSoapLogLevel -{ - LOG_TRACE, - LOG_DEBUG, - LOG_INFO, - LOG_WARN, - LOG_ERROR -}SoapLogLevel; - -void SoapTraceEnter(const char* function, - const char* format, ...); - -void SoapTraceLeave(const char* function, - const char* format, ...); -void SoapTraceLeaveWithError(const char* function, - const char* format, ...); - -void SoapLog(SoapLogLevel level, const char* function, - const char* format, ...); - -#endif - diff --git a/libcsoap/csoapmethod.c b/libcsoap/csoapmethod.c deleted file mode 100644 index 9e26ea1..0000000 --- a/libcsoap/csoapmethod.c +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************** - * $Id: csoapmethod.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ -#include "libcsoap/csoapmethod.h" -#include "libcsoap/csoaplog.h" - - -/*----------------------------------------------------------------- - FUNCTION:SoapMethodGetName -/-----------------------------------------------------------------*/ - -char* SoapMethodGetName(HSOAPMETHOD method) -{ - const char* FUNC = "SoapMethodGetName"; - char *name; - xmlNodePtr node; - SoapTraceEnter(FUNC,""); - - if (method == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid method (null)"); - return NULL; - } - node = (xmlNodePtr)method; - name = (char*)node->name; - SoapTraceLeave(FUNC, "Name = '%s'", name); - return name; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapMethodParamContext -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapMethodParamContext(HSOAPMETHOD method) -{ - const char* FUNC = "SoapMethodParamContext"; - char *name; - SoapTraceEnter(FUNC,""); - - if (method == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid method (null)"); - return NULL; - } - SoapTraceLeave(FUNC, "param context = '%p'", method); - - return (xmlNodePtr)method; -} - diff --git a/libcsoap/csoapmethod.h b/libcsoap/csoapmethod.h deleted file mode 100644 index b839298..0000000 --- a/libcsoap/csoapmethod.h +++ /dev/null @@ -1,56 +0,0 @@ -/****************************************************************** - * $Id: csoapmethod.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_METHOD_H -#define CSOAP_METHOD_H - -#include "libcsoap/csoapparam.h" - - -typedef HSOAPXML HSOAPMETHOD; - - -/** - * Returns the method name - * - * @param method handle to a soap method object - * @return the method name (do not free the string) - */ -char* SoapMethodGetName(HSOAPMETHOD method); - - -/** - * Returns the param context. Param context is - * also a param object. Use the param context - * as the parent of the method parameters. - * - * @param method the method object to get - * its param context - * - * @return The root parameter object if any - * exist , NULL otherwise. - */ -HSOAPPARAM SoapMethodParamContext(HSOAPMETHOD method); - - -#endif diff --git a/libcsoap/csoapparam.c b/libcsoap/csoapparam.c deleted file mode 100644 index 6fd7057..0000000 --- a/libcsoap/csoapparam.c +++ /dev/null @@ -1,411 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapparam.h" -#include "libcsoap/csoaplog.h" -#include "libcsoap/csoaptypes.h" -#include "libcsoap/csoapxml.h" - -#include <stdarg.h> - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamCreate -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamCreate(HSOAPPARAM parent, const char *type, - const char *ns, const char *name, - const char *format, ...) -{ - va_list ap; - char buffer[SOAP_MAX_STRING_BUFFER]; - xmlNodePtr newnode; - const char *FUNC = "SoapParamCreate"; - - SoapTraceEnter(FUNC,""); - - va_start(ap, format); - vsprintf(buffer, format, ap); - va_end(ap); - - newnode = xmlNewTextChild(parent, NULL, name, buffer); - - if (newnode == NULL) { - SoapTraceLeaveWithError(FUNC, - "Can not create new xml node"); - return NULL; - } - - if ( !xmlNewProp(newnode, "xsi:type", type)) { - SoapTraceLeaveWithError(FUNC, - "Can not create new xml attribute"); - return NULL; - } - - SoapTraceLeave(FUNC, "New xml node (%p)", newnode); - return newnode; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamCreateString -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamCreateString(HSOAPPARAM parent, const char *name, - const char *format, ...) -{ - va_list ap; - HSOAPPARAM node; - char buffer[SOAP_MAX_STRING_BUFFER]; - const char* FUNC = "SoapParamCreateString"; - SoapTraceEnter(FUNC,""); - - if (parent == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parent (null)"); - return NULL; - } - - if (name == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid name (null)"); - return NULL; - } - - if (format == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid format (null)"); - return NULL; - } - - SoapLog(LOG_DEBUG, FUNC, - "Creating string parameter\n" \ - "Name = '%s'" \ - "Format = %s", name, format); - - va_start(ap, format); - vsprintf(buffer, format, ap); - va_end(ap); - - node = SoapParamCreate(parent , SOAP_TYPE_STRING, - NULL, name, "%s", buffer); - - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "can not create param"); - return NULL; - } - - SoapTraceLeave(FUNC, "New param (%p)", node); - return (HSOAPPARAM)node; -} - - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamCreateInt -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamCreateInt(HSOAPPARAM parent, const char *name, - int value) -{ - HSOAPPARAM node; - const char* FUNC = "SoapParamCreateInt"; - SoapTraceEnter(FUNC,""); - - if (parent == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parent (null)"); - return NULL; - } - - if (name == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid name (null)"); - return NULL; - } - - node = SoapParamCreate(parent , SOAP_TYPE_INT, - NULL, name, "%d", value); - - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "can not create param"); - return NULL; - } - - SoapTraceLeave(FUNC, "New param (%p)", node); - return node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamCreateDouble -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamCreateDouble(HSOAPPARAM parent, const char *name, - double value) -{ - HSOAPPARAM node; - const char* FUNC = "SoapParamCreateDouble"; - SoapTraceEnter(FUNC,""); - - if (parent == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parent (null)"); - return NULL; - } - - if (name == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid name (null)"); - return NULL; - } - - node = SoapParamCreate(parent, SOAP_TYPE_DOUBLE, - NULL, name, "%f", value); - - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, "can not create param"); - return NULL; - } - - SoapTraceLeave(FUNC, "New param (%p)", node); - return node; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamSetValue -/-----------------------------------------------------------------*/ - -void SoapParamSetValue(HSOAPPARAM param, const char* type, - const char* format, ...) -{ - // Not implemented yet! -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamGetString -/-----------------------------------------------------------------*/ - -int SoapParamGetString(HSOAPPARAM param, char *dest) -{ - char *value; - int len; - xmlNodePtr xmlNode; - const char* FUNC = "SoapParamGetString"; - SoapTraceEnter(FUNC,""); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'param' (null)"); - return 0; - } - - xmlNode = (xmlNodePtr)param; - value = (char*)xmlNodeListGetString(xmlNode->doc, - xmlNode->xmlChildrenNode,1); - - if (dest) - strcpy(dest, value); - - len = strlen(value); - xmlFree(value); - - SoapTraceLeave(FUNC, "Value = '%s'\nLength=%d", dest?dest:"null", len); - 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 -/-----------------------------------------------------------------*/ - -int SoapParamGetInt(HSOAPPARAM param) -{ - int value; - char buffer[15]; - const char* FUNC = "SoapParamGetInt"; - SoapTraceEnter(FUNC,""); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'param' (null)"); - return 0; - } - - SoapParamGetString(param, buffer); - value = atoi(buffer); - SoapTraceLeave(FUNC, "Value = %d", value); - return value; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamGetDouble -/-----------------------------------------------------------------*/ - -double SoapParamGetDouble(HSOAPPARAM param) -{ - double value; - char buffer[15]; - const char* FUNC = "SoapParamGetDouble"; - SoapTraceEnter(FUNC,""); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'param' (null)"); - return 0.0; - } - - SoapParamGetString(param, buffer); - value = atof(buffer); - SoapTraceLeave(FUNC, "Value = %f", value); - return value; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamGetChildren -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamGetChildren(HSOAPPARAM param) -{ - xmlNodePtr children; - const char* FUNC = "SoapParamGetChildren"; - SoapTraceEnter(FUNC,""); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'param' (null)"); - return NULL; - } - - children = ((xmlNodePtr)param)->xmlChildrenNode; - while (children != NULL) { - if (children->type != XML_ELEMENT_NODE) - children = children->next; - else break; - } - SoapTraceLeave(FUNC, "Children node (%p)", children); - return (HSOAPPARAM)children; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamGetNext -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapParamGetNext(HSOAPPARAM param) -{ - xmlNodePtr children; - const char* FUNC = "SoapParamGetNext"; - xmlNodePtr node = (xmlNodePtr)param; - SoapTraceEnter(FUNC,"Enter. node = %s", node?(char*)node->name:"null"); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'param' (null)"); - return NULL; - } - - children = node->next; - - while (children != NULL) { - if (children->type != XML_ELEMENT_NODE) - children = children->next; - else break; - } - - SoapTraceLeave(FUNC, "Children node (%p)", children); - return (HSOAPPARAM)children; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamGetType -/-----------------------------------------------------------------*/ - -char* SoapParamGetType(HSOAPPARAM param) -{ - const char* FUNC = "SoapParamGetType"; - char *value; - xmlNodePtr node = (xmlNodePtr)param; - SoapTraceEnter(FUNC,"Enter. node = %s", node?(char*)node->name:"null"); - - value = SoapXmlGetAttr(node, NULL, "type"); - - SoapTraceLeave(FUNC, "Type = %s", value?value:"(null}"); - return value; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapParamTypeIs -/-----------------------------------------------------------------*/ - -int SoapParamTypeIs(HSOAPPARAM param, const char* type) -{ - const char* FUNC = "SoapParamTypeIs"; - char *value; - SoapTraceEnter(FUNC,"Enter. Type = %s", type?type:"(null)"); - - if (type == NULL) { - SoapTraceLeaveWithError(FUNC, "type is null"); - return 0; - } - - value = SoapParamGetType(param); - - SoapTraceLeave(FUNC, "Leave"); - return (!strcmp(value, type)); -} - - diff --git a/libcsoap/csoapparam.h b/libcsoap/csoapparam.h deleted file mode 100644 index 75889e4..0000000 --- a/libcsoap/csoapparam.h +++ /dev/null @@ -1,215 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_PARAM_H -#define CSOAP_PARAM_H - -#include "libcsoap/csoapxml.h" - - -typedef HSOAPXML HSOAPPARAM; - - -#define SOAP_MAX_STRING_BUFFER 1054 - - -/** - * Creates a string soap parameter - * - * <LI>Default type: "xsd:string" - * - * @param parent the parent param object - * @param name the parameter name - * @param format the parameter value - * - * @return handle to a parameter object if - * the creation was successfull, NULL otherwise - */ -HSOAPPARAM SoapParamCreateString( HSOAPPARAM parent, const char *name, - const char *format, ...); - - -/** - * Creates an integer soap parameter - * - * <LI>Default type: "xsd:integer" - * - * @param parent the parent param object - * @param name the parameter name - * @param value the parameter value - * - * @return handle to a parameter object if - * the creation was successfull, NULL otherwise - */ -HSOAPPARAM SoapParamCreateInt( HSOAPPARAM parent, const char *name, - int value); - - -/** - * Creates a double soap parameter - * - * <LI>Default type: "xsd:double" - * - * @param parent the parent param object - * @param name the parameter name - * @param value the parameter value - * - * @return handle to a parameter object if - * the creation was successfull, NULL otherwise - */ -HSOAPPARAM SoapParamCreateDouble( HSOAPPARAM parent, const char *name, - double value); - - -/** - * Sets the parameter value. - * - * @param param the parameter object - * @param type a custom type name - * @param format value of the parameter - */ -void SoapParamSetValue(HSOAPPARAM param,const char* type, - const char* format, ...); - - -/** - * Get the value of a soap parameter - * in string format - * - * @param param the soap parameter object - * @param buffer an allocated character buffer - * to receive the content. If this is NULL, - * this function will return the size only. - * - * @return size of the content. - */ -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 - * - * @param param the soap parameter object - * @return the param content as integer - */ -int SoapParamGetInt(HSOAPPARAM param); - - -/** - * Get the value of a soap parameter - * in double format - * - * @param param the soap parameter object - * @return the param content as double - */ -double SoapParamGetDouble(HSOAPPARAM param); - - -/** - * Get the children parameter nodes. - * This acts actually like an xml node. - * - * @param param the soap parameter object - * @return handle to the first child node - */ -HSOAPPARAM SoapParamGetChildren(HSOAPPARAM param); - - -/** - * Get the next parameter. - * This acts actually like an xml node. - * - * @param param the soap parameter object - * @return handle to the next node - */ -HSOAPPARAM SoapParamGetNext(HSOAPPARAM param); - - -/** - * Checks if the type is equals with - * the given one. - * - * @param param the param to check - * @param type the type to check - * - * @return 0 if the parameter type not equals to 'type' - */ -int SoapParamTypeIs(HSOAPPARAM param, const char* type); - - -/** - * Returns parameters type. - * - * @param param the param to return its type - * - * @return returns parameters type - */ -char* SoapParamGetType(HSOAPPARAM param); - - -/** - * Creates a new parameter node. - * This is used internally. - * - * @param parent the parent soap parameter object - * @param type the parameter type - * @param ns the namespace of the parameter - * @param name name of the parameter - * @param format value of the parameter - * - * @return A newly created soap parameter object - */ -HSOAPPARAM SoapParamCreate(HSOAPPARAM parent, const char *type, - const char *ns, const char *name, - const char *format, ...); - -#endif - - - - - - - - - - - - - - diff --git a/libcsoap/csoapres.c b/libcsoap/csoapres.c deleted file mode 100644 index 0531fae..0000000 --- a/libcsoap/csoapres.c +++ /dev/null @@ -1,154 +0,0 @@ -/****************************************************************** - * $Id: csoapres.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapres.h" -#include "libcsoap/csoaplog.h" - - -/*----------------------------------------------------------------- - FUNCTION: SoapResCreate -/-----------------------------------------------------------------*/ - -HSOAPRES SoapResCreate(HSOAPENV env, const char* methodName) -{ - HSOAPRES res = (HSOAPRES)malloc(sizeof(struct SOAPRES)); - res->m_env = env; - res->m_method = (char*)malloc(sizeof(char)*strlen(methodName)+1); - strcpy(res->m_method, methodName); - return res; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapResGetFault -/-----------------------------------------------------------------*/ - -HSOAPFAULT SoapResGetFault(HSOAPRES res) -{ - const char *FUNC = "SoapResGetFault"; - HSOAPBODY body; - HSOAPFAULT fault; - - SoapTraceEnter(FUNC, "Entering"); - - if (res == NULL) { - SoapTraceLeaveWithError(FUNC, "res is null"); - return NULL; - } - - if (res->m_env == NULL) { - SoapTraceLeaveWithError(FUNC, "res->m_env is null"); - return NULL; - } - - if (!(body = SoapEnvGetBody(res->m_env))) { - SoapTraceLeaveWithError(FUNC, "can not get body"); - return NULL; - } - - fault = SoapBodyGetFault(body); - SoapTraceLeave(FUNC, "Leaving fault (%p)", fault); - - return fault; -} - -/*----------------------------------------------------------------- - FUNCTION: SoapResFree -/-----------------------------------------------------------------*/ - -void SoapResFree(HSOAPRES res) -{ - const char *FUNC = "SoapResFree"; - - SoapTraceEnter(FUNC, "Entering"); - - if (res == NULL) { - SoapTraceLeaveWithError(FUNC, "res is null"); - return; - } - - if (res->m_env == NULL) { - SoapTraceLeaveWithError(FUNC, "res->m_env is null"); - return; - } - - SoapEnvFree(res->m_env); - free(res); - - SoapTraceLeave(FUNC, "Leaving"); -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapResFree -/-----------------------------------------------------------------*/ - -HSOAPPARAM SoapResGetParamChildren(HSOAPRES res) -{ - const char *FUNC = "SoapResGetParamChildren"; - HSOAPBODY body; - HSOAPMETHOD method; - HSOAPPARAM param; - char tmp[1054]; - - SoapTraceEnter(FUNC, "Entering"); - - if (res == NULL) { - SoapTraceLeaveWithError(FUNC, "res is null"); - return NULL; - } - - if (res->m_env == NULL) { - SoapTraceLeaveWithError(FUNC, "res->m_env is null"); - return NULL; - } - - if (!(body = SoapEnvGetBody(res->m_env))) { - SoapTraceLeaveWithError(FUNC, "can not get body"); - return NULL; - } - - sprintf(tmp, "%sResponse", res->m_method); - method = SoapBodyGetMethod(body, tmp); - - if (method == NULL) { - SoapTraceLeaveWithError(FUNC, "method is null"); - return NULL; - } - - param = SoapMethodParamContext(method); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, "param is null"); - return NULL; - } - - param = SoapParamGetChildren(method); - - if (param == NULL) { - SoapTraceLeaveWithError(FUNC, "child is null"); - return NULL; - } - - return param; -} diff --git a/libcsoap/csoapres.h b/libcsoap/csoapres.h deleted file mode 100644 index 3ad38cc..0000000 --- a/libcsoap/csoapres.h +++ /dev/null @@ -1,90 +0,0 @@ -/****************************************************************** - * $Id: csoapres.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_RES_H -#define CSOAP_RES_H - -#include "libcsoap/csoapxml.h" -#include "libcsoap/csoapenv.h" - -typedef struct SOAPRES* HSOAPRES; - - -/** - * The result object. Stores - * the response of a soap request. - */ -struct SOAPRES -{ - HSOAPENV m_env; /* The soap envelope object */ - char *m_method; /* The called method name */ -}; - - -/** - * Creates a new soap result object. - * This is used actually internally. - * To get a soap result see - * <B>HSOAPCALL</B> - * - * @param env the envelope object to use - * @param methodName the called method name - * @return handle to a soap result object. - */ -HSOAPRES SoapResCreate(HSOAPENV env, const char* methodName); - - -/** - * Returns a soap fault object - * if any exist. This can also be - * called to check if any faults - * was occured for this result. - * - * @param res handle to the soap result object - * @return handle to a fault object or - * NULL if no fault was generated. - */ -HSOAPFAULT SoapResGetFault(HSOAPRES res); - - -/** - * Returns the first parameter - * in the result object if any exist. - * - * @param res handle to the soap result object - * @return handle to a soap param object - * NULL if no parameter was received. - */ -HSOAPPARAM SoapResGetParamChildren(HSOAPRES res); - - -/** - * Free a soap result object. - * This must be called after the result - * object was used. - * - * @param res The soap result object to free - */ -void SoapResFree(HSOAPRES res); - -#endif diff --git a/libcsoap/csoapsocket.c b/libcsoap/csoapsocket.c deleted file mode 100644 index 519fcab..0000000 --- a/libcsoap/csoapsocket.c +++ /dev/null @@ -1,149 +0,0 @@ -/****************************************************************** - * $Id: csoapsocket.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ - -#include "libcsoap/csoapsocket.h" -#include "libcsoap/csoaperror.h" -#include "libcsoap/csoaplog.h" - - - -/*----------------------------------------------------------------- - FUNCTION: SoapSocketCreate -/-----------------------------------------------------------------*/ - -CSOAP_STATUS SoapSocketCreate(const char* hostname, int port, HSOAPSOCKET* hSock) -{ - - int sock; - struct sockaddr_in address; - struct hostent* host; - int i; - - sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock <= 0) return ERROR_SOCKET_CAN_NOT_CREATE_SOCKET; - - /* Get host data */ - host = gethostbyname(hostname); - if (host == NULL) return ERROR_SOCKET_CAN_NOT_GET_HOSTNAME; - - /* set server addresss */ - address.sin_family = host->h_addrtype;; - address.sin_port = htons(port); - memcpy((char*)&address.sin_addr.s_addr, - host->h_addr_list[0], host->h_length); - - /* connect to the server */ - if (connect(sock, (struct sockaddr*) &address, sizeof(address)) != 0) - return ERROR_SOCKET_CAN_NOT_CONNECT; - - *hSock = sock; - return CSOAP_OK; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapSocketRecv -/-----------------------------------------------------------------*/ - -CSOAP_STATUS SoapSocketRecv(HSOAPSOCKET sock, char** buffer, ssize_t* totalSize) -{ - const char *FUNC = "SoapSocketRecv"; - ssize_t size; - int chunk=1; - char tmp[SOCKET_MAX_BUFSIZE+1]; - - SoapTraceEnter( FUNC, "Entering"); - *totalSize = 0; - *buffer = 0; - - do { - SoapLog(LOG_DEBUG, FUNC, "Receiving buffer\n"); - size = recv(sock, tmp, SOCKET_MAX_BUFSIZE, 0); - SoapLog(LOG_DEBUG, FUNC, "received = %s\n", tmp); - if (size == -1) { - printf("Error reading from socket\n"); - return ERROR_SOCKET_CAN_NOT_RECEIVE; - } - *totalSize += size; - if (*buffer) { - SoapLog(LOG_DEBUG, FUNC, "realloc\n"); - *buffer = (char*)realloc(*buffer, SOCKET_MAX_BUFSIZE*chunk+1); - strcat(*buffer, tmp); - SoapLog(LOG_DEBUG, FUNC,"realloc ok\n"); - } else { - SoapLog(LOG_DEBUG, FUNC, "alloc\n"); - *buffer = (char*)realloc(NULL, SOCKET_MAX_BUFSIZE+1); - strcpy(*buffer, tmp); - SoapLog(LOG_DEBUG, FUNC,"alloc ok\n"); - } - - SoapLog(LOG_DEBUG, FUNC, "totalSize = %d\n", *totalSize); - (*buffer)[*totalSize] = '\0'; - chunk++; - } while (size > 0); - - SoapTraceLeave(FUNC, "totalsize: %d", *totalSize); - return CSOAP_OK; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapSocketSend -/-----------------------------------------------------------------*/ - -CSOAP_STATUS SoapSocketSend(HSOAPSOCKET sock, const char* req, ssize_t* sentSize) -{ - const char *FUNC = "SoapSocketSend"; - ssize_t size; - - SoapTraceEnter(FUNC, ""); - - size = send(sock, req, strlen(req), 0); - if (size == -1) - return ERROR_SOCKET_CAN_NOT_SEND; - - *sentSize = size; - SoapTraceLeave(FUNC, ""); - return CSOAP_OK; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapSocketInitialize -/-----------------------------------------------------------------*/ - -CSOAP_STATUS SoapSocketInitialize() -{ - const char *FUNC = "SoapSocketInitialize"; - SoapTraceEnter(FUNC, ""); - -#ifdef WIN32 - /* Initialize WinSocket for the Windows version */ -#endif - - SoapTraceLeave(FUNC, ""); - return CSOAP_OK; -} - - diff --git a/libcsoap/csoapsocket.h b/libcsoap/csoapsocket.h deleted file mode 100644 index 76f8227..0000000 --- a/libcsoap/csoapsocket.h +++ /dev/null @@ -1,109 +0,0 @@ -/****************************************************************** - * $Id: csoapsocket.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_SOCKET_H -#define CSOAP_SOCKET_H - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -#endif - -#ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> -#endif - -#ifdef HAVE_NETDB_H -# include <netdb.h> -#endif - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif - -#include <stdio.h> -#include "libcsoap/csoaperror.h" - -typedef int HSOAPSOCKET; - -#define SOCKET_MAX_BUFSIZE 1054 - - -/** - * Initializes the soap socket module. - * This is called internally. Before any - * socket operation. - * - * @return CSOAP_OK if it was successfull - */ -int SoapSocketInitialize(); - - -/** - * Creates a new soap compatible socket object. - * - * @param host the host to connect - * @param port the port to connect - * @param socket the destination pointer - * to receive a connected socket object - * - * @return CSOAP_OK if it was successfull. - */ -CSOAP_STATUS SoapSocketCreate(const char* host, int port, HSOAPSOCKET* socket); - -/** - * Sends data to the connected socket. - * - * @param sock A connected socket object - * @param req data to send - * @param sentSize the size of sent data - * - * @return CSOAP_OK if it was successfull - */ -CSOAP_STATUS SoapSocketSend(HSOAPSOCKET sock, const char* req,ssize_t* sentSize); - - -/** - * Receives data from the connected socket. - * - * @param sock A connected socket object - * @param res destination pointer to receive - * the data. This will be allocated in this - * function. So you have to free it. - * @param receivedSize the size of received data - * - * @return CSOAP_OK if it was successfull - */ -CSOAP_STATUS SoapSocketRecv(HSOAPSOCKET sock, char** res,ssize_t* receivedSize); - - -#endif - - diff --git a/libcsoap/csoaptypes.h b/libcsoap/csoaptypes.h deleted file mode 100644 index 042ffa8..0000000 --- a/libcsoap/csoaptypes.h +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************** - * $Id: csoaptypes.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_TYPES_H -#define CSOAP_TYPES_H - - -#define SOAP_TYPE_STRING "xsd:string" -#define SOAP_TYPE_INT "xsd:int" -#define SOAP_TYPE_DOUBLE "xsd:double" - - -#endif diff --git a/libcsoap/csoapurl.c b/libcsoap/csoapurl.c deleted file mode 100644 index 6a305e1..0000000 --- a/libcsoap/csoapurl.c +++ /dev/null @@ -1,190 +0,0 @@ -/****************************************************************** - * $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 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapurl.h" -#include "libcsoap/csoaplog.h" - -#include <stdio.h> -#include <string.h> - - -static -HSOAPURL CreateUrlFromIndex(const char* urlstr, int iprotocol, int ihost, int iport) -{ - const char *FUNC = "CreateUrlFromIndex"; - int len, size; - char tmp[8]; - HSOAPURL url; - - SoapTraceEnter(FUNC, "Entering"); - - url = (HSOAPURL)malloc(sizeof(struct SOAPURL)); - - url->m_protocol = (char*)malloc(sizeof(char)*iprotocol+1); - strncpy(url->m_protocol, urlstr, iprotocol); - - size = ihost - iprotocol - 3; - url->m_host = (char*)malloc(sizeof(char)*size); - strncpy(url->m_host, &urlstr[iprotocol+3], size); - - if (iport > ihost) - { - size = iport - ihost; - strncpy(tmp, &urlstr[ihost+1], size); - url->m_port = atoi(tmp); - } else { - url->m_port = 80; - } - - len = strlen(urlstr); - if (len > iport ) - { - size = len - iport; - 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; - } - - SoapUrlDump(url); - - SoapTraceLeave(FUNC, "Leaving url(%p)", url); - return url; -}; - - -/*----------------------------------------------------------------- - FUNCTION: SoapUrlCreate -/-----------------------------------------------------------------*/ - -HSOAPURL SoapUrlCreate(const char* urlstr) -{ - const char *FUNC = "SoapUrlCreate"; - int iprotocol; - int ihost; - int iport; - int len; - HSOAPURL url = NULL; - - SoapTraceEnter(FUNC, "Entering. URL = %s", urlstr?urlstr:"null"); - - iprotocol = 0; - len = strlen(urlstr); - - /* find protocol */ - while (urlstr[iprotocol] != ':' && urlstr[iprotocol] != '\0') - { -/* printf("protocol: urlstr[%d] = %c\n",iprotocol, urlstr[iprotocol] );*/ - iprotocol++; - } - - if (iprotocol == 0) { - SoapTraceLeaveWithError(FUNC, "no protocol"); - return NULL; - } - - if (iprotocol + 3 >= len) { - SoapTraceLeaveWithError(FUNC, "no host"); - return NULL; - } - - if ( urlstr[iprotocol] != ':' - && urlstr[iprotocol+1] != '/' - && urlstr[iprotocol+2] != '/') - { - SoapTraceLeaveWithError(FUNC, "no protocol"); - return NULL; - } - - /* find host */ - ihost = iprotocol + 3; - while (urlstr[ihost] != ':' - && urlstr[ihost] != '/' - && urlstr[ihost] != '\0') - { -/* printf("host: urlstr[%d] = %c\n",ihost, urlstr[ihost] );*/ - ihost++; - } - - if (ihost == iprotocol + 1) { - SoapTraceLeaveWithError(FUNC, "no host"); - return NULL; - } - - /* find port */ - iport = ihost; - if (ihost + 1 < len) { - if (urlstr[ihost] == ':') { - while (urlstr[iport] != '/' && urlstr[iport] != '\0') { -/* printf("port: urlstr[%d] = %c\n", iport, urlstr[iport] );*/ - iport++; - } - } - } - -/* - printf("iprotocol = %d\nihost = %d\niport = %d\nlen = %d\n", - iprotocol, ihost, iport, len); -*/ - url = CreateUrlFromIndex(urlstr, iprotocol, ihost, iport); - SoapTraceLeave(FUNC, "Leaving url (%p)", url); - return url; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapUrlFree -/-----------------------------------------------------------------*/ - -void SoapUrlFree(HSOAPURL url) -{ - if (url != NULL) { - if (url->m_protocol) free(url->m_protocol); - if (url->m_host) free(url->m_host); - if (url->m_context) free(url->m_context); - - free(url); - } -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapUrlDump -/-----------------------------------------------------------------*/ - -void SoapUrlDump(HSOAPURL url) -{ - const char *FUNC = "SoapUrlDump"; - - if (url == NULL) { - printf("(null)\n"); - return ; - } - - 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)"); - -} diff --git a/libcsoap/csoapurl.h b/libcsoap/csoapurl.h deleted file mode 100644 index 191b344..0000000 --- a/libcsoap/csoapurl.h +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************** - * $Id: csoapurl.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammet.net - ******************************************************************/ -#ifndef CSOAP_URL_H -#define CSOAP_URL_H - - -/* Include csoap headers */ - - -typedef struct SOAPURL* HSOAPURL; - - -struct SOAPURL -{ - char *m_protocol; - char *m_host; - int m_port; - char *m_context; -}; - - -/** - * Creates a new url object - * - * @param url the url string - * - * @return A soap url object if it was - * successfull, NULL otherwise. - */ -HSOAPURL SoapUrlCreate(const char* url); - - -/** - * Free a url object - * - * @param url the url to free - */ -void SoapUrlFree(HSOAPURL url); - - -/** - * Dump the url data (for debugging) - * - * @param url the url to show its content - */ -void SoapUrlDump(HSOAPURL url); - - -#endif diff --git a/libcsoap/csoapxml.c b/libcsoap/csoapxml.c deleted file mode 100644 index fa51fdd..0000000 --- a/libcsoap/csoapxml.c +++ /dev/null @@ -1,151 +0,0 @@ -/****************************************************************** - * $Id: csoapxml.c,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#include "libcsoap/csoapxml.h" - -#include "libcsoap/csoaplog.h" - - -/*----------------------------------------------------------------- - FUNCTION: SoapXmlFindNode -/-----------------------------------------------------------------*/ - -HSOAPXML -SoapXmlFindNode(HSOAPXML root, const char* nodeName) -{ - xmlNodePtr cur; - const char* FUNC = "SoapXmlFindNode"; - - SoapTraceEnter(FUNC,"root (%p) node (%p)", - root, nodeName?nodeName:"null"); - - if (root == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid root node (null)"); - return NULL; - } - - if (nodeName == NULL) { - SoapLog(LOG_ERROR, FUNC, - "Invalid node name (null)"); - return NULL; - } - - cur = ((xmlNodePtr)root)->xmlChildrenNode; - while (cur != NULL) { - if (!xmlStrcmp(cur->name, (const xmlChar*)nodeName)) { - SoapTraceLeave(FUNC, "Found '%s' (%p)", nodeName, cur); - return cur; - } - cur = cur->next; - } - - SoapTraceLeave(FUNC, "No '%s' found!", nodeName); - return NULL; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapXmlGetNodeValue -/-----------------------------------------------------------------*/ - -int -SoapXmlGetNodeValue(HSOAPXML xmlNode, char* dest) -{ - char *value; - int len; - const char* FUNC = "SoapXmlGetNodeValue"; - SoapTraceEnter(FUNC,"Entering"); - - - if (xmlNode == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'xmlNode' (null)"); - return 0; - } - - value = (char*)xmlNodeListGetString(((xmlNodePtr)xmlNode)->doc, - ((xmlNodePtr)xmlNode)->xmlChildrenNode,1); - strcpy(dest, value); - len = strlen(value); - xmlFree(value); - - SoapTraceLeave(FUNC, "Value = '%s'\nLength=%d", dest, len); - return len; - -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapXmlGetNodeValueAlloc -/-----------------------------------------------------------------*/ - -char* -SoapXmlGetNodeValueAlloc(HSOAPXML xmlNode) -{ - char *value; - int len; - const char* FUNC = "SoapXmlGetNodeValueAlloc"; - SoapTraceEnter(FUNC,"Entering"); - - - if (xmlNode == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'xmlNode' (null)"); - return 0; - } - - value = (char*)xmlNodeListGetString(((xmlNodePtr)xmlNode)->doc, - ((xmlNodePtr)xmlNode)->xmlChildrenNode,1); - SoapTraceLeave(FUNC, "Value = '%s'\n", value); - return value; -} - - -/*----------------------------------------------------------------- - FUNCTION: SoapXmlGetAttr -/-----------------------------------------------------------------*/ - -char* SoapXmlGetAttr(HSOAPXML node, const char* ns, const char* key) -{ - char *value; - int len; - const char* FUNC = "SoapXmlGetAttr"; - SoapTraceEnter(FUNC,"Entering"); - - - if (node == NULL) { - SoapTraceLeaveWithError(FUNC, - "Invalid parameter 'node' (null)"); - return NULL; - } - - if (ns == NULL) { - value = (char*)xmlGetProp(node, key); - } else { - value = (char*)xmlGetNsProp(node, key, ns); - } - - SoapTraceLeave(FUNC, "Value = '%s'\n", value?value:"(null)"); - return value; -} diff --git a/libcsoap/csoapxml.h b/libcsoap/csoapxml.h deleted file mode 100644 index 7e76df7..0000000 --- a/libcsoap/csoapxml.h +++ /dev/null @@ -1,90 +0,0 @@ -/****************************************************************** - * $Id: csoapxml.h,v 1.1 2003/11/12 13:22:58 snowdrop Exp $ - * - * CSOAP Project: A SOAP client/server library in C - * Copyright (C) 2003 Ferhat Ayaz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Email: ayaz@jprogrammer.net - ******************************************************************/ -#ifndef CSOAP_XML_H -#define CSOAP_XML_H - - -#include <libxml/xmlmemory.h> -#include <libxml/parser.h> - -#include "libcsoap/csoaperror.h" - - -typedef xmlNodePtr HSOAPXML; - - -/** - * Search for an xml node which - * has the name nodeName - * - * @param root the root xml node to search - * the nodeName in its children nodes - * @param nodeName the nodeName to find - * - * @return an xml node if any exist, - * NULL otherwise - */ -HSOAPXML SoapXmlFindNode(HSOAPXML root, const char* nodeName); - - -/** - * Receives the node value - * - * @param node the xml node to receive - * its text node - * @param dest the destination string - * - * @return length of content copied into dest - */ -int SoapXmlGetNodeValue(HSOAPXML node, char* dest); - - -/** - * Receives the node value. - * - * @param node the xml node to receive - * its text node - * - * @return An allocated string. You must free - * it using <B>SoapFreeStr</B> - * @see SoapFreeStr - */ -char* SoapXmlGetNodeValueAlloc(HSOAPXML node); - - -/** - * Returns the xml attribute - * - * @param node the xml node to receive its attribute - * @param ns namespace of the attribute - * @param key key of the attribute - * - * @return value of the attribute if any found, - * NULL otherwise. It's up to the caller to free - * the memory with SoapFreeStr(). - */ -char* SoapXmlGetAttr(HSOAPXML node, const char* ns, const char* key); - -#endif - diff --git a/libcsoap/soap-fault.c b/libcsoap/soap-fault.c index 30a972a..dfb769e 100644 --- a/libcsoap/soap-fault.c +++ b/libcsoap/soap-fault.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-fault.c,v 1.1 2004/01/30 16:39:34 snowdrop Exp $ + * $Id: soap-fault.c,v 1.2 2004/02/03 08:07:36 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -70,10 +70,12 @@ xmlDocPtr soap_fault_build(fault_code_t fcode, /* variables */ char *faultcode; - int bufferlen = 200; + int bufferlen = 2000; char *buffer; xmlDocPtr fault; /* result */ + log_verbose1("Build fault"); + switch (fcode) { case Fault_VersionMismatch: faultcode = fault_vm; @@ -96,6 +98,7 @@ xmlDocPtr soap_fault_build(fault_code_t fcode, if (faultactor) bufferlen += strlen(faultactor); if (detail) bufferlen += strlen(detail); + log_verbose2("Creating buffer with %d bytes", bufferlen); buffer = (char*)malloc(bufferlen); sprintf(buffer, _SOAP_FAULT_TEMPLATE_, @@ -115,6 +118,7 @@ xmlDocPtr soap_fault_build(fault_code_t fcode, "soap_fault_build()", NULL); } + log_verbose2("Returning fault (%p)", fault); return fault; } diff --git a/libcsoap/soap-xml.c b/libcsoap/soap-xml.c index 185672d..1fd23a1 100644 --- a/libcsoap/soap-xml.c +++ b/libcsoap/soap-xml.c @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-xml.c,v 1.1 2004/01/30 16:39:35 snowdrop Exp $ + * $Id: soap-xml.c,v 1.2 2004/02/03 08:07:36 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -27,7 +27,6 @@ xmlNodePtr soap_xml_get_children(xmlNodePtr param) { xmlNodePtr children; - const char* FUNC = "soap_xml_get_children"; if (param == NULL) { log_error1("Invalid parameter 'param' (null)"); @@ -44,6 +43,20 @@ xmlNodePtr soap_xml_get_children(xmlNodePtr param) return children; } +xmlNodePtr soap_xml_get_next(xmlNodePtr param) +{ + + xmlNodePtr node = param->next; + + while (node != NULL) { + if (node->type != XML_ELEMENT_NODE) + node = node->next; + else break; + } + + return node; +} + xmlXPathObjectPtr soap_xpath_eval(xmlDocPtr doc, const char *xpath) @@ -106,7 +119,7 @@ void soap_xml_doc_print(xmlDocPtr doc) buffer = xmlBufferCreate(); - xmlNodeDump(buffer, doc, root, 1 ,2); + xmlNodeDump(buffer, doc, root, 1 ,1); puts( (const char*)xmlBufferContent(buffer)); xmlBufferFree(buffer); diff --git a/libcsoap/soap-xml.h b/libcsoap/soap-xml.h index 4abdb8e..e4ce1ef 100644 --- a/libcsoap/soap-xml.h +++ b/libcsoap/soap-xml.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: soap-xml.h,v 1.1 2004/01/30 16:39:35 snowdrop Exp $ + * $Id: soap-xml.h,v 1.2 2004/02/03 08:07:36 snowdrop Exp $ * * CSOAP Project: A SOAP client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -32,6 +32,7 @@ typedef int (*soap_xmlnode_callback)(xmlNodePtr); xmlNodePtr soap_xml_get_children(xmlNodePtr param); +xmlNodePtr soap_xml_get_next(xmlNodePtr param); xmlXPathObjectPtr soap_xpath_eval(xmlDocPtr doc, const char *xpath); @@ -41,5 +42,6 @@ soap_xpath_foreach(xmlDocPtr doc, const char *xpath, soap_xmlnode_callback cb); +void soap_xml_doc_print(xmlDocPtr doc); #endif |