Index: trunk/Nebulous/nebclient/src/stdsoap2.h
===================================================================
--- trunk/Nebulous/nebclient/src/stdsoap2.h	(revision 3017)
+++ trunk/Nebulous/nebclient/src/stdsoap2.h	(revision 19542)
@@ -1,17 +1,16 @@
 /*
-
-stdsoap2.h 2.7.0d
-
-gSOAP runtime environment.
+	stdsoap2.h 2.7.11-upd
+
+	gSOAP runtime engine
 
 gSOAP XML Web services tools
-Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved.
-
+Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved.
+This part of the software is released under ONE of the following licenses:
+GPL, the gSOAP public license, OR Genivia's license for commercial use.
+--------------------------------------------------------------------------------
 Contributors:
 
-Wind River Systems, Inc., for the following additions (marked WR[...]) :
+Wind River Systems, Inc., for the following additions
   - vxWorks compatible
-  - Support for IPv6.
-
 --------------------------------------------------------------------------------
 gSOAP public license.
@@ -26,5 +25,5 @@
 
 The Initial Developer of the Original Code is Robert A. van Engelen.
-Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved.
+Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved.
 --------------------------------------------------------------------------------
 GPL license.
@@ -45,4 +44,9 @@
 Author contact information:
 engelen@genivia.com / engelen@acm.org
+
+This program is released under the GPL with the additional exemption that
+compiling, linking, and/or using OpenSSL is allowed.
+--------------------------------------------------------------------------------
+A commercial use license is available from Genivia, Inc., contact@genivia.com
 --------------------------------------------------------------------------------
 */
@@ -62,12 +66,4 @@
 #endif
 
-#ifndef SOAP_BEGIN_NAMESPACE
-# define SOAP_BEGIN_NAMESPACE(name)
-#endif
-
-#ifndef SOAP_END_NAMESPACE
-# define SOAP_END_NAMESPACE(name)
-#endif
-
 #ifndef SOAP_FMAC1	/* stdsoap2.h declaration macro */
 # define SOAP_FMAC1
@@ -82,8 +78,16 @@
 #endif
 
+#ifndef SOAP_FMAC3S	/* string converter for (de)serializer declaration macro */
+# define SOAP_FMAC3S SOAP_FMAC3
+#endif
+
 #ifndef SOAP_FMAC4	/* (de)serializer declaration macro */
 # define SOAP_FMAC4
 #endif
 
+#ifndef SOAP_FMAC4S	/* string converter for (de)serializer declaration macro */
+# define SOAP_FMAC4S SOAP_FMAC4
+#endif
+
 #ifndef SOAP_FMAC5	/* stub/skeleton declaration macro */
 # define SOAP_FMAC5
@@ -104,4 +108,9 @@
 #ifndef SOAP_SOURCE_STAMP
 # define SOAP_SOURCE_STAMP(str)
+#endif
+
+/* gSOAP 2.7.4 and higher: fast look-aside buffering is stable */
+#ifndef WITH_FAST
+# define WITH_FAST
 #endif
 
@@ -128,4 +137,10 @@
 # ifndef WIN32
 #  define WIN32
+# endif
+#endif
+
+#ifdef _WIN32_WCE
+# ifndef UNDER_CE
+#  define UNDER_CE _WIN32_WCE
 # endif
 #endif
@@ -157,30 +172,47 @@
 
 #if defined(__palmos__) || defined(PALM_GCC) || defined(__PALMOS_TRAPS__)
-# define PALM
-#endif
-
-#ifdef __hpux
-# define HP_UX
-#endif
-
-#ifdef __alpha
-# define TRU64 
+# ifndef PALM
+#  define PALM
+# endif
+#endif
+
+#if defined(__hpux)
+# ifndef HP_UX
+#  define HP_UX
+# endif
+#endif
+
+#if defined(__digital__) && defined(__unix__)
+# ifndef TRU64
+#  define TRU64 
+# endif
 #endif
 
 #ifdef __MVS__
-# define OS390
-#endif
-
-#ifdef _AIX
-# define __socklen_t_defined
+# ifndef OS390
+#  define OS390
+# endif
 #endif
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
+# if defined(WITH_OPENSSL)
+#  ifndef HAVE_OPENSSL_SSL_H
+#   undef WITH_OPENSSL
+#  endif
+# endif
+# if defined(WITH_ZLIB) || defined(WITH_GZIP)
+#  ifndef HAVE_ZLIB_H
+#   undef WITH_ZLIB
+#   undef WITH_GZIP
+#  endif
+# endif
 #else
 # if defined(UNDER_CE)
+#  define WITH_NOEMPTYSTRUCT
 #  define WITH_LEAN
 #  define HAVE_SSCANF
 # elif defined(WIN32)
+#  define WITH_NOEMPTYSTRUCT
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
@@ -192,4 +224,6 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
+#  define SOAP_LONG_FORMAT "%I64d"
+#  define SOAP_ULONG_FORMAT "%I64u"
 # elif defined(CYGWIN)
 #  define HAVE_STRRCHR
@@ -209,4 +243,7 @@
 #  define HAVE_STRTOD
 #  define HAVE_SSCANF
+#  define HAVE_STRTOD_L
+#  define HAVE_SSCANF_L
+#  define HAVE_SPRINTF_L
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
@@ -217,5 +254,5 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
-# elif defined(_AIXVERSION_431)
+# elif defined(_AIX43)
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
@@ -228,4 +265,13 @@
 #  define HAVE_GMTIME_R
 #  define HAVE_LOCALTIME_R
+#  define HAVE_WCTOMB
+#  define HAVE_MBTOWC
+# elif defined(_AIX41)
+#  define HAVE_STRRCHR
+#  define HAVE_STRTOD
+#  define HAVE_SSCANF
+#  define HAVE_STRTOL
+#  define HAVE_STRTOUL
+#  define HAVE_SYS_TIMEB_H
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
@@ -243,10 +289,15 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
-# elif defined(FREEBSD)
+# elif defined(FREEBSD) || defined(__FreeBSD__)
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
 #  define HAVE_SSCANF
+#  define HAVE_STRTOD_L
+#  define HAVE_SSCANF_L
+#  define HAVE_SPRINTF_L
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
+#  define HAVE_STRTOLL
+#  define HAVE_STRTOULL
 #  define HAVE_GETTIMEOFDAY
 #  define HAVE_RAND_R
@@ -255,4 +306,6 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
+#  define SOAP_LONG_FORMAT "%qd"
+#  define SOAP_ULONG_FORMAT "%qu"
 # elif defined(__VMS)
 #  define HAVE_STRRCHR
@@ -268,10 +321,15 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
-# elif defined(__GLIBC__)
+# elif defined(__GLIBC__) || defined(__GNU__)
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
 #  define HAVE_SSCANF
+#  define HAVE_STRTOD_L
+#  define HAVE_SSCANF_L
+#  define HAVE_SPRINTF_L
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
+#  define HAVE_STRTOLL
+#  define HAVE_STRTOULL
 #  define HAVE_SYS_TIMEB_H
 #  define HAVE_FTIME
@@ -297,8 +355,14 @@
 #  define HAVE_WCTOMB
 #  define HAVE_MBTOWC
+#  define SOAP_LONG_FORMAT "%ld"
+#  define SOAP_ULONG_FORMAT "%lu"
 # elif defined(MAC_CARBON)
+#  define WITH_NOIO
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
 #  define HAVE_SSCANF
+#  define HAVE_STRTOD_L
+#  define HAVE_SSCANF_L
+#  define HAVE_SPRINTF_L
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
@@ -319,5 +383,4 @@
 #  define O_NONBLOCK FNONBIO
 #  include <sys_socket.h>
-#  include <time.h>
 #  include "palmFunctions.h"
 # elif defined(SYMBIAN)
@@ -325,6 +388,10 @@
 #  define WITH_NONAMESPACES
 #  define HAVE_STRTOD	/* use STRTOD since sscanf doesn't seem to work */
+#  include <e32def.h>
 #  include <sys/ioctl.h>
 # elif defined(VXWORKS)
+#  ifdef _WRS_KERNEL
+#   define _POSIX_THREADS 1
+#  endif
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
@@ -332,7 +399,6 @@
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
-#  define HAVE_RAND_R
-#  define HAVE_PGMTIME_R
-#  define HAVE_PLOCALTIME_R
+#  define HAVE_GMTIME
+#  define HAVE_LOCALTIME
 #  define HAVE_MKTIME
 # elif defined(OS390)
@@ -348,5 +414,38 @@
 #  define HAVE_LOCALTIME_R
 #  define HAVE_WCTOMB
-#  define HAVE_MB
+#  define HAVE_MBTOWC
+# elif defined(AS400)
+#  define HAVE_STRRCHR
+#  define HAVE_STRTOD
+#  define HAVE_SSCANF
+#  define HAVE_STRTOL
+#  define HAVE_STRTOUL
+#  define HAVE_SYS_TIMEB_H
+#  define HAVE_FTIME
+#  define HAVE_RAND_R
+#  define HAVE_GMTIME_R
+#  define HAVE_LOCALTIME_R
+#  define HAVE_WCTOMB
+#  define HAVE_MBTOWC
+# elif defined(__QNX__) || defined(QNX)
+/* QNX does not have a working version of strtof */
+#  undef HAVE_STRTOF
+#  define HAVE_STRRCHR
+#  define HAVE_STRTOD
+#  define HAVE_SSCANF
+#  define HAVE_STRTOL
+#  define HAVE_STRTOUL
+#  define HAVE_SYS_TIMEB_H
+#  define HAVE_FTIME
+#  define HAVE_RAND_R
+#  define HAVE_GETHOSTBYNAME_R
+#  define HAVE_GMTIME_R
+#  define HAVE_LOCALTIME_R
+#  define HAVE_WCTOMB
+#  define HAVE_MBTOWC
+#  define LONG64 long
+#  define ULONG64 unsigned LONG64
+#  define SOAP_LONG_FORMAT "%ld"
+#  define SOAP_ULONG_FORMAT "%lu"
 # else
 /* Default asumptions on supported functions */
@@ -367,48 +466,44 @@
 #endif
 
-#if defined(TRU64)
-# define SOAP_LONG_FORMAT "%ld"
-# define SOAP_ULONG_FORMAT "%lu"
-#elif defined(WIN32)
-# define SOAP_LONG_FORMAT "%I64d"
-# define SOAP_ULONG_FORMAT "%I64u"
-#endif
-
-#ifndef SOAP_LONG_FORMAT
-# define SOAP_LONG_FORMAT "%lld"	/* printf format for 64 bit ints */
-#endif
-
-#ifndef SOAP_ULONG_FORMAT
-# define SOAP_ULONG_FORMAT "%llu"	/* printf format for unsigned 64 bit ints */
-#endif
-
-#ifndef SOAP_MALLOC			/* use libc malloc */
-# define SOAP_MALLOC(n) malloc(n)
-#endif
-
-#ifndef SOAP_FREE			/* use libc free */
-# define SOAP_FREE(p) free(p)
-#endif
-
-#include <stdlib.h>
-
-#ifndef PALM
-# include <stdio.h>
-# include <string.h>
-#endif
-
-#include <ctype.h>
-#include <limits.h>
+#ifdef WITH_C_LOCALE
+# include <xlocale.h>
+#else
+# undef HAVE_STRTOF_L
+# undef HAVE_STRTOD_L
+# undef HAVE_SSCANF_L
+# undef HAVE_SPRINTF_L
+#endif
+
+#ifndef WITH_NOSTDLIB
+# include <stdlib.h>
+# ifndef PALM
+#  include <stdio.h>
+#  include <string.h>
+# endif
+# include <ctype.h>
+# include <limits.h>
+#endif
 
 #if defined(__cplusplus) && !defined(WITH_LEAN)
 # include <string>
 # include <iostream>
-  using namespace std;
-#endif
+#endif
+
+#ifdef WITH_NOHTTP
+# ifndef WITH_NOIO
+#  define WITH_NOIO
+#  undef WITH_COOKIES
+# endif
+#endif
+
+/* Suggestion when SOAP_FD_EXCEEDED error occurs:
+   Some systems allow increasing FD_SETSIZE before including sys/types.h:
+#define FD_SETSIZE (2048)
+*/
 
 #ifndef UNDER_CE
 # ifndef PALM
-#  include <errno.h>
-#  ifndef MAC_CARBON
+#  ifndef WITH_NOIO
+#   include <errno.h>
 #   include <sys/types.h>
 #  endif
@@ -429,5 +524,5 @@
 #endif
 
-#ifndef MAC_CARBON
+#ifndef WITH_NOIO
 # ifndef WIN32
 #  ifndef PALM
@@ -435,6 +530,9 @@
 #   ifdef VXWORKS
 #    include <sockLib.h>
-#   endif
-#   ifndef VXWORKS
+#    include <selectLib.h>
+#    ifndef _WRS_KERNEL
+#     include <strings.h>
+#    endif
+#   else
 #    ifndef SYMBIAN
 #     include <strings.h>
@@ -446,5 +544,7 @@
 #   endif
 #   ifdef VXWORKS
-#    include <sys/times.h>
+#    ifdef _WRS_KERNEL
+#     include <sys/times.h>
+#    endif
 #   else
 #    include <sys/time.h>
@@ -461,58 +561,9 @@
 #endif
 
-#ifdef WITH_FASTCGI
-# include <fcgi_stdio.h>
-#endif
-
-#ifdef WITH_OPENSSL
-# define OPENSSL_NO_KRB5
-# include <openssl/ssl.h>
-# include <openssl/err.h>
-# include <openssl/rand.h>
-# ifndef ALLOW_OLD_VERSIONS
-#  if (OPENSSL_VERSION_NUMBER < 0x00905100L)
-#   error "Must use OpenSSL 0.9.6 or later"
-#  endif
-# endif
-#endif
-
-#ifdef WITH_GZIP
-# ifndef WITH_ZLIB
-#  define WITH_ZLIB
-# endif
-#endif
-
-#ifdef WITH_CASEINSENSITIVETAGS
-# define SOAP_STRCMP soap_tag_cmp	/* case insensitve XML element/attribute names */
+#ifdef WIN32
+# define SOAP_WINSOCKINT int
 #else
-# define SOAP_STRCMP strcmp		/* case sensitive XML element/attribute names */
-#endif
-
-#ifdef WITH_ZLIB
-# include <zlib.h>
-#endif
-
-#ifndef PALM
-# include <math.h>	/* for isnan() */
-#endif
-
-/* #define DEBUG */ /* Uncomment to debug sending (in file SENT.log) receiving (in file RECV.log) and messages (in file TEST.log) */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define soap_get0(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx])
-#define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++])
-#define soap_revget1(soap) ((soap)->bufidx--)
-#define soap_unget(soap, c) ((soap)->ahead = c)
-#define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL)
-#define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n))
-#define soap_set_imode(soap, n) ((soap)->mode = (soap)->imode |= (n))
-#define soap_clr_imode(soap, n) ((soap)->mode = (soap)->imode &= ~(n))
-#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n))
-#define soap_set_omode(soap, n) ((soap)->mode = (soap)->omode |= (n))
-#define soap_clr_omode(soap, n) ((soap)->mode = (soap)->omode &= ~(n))
-#define soap_destroy(soap) soap_delete((soap), NULL)
+# define SOAP_WINSOCKINT size_t
+#endif
 
 #ifdef WIN32
@@ -521,10 +572,12 @@
 #  include <fcntl.h>
 # endif
-# include <winsock.h>
-/* # include <winsock2.h> */ /* Alternative: use winsock2 (not available with eVC) */
-/* WR[ */
 # ifdef WITH_IPV6
+#  include <winsock2.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */
 #  include <ws2tcpip.h>
 #  include <wspiapi.h>
+#  define SOAP_GAI_STRERROR gai_strerrorA
+# else
+#  include <winsock.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */
+/* # include <winsock2.h> */ /* Alternative: use winsock2 (not available with eVC) */
 # endif
 #else
@@ -534,6 +587,5 @@
 #  include <ioLib.h>
 # endif
-/* ]WR */
-# ifndef MAC_CARBON
+# ifndef WITH_NOIO
 #  ifndef PALM
 #   include <netdb.h>
@@ -541,24 +593,124 @@
 #   include <unistd.h>
 #   include <fcntl.h>
+#   ifdef _AIX41
+#    include <sys/select.h>
+#   endif
 #  endif
 # endif
 #endif
 
-#ifdef WIN32
-# define SOAP_SOCKET SOCKET
+#ifdef WITH_FASTCGI
+# include <fcgi_stdio.h>
+#endif
+
+#ifdef WITH_OPENSSL
+# define OPENSSL_NO_KRB5
+# include <openssl/bio.h>
+# include <openssl/err.h>
+# include <openssl/rand.h>
+# include <openssl/ssl.h>
+# include <openssl/x509v3.h>
+# ifndef ALLOW_OLD_VERSIONS
+#  if (OPENSSL_VERSION_NUMBER < 0x00905100L)
+#   error "Must use OpenSSL 0.9.6 or later"
+#  endif
+# endif
+#endif
+
+#ifdef WITH_GZIP
+# ifndef WITH_ZLIB
+#  define WITH_ZLIB
+# endif
+#endif
+
+#ifdef WITH_CASEINSENSITIVETAGS
+# define SOAP_STRCMP soap_tag_cmp	/* case insensitve XML element/attribute names */
 #else
-# define SOAP_SOCKET int
-# define closesocket(n) close(n)
-#endif
-
-#define soap_valid_socket(n) ((n) >= 0)
-#define SOAP_INVALID_SOCKET (-1)
+# define SOAP_STRCMP strcmp		/* case sensitive XML element/attribute names */
+#endif
+
+#ifdef WITH_ZLIB
+# include <zlib.h>
+#endif
+
+#ifndef WITH_NOSTDLIB
+# ifndef PALM
+#  include <math.h>	/* for isnan() */
+# endif
+#endif
+
+/* #define DEBUG */ /* Uncomment to debug sending (in file SENT.log) receiving (in file RECV.log) and messages (in file TEST.log) */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Portability: define SOAP_SOCKLEN_T */
+#if defined(_AIX)
+# if defined(_AIX43)
+#  define SOAP_SOCKLEN_T socklen_t
+# else
+#  define SOAP_SOCKLEN_T int
+# endif
+#elif defined(SOCKLEN_T)
+# define SOAP_SOCKLEN_T SOCKLEN_T
+#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(__QNX__) || defined(QNX)
+# define SOAP_SOCKLEN_T socklen_t
+#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS)
+# define SOAP_SOCKLEN_T int
+#else
+# define SOAP_SOCKLEN_T size_t
+#endif
+
+#ifndef SOAP_SOCKET
+# ifdef WIN32
+#  define SOAP_SOCKET SOCKET
+#  define soap_closesocket(n) closesocket(n)
+# else
+#  define SOAP_SOCKET int
+#  define soap_closesocket(n) close(n)
+# endif
+#endif
+
+#define SOAP_INVALID_SOCKET ((SOAP_SOCKET)-1)
+#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET)
+
+#ifndef SOAP_GAI_STRERROR
+# define SOAP_GAI_STRERROR gai_strerror
+#endif
+
+#ifndef FD_SETSIZE
+# define FD_SETSIZE (1024)
+#endif
 
 #if defined(SYMBIAN)
 # define LONG64 long
 # define ULONG64 unsigned LONG64
-#elif !defined(WIN32)
-# define LONG64 long long
-# define ULONG64 unsigned LONG64
+#elif !defined(WIN32) || defined(CYGWIN) || defined(__GLIBC__) || defined(__GNU__)
+# ifndef LONG64
+#  if defined(HAVE_STDINT_H)
+#   include <stdint.h>
+#   define LONG64 int64_t
+#   define ULONG64 uint64_t
+#  elif defined(__GLIBC__)
+#   include <bits/wordsize.h>
+#   if (__WORDSIZE == 64)
+#    define LONG64 int64_t
+#    define ULONG64 uint64_t
+#    ifndef SOAP_LONG_FORMAT
+#     define SOAP_LONG_FORMAT "%ld"
+#    endif
+#    ifndef SOAP_ULONG_FORMAT
+#     define SOAP_ULONG_FORMAT "%lu"
+#    endif
+#   else
+#    define LONG64 long long
+#    define ULONG64 unsigned LONG64
+#   endif
+#  else
+#   define LONG64 long long
+#   define ULONG64 unsigned LONG64
+#  endif
+# endif
 #elif defined(UNDER_CE)
 # define LONG64 __int64
@@ -569,5 +721,13 @@
 #endif
 
-#if defined(WIN32)
+#ifndef SOAP_LONG_FORMAT
+# define SOAP_LONG_FORMAT "%lld"	/* printf format for 64 bit ints */
+#endif
+
+#ifndef SOAP_ULONG_FORMAT
+# define SOAP_ULONG_FORMAT "%llu"	/* printf format for unsigned 64 bit ints */
+#endif
+
+#if defined(WIN32) && !defined(CYGWIN)
 # define soap_int32 __int32
 #elif defined(SYMBIAN)
@@ -575,19 +735,26 @@
 #elif defined(PALM)
 # define soap_int32 Int32
+#elif defined(_AIX)
+# if defined(_AIX43)
+#  define soap_int32 int32_t
+# else
+#  define soap_int32 signed int
+# endif
 #else
 # define soap_int32 int32_t
 #endif
 
-/* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */
-typedef soap_int32 soap_wchar;
-
 #ifdef WIN32
+# define SOAP_ERANGE ERANGE
 # define SOAP_EINTR WSAEINTR
 # define SOAP_EAGAIN WSAEWOULDBLOCK
 # define SOAP_EWOULDBLOCK WSAEWOULDBLOCK
 # define SOAP_EINPROGRESS WSAEINPROGRESS
+# define SOAP_EADDRINUSE WSAEADDRINUSE
 #else
+# define SOAP_ERANGE ERANGE
 # define SOAP_EINTR EINTR
 # define SOAP_EAGAIN EAGAIN
+# define SOAP_EADDRINUSE EADDRINUSE
 # ifdef SYMBIAN
 #  define SOAP_EWOULDBLOCK 9898
@@ -602,57 +769,77 @@
 # ifdef UNDER_CE
 #  define soap_errno GetLastError()
-#  define soap_socket_errno GetLastError()
+#  define soap_socket_errno(s) GetLastError()
+#  define soap_reset_errno SetLastError(0)
 # else
 #  define soap_errno GetLastError()
-#  define soap_socket_errno WSAGetLastError()
+#  define soap_socket_errno(s) WSAGetLastError()
+#  define soap_reset_errno SetLastError(0)
 # endif
 #else
-# define soap_errno errno
-# define soap_socket_errno errno
+# ifndef WITH_NOIO
+#  define soap_errno errno
+#  define soap_socket_errno(s) errno
+#  define soap_reset_errno (errno = 0)
+# else
+#  define soap_errno 0
+#  define soap_socket_errno(s) 0
+#  define soap_reset_errno
+# endif
 #endif
 
 #ifndef SOAP_BUFLEN
 # ifndef WITH_LEAN
-#  define SOAP_BUFLEN  (32768) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */
+#  define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r and UDP messages, so don't make this too small */
 # else
-#  define SOAP_BUFLEN   (2048)
+#  define SOAP_BUFLEN  (2048)
 # endif
 #endif
 #ifndef SOAP_LABLEN
-# ifndef WITH_LEAN
-#  define SOAP_LABLEN  (256) /* initial look-aside buffer length */
-# else
-#  define SOAP_LABLEN   (64)
-# endif
+# define SOAP_LABLEN     (256) /* initial look-aside buffer length */
+#endif
+#ifndef SOAP_PTRBLK
+# define SOAP_PTRBLK     (32) /* block allocation for pointer hash table chains */
 #endif
 #ifndef SOAP_PTRHASH
 # ifndef WITH_LEAN
-#  define SOAP_PTRHASH  (1024) /* size of pointer analysis hash table (must be power of 2) */
+#  define SOAP_PTRHASH (1024) /* size of pointer analysis hash table (must be power of 2) */
 # else
-#  define SOAP_PTRHASH    (16)
+#  define SOAP_PTRHASH   (32)
 # endif
 #endif
 #ifndef SOAP_IDHASH
 # ifndef WITH_LEAN
-#  define SOAP_IDHASH   (1999) /* prime size of hash table for parsed id/ref */
+#  define SOAP_IDHASH  (1999) /* prime size of hash table for parsed id/ref */
 # else
-#  define SOAP_IDHASH    (199)
+#  define SOAP_IDHASH    (19) /* 19, 199 */
 # endif
 #endif
 #ifndef SOAP_BLKLEN
-# define SOAP_BLKLEN     (256) /* size of blocks to collect long strings and XML attributes */
+# ifndef WITH_LEAN
+#  define SOAP_BLKLEN   (256) /* size of blocks to collect long strings and XML attributes */
+# else
+#  define SOAP_BLKLEN    (32)
+# endif
 #endif
 #ifndef SOAP_TAGLEN
-# define SOAP_TAGLEN     (256) /* maximum length of XML element tag/attribute name + 1 */
+# ifndef WITH_LEAN
+#  define SOAP_TAGLEN  (1024) /* maximum length of XML element tag/attribute name or host/path name + 1 */
+# else
+#  define SOAP_TAGLEN    (64)
+# endif
 #endif
 #ifndef SOAP_HDRLEN
 # ifndef WITH_LEAN
-#  define SOAP_HDRLEN   (8192) /* maximum length of HTTP header line (must be >4096 to read cookies) */
+#  define SOAP_HDRLEN  (8192) /* maximum length of HTTP header line (must be >4096 to read cookies) */
 # else
-#  define SOAP_HDRLEN   (1024)
+#  define SOAP_HDRLEN  (1024)
 # endif
 #endif
 #ifndef SOAP_MAXDIMS
-# define SOAP_MAXDIMS	 (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */
+# ifndef WITH_LEAN
+#  define SOAP_MAXDIMS	 (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */
+# else
+#  define SOAP_MAXDIMS	  (4)
+# endif
 #endif
 
@@ -669,5 +856,5 @@
 
 #ifndef SOAP_MAXARRAYSIZE
-# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */
+# define SOAP_MAXARRAYSIZE (1000000) /* "trusted" max size of inbound SOAP array for compound array allocation */
 #endif
 
@@ -691,9 +878,73 @@
 
 #ifdef SUN_OS
-# define soap_isnan(n) isnan(n)
+# define HAVE_ISNAN
+#endif
+
+#ifdef __APPLE__
+# ifdef __cplusplus
+#  ifndef isnan
+extern "C" int isnan(double);
+#  endif
+# endif
+# define HAVE_ISNAN
 #endif
 
 #if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED))
 # define HAVE_ISNAN
+#endif
+
+extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan;
+
+#ifdef VXWORKS
+# ifndef FLT_MAX
+#  define FLT_MAX _ARCH_FLT_MAX
+# endif
+# ifndef DBL_MAX
+#  define DBL_MAX _ARCH_DBL_MAX
+# endif
+#endif
+
+#ifndef FLT_NAN
+#  define FLT_NAN (*(float*)(void*)&soap_double_nan)
+#endif
+
+#ifndef FLT_PINFTY
+# if defined(FLT_MAX)
+#  define FLT_PINFTY FLT_MAX
+# elif defined(HUGE_VALF)
+#  define FLT_PINFTY (float)HUGE_VALF
+# elif defined(HUGE_VAL)
+#  define FLT_PINFTY (float)HUGE_VAL
+# elif defined(FLOAT_MAX)
+#  define FLT_PINFTY FLOAT_MAX
+# else
+#  define FLT_PINFTY (3.40282347e+38F)
+# endif
+#endif
+
+#ifndef FLT_NINFTY
+# define FLT_NINFTY (-FLT_PINFTY)
+#endif
+
+#ifndef DBL_NAN
+#  define DBL_NAN (*(double*)(void*)&soap_double_nan)
+#endif
+
+#ifndef DBL_PINFTY
+# if defined(DBL_MAX)
+#  define DBL_PINFTY DBL_MAX
+# elif defined(HUGE_VALF)
+#  define DBL_PINFTY (double)HUGE_VALF
+# elif defined(HUGE_VAL)
+#  define DBL_PINFTY (double)HUGE_VAL
+# elif defined(DOUBLE_MAX)
+#  define DBL_PINFTY DOUBLE_MAX
+# else
+#  define DBL_PINFTY (1.7976931348623157e+308)
+# endif
+#endif
+
+#ifndef DBL_NINFTY
+# define DBL_NINFTY (-DBL_PINFTY)
 #endif
 
@@ -702,73 +953,6 @@
 #  define soap_isnan(n) isnan(n)
 # else
-#  define soap_isnan(_) (0)
-# endif
-#endif
-
-extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan;
-
-#ifdef VXWORKS
-# ifndef FLT_MAX
-#  define FLT_MAX _ARCH_FLT_MAX
-# endif
-# ifndef DBL_MAX
-#  define DBL_MAX _ARCH_DBL_MAX
-# endif
-#endif
-
-#ifndef FLT_NAN
-# ifdef HAVE_ISNAN
-#  define FLT_NAN (*(float*)&soap_double_nan)
-# else
-#  define FLT_NAN (0.0)
-# endif
-#endif
-
-#ifndef FLT_PINFTY
-# ifdef FLT_MAX
-#  define FLT_PINFTY FLT_MAX
-# else
-#  ifdef HUGE_VAL
-#    define FLT_PINFTY (float)HUGE_VAL
-#  else
-#   ifdef FLOAT_MAX
-#    define FLT_PINFTY FLOAT_MAX
-#   else
-#    define FLT_PINFTY (3.40282347e+38)
-#   endif
-#  endif
-# endif
-#endif
-
-#ifndef FLT_NINFTY
-# define FLT_NINFTY (-FLT_PINFTY)
-#endif
-
-#ifndef DBL_NAN
-# ifdef HAVE_ISNAN
-#  define DBL_NAN (*(double*)&soap_double_nan)
-# else
-#  define DBL_NAN (0.0)
-# endif
-#endif
-
-#ifndef DBL_PINFTY
-# ifdef DBL_MAX
-#  define DBL_PINFTY DBL_MAX
-# else
-#  ifdef HUGE_VAL
-#   define DBL_PINFTY (double)HUGE_VAL
-#  else
-#   ifdef DOUBLE_MAX
-#    define DBL_PINFTY DOUBLE_MAX
-#   else
-#    define DBL_PINFTY (1.7976931348623157e+308)
-#   endif
-#  endif
-# endif
-#endif
-
-#ifndef DBL_NINFTY
-# define DBL_NINFTY (-DBL_PINFTY)
+#  define soap_isnan(n) (0)
+# endif
 #endif
 
@@ -792,53 +976,64 @@
 #define SOAP_MUSTUNDERSTAND		8
 #define SOAP_NAMESPACE			9
-/* #define SOAP_OBJ_MISMATCH		10	obsolete */
-#define SOAP_TAG_END			10
+#define SOAP_USER_ERROR			10
 #define SOAP_FATAL_ERROR		11
 #define SOAP_FAULT			12
 #define SOAP_NO_METHOD			13
-#define SOAP_GET_METHOD			14
-#define SOAP_EOM			15
-#define SOAP_NULL			16
-#define SOAP_MULTI_ID			17
-#define SOAP_MISSING_ID			18
-#define SOAP_HREF			19
-#define SOAP_TCP_ERROR			20
-#define SOAP_HTTP_ERROR			21
-#define SOAP_SSL_ERROR			22
-#define SOAP_ZLIB_ERROR			23
-#define SOAP_DIME_ERROR			24
-#define SOAP_DIME_HREF			25
-#define SOAP_DIME_MISMATCH		26
-#define SOAP_DIME_END			27
-#define SOAP_MIME_ERROR			28
-#define SOAP_VERSIONMISMATCH		29
-#define SOAP_PLUGIN_ERROR		30
-#define SOAP_DATAENCODINGUNKNOWN	31
-#define SOAP_REQUIRED			32
-#define SOAP_PROHIBITED			33
-#define SOAP_OCCURS			34
-#define SOAP_LENGTH			35
-
-#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_MULTI_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF)
+#define SOAP_NO_DATA			14
+#define SOAP_GET_METHOD			15
+#define SOAP_PUT_METHOD			16
+#define SOAP_DEL_METHOD			17
+#define SOAP_HEAD_METHOD		18
+#define SOAP_HTTP_METHOD		19
+#define SOAP_EOM			20
+#define SOAP_MOE			21
+#define SOAP_HDR			22
+#define SOAP_NULL			23
+#define SOAP_DUPLICATE_ID		24
+#define SOAP_MISSING_ID			25
+#define SOAP_HREF			26
+#define SOAP_UDP_ERROR			27
+#define SOAP_TCP_ERROR			28
+#define SOAP_HTTP_ERROR			29
+#define SOAP_SSL_ERROR			30
+#define SOAP_ZLIB_ERROR			31
+#define SOAP_DIME_ERROR			32
+#define SOAP_DIME_HREF			33
+#define SOAP_DIME_MISMATCH		34
+#define SOAP_DIME_END			35
+#define SOAP_MIME_ERROR			36
+#define SOAP_MIME_HREF			37
+#define SOAP_MIME_END			38
+#define SOAP_VERSIONMISMATCH		39
+#define SOAP_PLUGIN_ERROR		40
+#define SOAP_DATAENCODINGUNKNOWN	41
+#define SOAP_REQUIRED			42
+#define SOAP_PROHIBITED			43
+#define SOAP_OCCURS			44
+#define SOAP_LENGTH			45
+#define SOAP_FD_EXCEEDED		46
+
+#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF)
 #define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD)
 #define soap_tcp_error_check(e) ((e) == SOAP_EOF || (e) == SOAP_TCP_ERROR)
 #define soap_ssl_error_check(e) ((e) == SOAP_SSL_ERROR)
 #define soap_zlib_error_check(e) ((e) == SOAP_ZLIB_ERROR)
-#define soap_mime_error_check(e) ((e) == SOAP_MIME_ERROR)
-#define soap_dime_error_check(e) ((e) == SOAP_DIME_ERROR || (e) == SOAP_DIME_MISMATCH)
-#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || (e) == SOAP_GET_METHOD || ((e) >= 100 && (e) < 600))
-
-/* gSOAP HTTP response status codes 100 to 600 are reserved */
-
-/* Special gSOAP HTTP response status codes */
+#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || ((e) >= SOAP_GET_METHOD && (e) <= SOAP_HTTP_METHOD)|| (e) == SOAP_NO_DATA || ((e) >= 100 && (e) < 600))
+
+/* gSOAP HTTP response status codes 100 to 599 are reserved */
+
+/* Codes 600 to 999 are user definable */
+
+/* Exceptional gSOAP HTTP response status codes >= 1000 */
 
 #define SOAP_STOP		1000	/* No HTTP response */
-#define SOAP_HTML		1001	/* Custom HTML response */
-#define SOAP_FILE		1002	/* Custom file-based response */
-
-/* gSOAP HTTP request status codes */
-
-#define SOAP_POST		1003
-#define SOAP_GET		1104
+#define SOAP_FORM		1001	/* Form request/response */
+#define SOAP_HTML		1002	/* Custom HTML response */
+#define SOAP_FILE		1003	/* Custom file-based response */
+
+/* gSOAP HTTP method codes */
+
+#define SOAP_POST		2000
+#define SOAP_GET		2001
 
 /* gSOAP DIME */
@@ -868,28 +1063,38 @@
 #define SOAP_IO_CHUNK		0x00000003	/* use HTTP chunked transfer AND buffer packets */
 
-#define SOAP_IO_LENGTH		0x00000004
-#define SOAP_IO_KEEPALIVE	0x00000008
-
-#define SOAP_ENC_LATIN		0x00800010	/* iso-8859-1 encoding */
-#define SOAP_ENC_XML		0x00000020	/* plain XML encoding, no HTTP header */
-#define SOAP_ENC_DIME		0x00000040
-#define SOAP_ENC_MIME		0x00000080
-#define SOAP_ENC_ZLIB		0x00000100
-#define SOAP_ENC_SSL		0x00000200
-
-#define SOAP_XML_STRICT		0x00001000	/* strict validation */
-#define SOAP_XML_CANONICAL	0x00002000	/* C14N canonical XML */
-#define SOAP_XML_TREE		0x00004000
-#define SOAP_XML_GRAPH		0x00008000
-#define SOAP_XML_NIL		0x00010000
-#define SOAP_XML_DOM		0x00020000
-#define SOAP_XML_SEC		0x00040000	/* reserved for WS security */
-
-#define SOAP_C_NOIOB		0x00100000
-#define SOAP_C_UTFSTRING	0x00200000
-#define SOAP_C_MBSTRING		0x00400000
+#define SOAP_IO_UDP		0x00000004	/* TCP or UDP */
+
+#define SOAP_IO_LENGTH		0x00000008	/* calc message length (internal) */
+#define SOAP_IO_KEEPALIVE	0x00000010	/* keep connection alive */
+
+#define SOAP_ENC_LATIN		0x00000020	/* accept iso-8859-1 encoding */
+#define SOAP_ENC_XML		0x00000040	/* plain XML encoding, no HTTP header */
+#define SOAP_ENC_DIME		0x00000080
+#define SOAP_ENC_MIME		0x00000100
+#define SOAP_ENC_MTOM		0x00000200
+#define SOAP_ENC_ZLIB		0x00000400
+#define SOAP_ENC_SSL		0x00000800
+
+#define SOAP_ENC		0x00000FFF	/* IO and ENC mask */
+
+#define SOAP_XML_STRICT		0x00001000	/* apply strict validation */
+#define SOAP_XML_INDENT		0x00002000	/* emit indented XML */
+#define SOAP_XML_CANONICAL	0x00004000	/* EXC C14N canonical XML */
+#define SOAP_XML_TREE		0x00008000	/* emit XML tree (no id/ref) */
+#define SOAP_XML_GRAPH		0x00010000
+#define SOAP_XML_NIL		0x00020000
+#define SOAP_XML_DOM		0x00040000
+#define SOAP_XML_SEC		0x00080000	/* reserved for WS security */
+
+#define SOAP_C_NOIOB		0x00100000	/* don't fault on array index out of bounds (just ignore) */
+#define SOAP_C_UTFSTRING	0x00200000	/* (de)serialize strings with UTF8 content */
+#define SOAP_C_MBSTRING		0x00400000	/* (de)serialize strings with multi-byte content */
+#define SOAP_C_NILSTRING	0x00800000	/* serialize empty strings as nil (omitted) */
 
 #define SOAP_DOM_TREE		0x01000000
 #define SOAP_DOM_NODE		0x02000000
+#define SOAP_DOM_ASIS		0x04000000
+
+#define SOAP_MIME_POSTCHECK	0x10000000	/* MIME flag (internal) */
 
 #define SOAP_IO_DEFAULT		SOAP_IO_FLUSH
@@ -900,8 +1105,22 @@
 #define SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION	0x01	/* client requires server to authenticate */
 #define SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION	0x02	/* server requires client to authenticate */
-
-#define SOAP_SSL_DEFAULT			SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION
-
-/* */
+#define SOAP_SSL_SKIP_HOST_CHECK		0x04	/* client does not check the common name of the host in certificate */
+#define SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE	0x08	/* client does not check the expiration date of the host certificate */
+#define SOAP_SSL_RSA				0x10	/* use RSA */
+#define SOAP_SSLv3				0x20	/* SSL v3 only */
+#define SOAP_TLSv1				0x40	/* TLS v1 only */
+#define SOAP_SSLv3_TLSv1			0x00	/* SSL v3 and TLS v1 support by default */
+
+#define SOAP_SSL_DEFAULT			(SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1)
+
+/* state */
+
+#define SOAP_NONE	0
+#define SOAP_INIT	1
+#define SOAP_COPY	2
+
+#define soap_check_state(soap) (!(soap) || ((soap)->state != SOAP_INIT && (soap)->state != SOAP_COPY))
+
+/* part */
 
 #define SOAP_BEGIN		0
@@ -909,8 +1128,12 @@
 #define SOAP_IN_HEADER		3
 #define SOAP_END_HEADER		4
-#define SOAP_IN_BODY		5
-#define SOAP_END_BODY		6
-#define SOAP_END_ENVELOPE	7
-#define SOAP_END		8
+#define SOAP_NO_BODY		5
+#define SOAP_IN_BODY		6
+#define SOAP_END_BODY		7
+#define SOAP_END_ENVELOPE	8
+#define SOAP_END		9
+#define SOAP_BEGIN_SECURITY	10
+#define SOAP_IN_SECURITY	11
+#define SOAP_END_SECURITY	12
 
 /* DEBUG macros */
@@ -921,5 +1144,25 @@
 #   define SOAP_DEBUG
 #  endif
-# endif
+#  ifndef SOAP_MEM_DEBUG
+#   define SOAP_MEM_DEBUG
+#  endif
+# endif
+#endif
+
+#ifdef SOAP_MEM_DEBUG
+# ifndef SOAP_MALLOC
+#  define SOAP_MALLOC(soap, size) soap_track_malloc(soap, __FILE__, __LINE__, size)
+# endif
+# ifndef SOAP_FREE
+#  define SOAP_FREE(soap, ptr) soap_track_free(soap, __FILE__, __LINE__, ptr)
+# endif
+#endif
+
+#ifndef SOAP_MALLOC			/* use libc malloc */
+# define SOAP_MALLOC(soap, size) malloc(size)
+#endif
+
+#ifndef SOAP_FREE			/* use libc free */
+# define SOAP_FREE(soap, ptr) free(ptr)
 #endif
 
@@ -932,5 +1175,5 @@
 { if (soap)\
   { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\
-      soap_open_logfile(soap, SOAP_INDEX_##DBGFILE);\
+      soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\
     if (soap->fdebug[SOAP_INDEX_##DBGFILE])\
     { FILE *fdebug = soap->fdebug[SOAP_INDEX_##DBGFILE];\
@@ -945,5 +1188,5 @@
 { if (soap)\
   { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\
-      soap_open_logfile(soap, SOAP_INDEX_##DBGFILE);\
+      soap_open_logfile((struct soap*)soap, SOAP_INDEX_##DBGFILE);\
     if (soap->fdebug[SOAP_INDEX_##DBGFILE])\
     { fwrite((MSG), 1, (LEN), soap->fdebug[SOAP_INDEX_##DBGFILE]);\
@@ -953,9 +1196,38 @@
 }
 # endif
+# ifndef DBGFUN
+#  define DBGFUN(FNAME) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s()\n", __FILE__, __LINE__, FNAME))
+#  define DBGFUN1(FNAME, FMT, ARG) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT")\n", __FILE__, __LINE__, FNAME, (ARG)))
+#  define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2)))
+#  define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): %s("FMT1", "FMT2", "FMT3")\n", __FILE__, __LINE__, FNAME, (ARG1), (ARG2), (ARG3)))
+# endif
+# ifndef DBGHEX
+#  define DBGHEX(DBGFILE, MSG, LEN) \
+{ if (soap)\
+  { if (!soap->fdebug[SOAP_INDEX_##DBGFILE])\
+      soap_open_logfile(soap, SOAP_INDEX_##DBGFILE);\
+    if (soap->fdebug[SOAP_INDEX_##DBGFILE])\
+    { int i; char *s;\
+      for (s = (char*)(MSG), i = (LEN); i; i--)\
+        fprintf(soap->fdebug[SOAP_INDEX_##DBGFILE], "%2.2X  ", (int)*s++&0xFF);\
+      fflush(soap->fdebug[SOAP_INDEX_##DBGFILE]);\
+    }\
+  }\
+}
+# endif
 #else
 # define DBGLOG(DBGFILE, CMD)
 # define DBGMSG(DBGFILE, MSG, LEN)
-#endif
-
+# define DBGFUN(FNAME)
+# define DBGFUN1(FNAME, FMT, ARG)
+# define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2)
+# define DBGFUN3(FNAME, FMT1, ARG1, FMT2, ARG2, FMT3, ARG3)
+# define DBGHEX(DBGFILE, MSG, LEN)
+#endif
+
+/* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */
+typedef soap_int32 soap_wchar;
+
+/* namespace table row */
 struct Namespace
 { const char *id;
@@ -965,7 +1237,8 @@
 };
 
+/* namespace stack */
 struct soap_nlist
 { struct soap_nlist *next;
-  unsigned int level;
+  unsigned int level; /* nesting depth level */
   short index; /* corresponding entry in ns mapping table */
   char *ns; /* only set when parsed ns URI is not in the ns mapping table */
@@ -973,4 +1246,5 @@
 };
 
+/* block stack for nested block allocations */
 struct soap_blist
 { struct soap_blist *next;
@@ -979,4 +1253,5 @@
 };
 
+/* array layout */
 struct soap_array
 { void *__ptr;
@@ -995,4 +1270,21 @@
 };
 
+/* block allocation for pointer serialization management */
+struct soap_pblk
+{ struct soap_pblk *next;
+  struct soap_plist plist[SOAP_PTRBLK];
+};
+
+#ifdef SOAP_MEM_DEBUG
+/* malloc/free tracking for debugging */
+struct soap_mlist
+{ struct soap_mlist *next;
+  const void *ptr;
+  const char *file;
+  int line;
+  short live;
+};
+#endif
+
 /* class allocation list */
 struct soap_clist
@@ -1001,7 +1293,8 @@
   int type;
   int size;
-  void (*fdelete)(struct soap_clist*);
-};
-
+  int (*fdelete)(struct soap_clist*);
+};
+
+/* attributes */
 struct soap_attribute
 { struct soap_attribute *next;
@@ -1013,4 +1306,5 @@
 };
 
+#ifndef WITH_LEAN
 struct soap_cookie
 { struct soap_cookie *next;
@@ -1019,14 +1313,17 @@
   char *domain;
   char *path;
-  long expire;		/* client-side: local time to expire; server-side: seconds to expire */
+  time_t expire;	/* client-side: local time to expire */
+  long maxage;		/* server-side: seconds to expire */
   unsigned int version;
   short secure;
   short session;	/* server-side */
-  short env;		/* server-side: got cookie from client */
-  short modified;	/* server-side: client cookie was modified */
-};
+  short env;		/* server-side: got cookie from client and should not be (re)send */
+  short modified;	/* server-side: client cookie was modified and should be send */
+};
+#endif
 
 #ifdef __cplusplus
 SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*);
+
 class soap_multipart_iterator
 { public:
@@ -1047,4 +1344,5 @@
 #endif
 
+#ifndef WITH_LEANER
 struct soap_dime
 { size_t count;
@@ -1066,9 +1364,11 @@
 #endif
 };
-
+#endif
+
+#ifndef WITH_LEANER
 struct soap_mime
 { char *boundary;			/* MIME boundary */
   const char *start;			/* MIME start ID */
-  struct soap_multipart *list;		/* list of DIME attachments received */
+  struct soap_multipart *list;		/* list of MIME attachments received */
   struct soap_multipart *first, *last;	/* temporary in/out queue */
 #ifdef __cplusplus
@@ -1079,5 +1379,7 @@
 #endif
 };
-
+#endif
+
+#ifndef WITH_LEANER
 /* RFC2045 MIME content transfer encodings */
 enum soap_mime_encoding
@@ -1091,5 +1393,7 @@
   SOAP_MIME_X_TOKEN
 };
-
+#endif
+
+#ifndef WITH_LEANER
 /* DIME/MIME multipart list */
 struct soap_multipart
@@ -1097,5 +1401,5 @@
   char *ptr;				/* points to raw data content */
   size_t size;				/* size of data content */
-  const char *id;			/* DIME/MIME content ID */
+  const char *id;			/* DIME/MIME content ID or form data name */
   const char *type;			/* DIME/MIME type (MIME type format) */
   const char *options;			/* DIME options */
@@ -1107,5 +1411,39 @@
 #endif
 };
-
+#endif
+
+#ifndef WITH_LEANER
+/* attachment DIME and MTOM XOP forwarding */
+struct soap_xlist
+{ struct soap_xlist *next;
+  unsigned char **ptr;
+  int *size;
+  char *id;
+  char **type;
+  char **options;
+};
+#endif
+
+/******************************************************************************/
+
+#ifndef WITH_LEANER
+#ifdef __cplusplus
+class soap_dom_attribute_iterator
+{ public:
+  struct soap_dom_attribute *att;
+  const char *nstr;
+  const char *name;
+  bool operator==(const soap_dom_attribute_iterator&) const;
+  bool operator!=(const soap_dom_attribute_iterator&) const;
+  struct soap_dom_attribute &operator*() const;
+  soap_dom_attribute_iterator &operator++();
+  soap_dom_attribute_iterator();
+  soap_dom_attribute_iterator(struct soap_dom_attribute*);
+  ~soap_dom_attribute_iterator();
+};
+#endif
+#endif
+
+#ifndef WITH_LEANER
 struct soap_dom_attribute
 { struct soap_dom_attribute *next;
@@ -1116,6 +1454,10 @@
   struct soap *soap;
 #ifdef __cplusplus
-  struct soap_dom_attribute &set(const char *nstr, const char *name);	// set namespace and name
-  struct soap_dom_attribute &set(const char *data);		// set data
+  typedef soap_dom_attribute_iterator iterator;
+  struct soap_dom_attribute &set(const char *nstr, const char *name);	/* set namespace and name */
+  struct soap_dom_attribute &set(const char *data);		/* set data */
+  soap_dom_attribute_iterator begin();
+  soap_dom_attribute_iterator end();
+  soap_dom_attribute_iterator find(const char *nstr, const char *name);
   void unlink();
   soap_dom_attribute();
@@ -1125,7 +1467,9 @@
 #endif
 };
-
+#endif
+
+#ifndef WITH_LEANER
 #ifdef __cplusplus
-class soap_dom_iterator
+class soap_dom_element_iterator
 { public:
   struct soap_dom_element *elt;
@@ -1133,19 +1477,21 @@
   const char *name;
   int type;
-  bool operator==(const soap_dom_iterator&) const;
-  bool operator!=(const soap_dom_iterator&) const;
+  bool operator==(const soap_dom_element_iterator&) const;
+  bool operator!=(const soap_dom_element_iterator&) const;
   struct soap_dom_element &operator*() const;
-  soap_dom_iterator &operator++();
-  soap_dom_iterator();
-  soap_dom_iterator(struct soap_dom_element*);
-  ~soap_dom_iterator();
-};
-#endif
-
+  soap_dom_element_iterator &operator++();
+  soap_dom_element_iterator();
+  soap_dom_element_iterator(struct soap_dom_element*);
+  ~soap_dom_element_iterator();
+};
+#endif
+#endif
+
+#ifndef WITH_LEANER
 struct soap_dom_element
 { struct soap_dom_element *next;	/* next sibling */
   struct soap_dom_element *prnt;	/* parent */
-  struct soap_dom_element *elts;	/* first child element */
-  struct soap_dom_attribute *atts;	/* first child attribute */
+  struct soap_dom_element *elts;	/* list of child elements */
+  struct soap_dom_attribute *atts;	/* list of attributes */
   const char *nstr;			/* namespace string */
   char *name;				/* element tag name */
@@ -1154,7 +1500,9 @@
   int type;				/* optional: serialized C/C++ data type */
   void *node;				/* optional: pointer to serialized C/C++ data */
-  struct soap *soap;
+  char *head;				/* leading whitespace to start tag */
+  char *tail;				/* leading whitespace to end tag */
+  struct soap *soap;			/* soap context that manages this node */
 #ifdef __cplusplus
-  typedef soap_dom_iterator iterator;
+  typedef soap_dom_element_iterator iterator;
   struct soap_dom_element &set(const char *nstr, const char *name);
   struct soap_dom_element &set(const char *data);
@@ -1164,8 +1512,8 @@
   struct soap_dom_element &add(struct soap_dom_attribute*);
   struct soap_dom_element &add(struct soap_dom_attribute&);
-  soap_dom_iterator begin();
-  soap_dom_iterator end();
-  soap_dom_iterator find(const char *nstr, const char *name);
-  soap_dom_iterator find(int type);
+  soap_dom_element_iterator begin();
+  soap_dom_element_iterator end();
+  soap_dom_element_iterator find(const char *nstr, const char *name);
+  soap_dom_element_iterator find(int type);
   void unlink();
   soap_dom_element();
@@ -1177,25 +1525,41 @@
 #endif
 };
+SOAP_FMAC1 struct soap_dom_element * SOAP_FMAC2 soap_dom_next_element(struct soap_dom_element *elt);
+SOAP_FMAC1 struct soap_dom_attribute * SOAP_FMAC2 soap_dom_next_attribute(struct soap_dom_attribute *att);
+#endif
 
 #if defined(__cplusplus) && !defined(WITH_LEAN)
 }
-extern ostream &operator<<(ostream&, const struct soap_dom_element&);
-extern istream &operator>>(istream&, struct soap_dom_element&);
+extern std::ostream &operator<<(std::ostream&, const struct soap_dom_element&);
+extern std::istream &operator>>(std::istream&, struct soap_dom_element&);
 extern "C" {
 #endif
 
-struct soap
-{ short version;		/* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */
-  short copy;			/* 1 = copy of another soap struct */
+/******************************************************************************/
+
+#ifdef WIN32
+# ifdef SOAP_STD_EXPORTS
+#  define SOAP_STD_API __declspec(dllexport)
+# else
+#  define SOAP_STD_API
+# endif
+#else
+# define SOAP_STD_API
+#endif
+
+struct SOAP_STD_API soap
+{ short state;			/* 0 = uninitialized, 1 = initialized, 2 = copy of another soap struct */
+  short version;		/* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */
   soap_mode mode;
   soap_mode imode;
   soap_mode omode;
-  const char *float_format;	/* points to user-definable format string for floats (<1024 chars) */
-  const char *double_format;	/* points to user-definable format string for doubles (<1024 chars) */
-  const char *dime_id_format;	/* points to user-definable format string for integer DIME id (<SOAP_TAGLEN chars) */
-  const char *http_version;	/* default = "1.0" */
+  const char *float_format;	/* user-definable format string for floats (<1024 chars) */
+  const char *double_format;	/* user-definable format string for doubles (<1024 chars) */
+  const char *dime_id_format;	/* user-definable format string for integer DIME id (<SOAP_TAGLEN chars) */
+  const char *http_version;	/* HTTP version used "1.0" or "1.1" */
   const char *http_content;	/* optional custom response content type (with SOAP_FILE) */
   const char *encodingStyle;	/* default = NULL which means that SOAP encoding is used */
-  const char *actor;
+  const char *actor;		/* SOAP-ENV:actor or role attribute value */
+  const char *lang;		/* xml:lang attribute value of SOAP-ENV:Text */
   int recv_timeout;		/* when > 0, gives socket recv timeout in seconds, < 0 in usec */
   int send_timeout;		/* when > 0, gives socket send timeout in seconds, < 0 in usec */
@@ -1206,4 +1570,5 @@
   int bind_flags;		/* bind() SOL_SOCKET sockopt flags, e.g. set to SO_REUSEADDR to enable reuse */
   int accept_flags;		/* accept() SOL_SOCKET sockopt flags */
+  unsigned short linger_time;	/* linger time for SO_LINGER option */
   const struct Namespace *namespaces;	/* Pointer to global namespace mapping table */
   struct Namespace *local_namespaces;	/* Local namespace mapping table */
@@ -1211,9 +1576,12 @@
   struct soap_blist *blist;	/* block allocation stack */
   struct soap_clist *clist;	/* class instance allocation list */
-  void *alist;			/* memory allocation list */
+  void *alist;			/* memory allocation (malloc) list */
   struct soap_ilist *iht[SOAP_IDHASH];
   struct soap_plist *pht[SOAP_PTRHASH];
+  struct soap_pblk *pblk;	/* plist block allocation */
+  short pidx;			/* plist block allocation */
   struct SOAP_ENV__Header *header;
   struct SOAP_ENV__Fault *fault;
+  int idnum;
   void *user;			/* to pass user-defined data */
   struct soap_plugin *plugins;	/* linked list of plug-in data */
@@ -1222,8 +1590,13 @@
   int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t);
   int (*fget)(struct soap*);
+  int (*fput)(struct soap*);
+  int (*fdel)(struct soap*);
+  int (*fhead)(struct soap*);
+  int (*fform)(struct soap*);
   int (*fposthdr)(struct soap*, const char*, const char*);
   int (*fresponse)(struct soap*, int, size_t);
   int (*fparse)(struct soap*);
   int (*fparsehdr)(struct soap*, const char*, const char*);
+  int (*fheader)(struct soap*);
   int (*fresolve)(struct soap*, const char*, struct in_addr* inaddr);
   int (*fconnect)(struct soap*, const char*, const char*, int);
@@ -1231,16 +1604,20 @@
   int (*fclosesocket)(struct soap*, SOAP_SOCKET);
   int (*fshutdownsocket)(struct soap*, SOAP_SOCKET, int);
-  int (*fopen)(struct soap*, const char*, const char*, int);
-  int (*faccept)(struct soap*, int, struct sockaddr*, int *n);
+  SOAP_SOCKET (*fopen)(struct soap*, const char*, const char*, int);
+  SOAP_SOCKET (*faccept)(struct soap*, SOAP_SOCKET, struct sockaddr*, int *n);
   int (*fclose)(struct soap*);
   int (*fsend)(struct soap*, const char*, size_t);
   size_t (*frecv)(struct soap*, char*, size_t);
   int (*fpoll)(struct soap*);
+  void (*fseterror)(struct soap*, const char **c, const char **s);
+  int (*fignore)(struct soap*, const char*);
+  int (*fserveloop)(struct soap*);
+  void *(*fplugin)(struct soap*, const char*);
+  void *(*fmalloc)(struct soap*, size_t);
+#ifndef WITH_LEANER
   int (*fprepareinit)(struct soap*);
   int (*fpreparesend)(struct soap*, const char*, size_t);
   int (*fpreparerecv)(struct soap*, const char*, size_t);
-  int (*fignore)(struct soap*, const char*);
-  int (*fserveloop)(struct soap*);
-  void *(*fplugin)(struct soap*, const char*);
+  int (*fpreparefinal)(struct soap*);
   void *(*fdimereadopen)(struct soap*, void*, const char*, const char*, const char*);
   void *(*fdimewriteopen)(struct soap*, const char*, const char*, const char*);
@@ -1249,12 +1626,19 @@
   size_t (*fdimeread)(struct soap*, void*, char*, size_t);
   int (*fdimewrite)(struct soap*, void*, const char*, size_t);
-  int master;
-  int socket;
+  void *(*fmimereadopen)(struct soap*, void*, const char*, const char*, const char*);
+  void *(*fmimewriteopen)(struct soap*, void*, const char*, const char*, const char*, enum soap_mime_encoding);
+  void (*fmimereadclose)(struct soap*, void*);
+  void (*fmimewriteclose)(struct soap*, void*);
+  size_t (*fmimeread)(struct soap*, void*, char*, size_t);
+  int (*fmimewrite)(struct soap*, void*, const char*, size_t);
+#endif
+  SOAP_SOCKET master;
+  SOAP_SOCKET socket;
 #if defined(__cplusplus) && !defined(WITH_LEAN)
-  ostream *os;
-  istream *is;
+  std::ostream *os;
+  std::istream *is;
 #else
-  void *os;	/* preserve alignment */
-  void *is;	/* preserve alignment */
+  void *os;		/* preserve struct size */
+  void *is;		/* preserve struct size */
 #endif
 #ifndef UNDER_CE
@@ -1264,13 +1648,11 @@
   FILE *sendfd;
   FILE *recvfd;
-  char errorstr[256];
-  wchar_t werrorstr[256];
-#endif
-  size_t bufidx;
-  size_t buflen;
-  soap_wchar ahead;
-  short cdata;
-  short body;
-  unsigned int level;
+#endif
+  size_t bufidx;	/* index in soap.buf[] */
+  size_t buflen;	/* length of soap.buf[] content */
+  soap_wchar ahead;	/* parser lookahead */
+  short cdata;		/* CDATA parser state */
+  short body;		/* parsed XML element has a body or not */
+  unsigned int level;	/* XML nesting level */
   size_t count;		/* message length counter */
   size_t length;	/* message length as set by HTTP header */
@@ -1279,6 +1661,6 @@
   size_t labidx;	/* look-aside buffer index to available part */
   char buf[SOAP_BUFLEN];/* send and receive buffer */
-  char tmpbuf[1024];	/* output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */
-  char msgbuf[1024];	/* output buffer for (error) messages <=1024 bytes */
+  char msgbuf[1024];	/* in/out buffer for HTTP/MIME headers >=1024 bytes */
+  char tmpbuf[1024];	/* in/out buffer for HTTP/MIME headers, simpleType values, element and attribute tag names, and DIME must be >=1024 bytes */
   char tag[SOAP_TAGLEN];
   char id[SOAP_TAGLEN];
@@ -1289,16 +1671,15 @@
   char arrayOffset[SOAP_TAGLEN];
   short other;
-  short root;
   short position;
   int positions[SOAP_MAXDIMS];
+  short root;
   struct soap_attribute *attributes;	/* attribute list */
-  short encoding;
-  short mustUnderstand;
-  short null;
-  short ns;
-  short part;
+  short encoding;	/* when set, output encodingStyle */
+  short mustUnderstand;	/* a mustUnderstand element was parsed or is output */
+  short null;		/* parsed XML is xsi:nil */
+  short ns;		/* when not set, output full xmlns bindings */
+  short part;		/* parsing state */
   short alloced;
   short peeked;
-  short keep_alive;
   size_t chunksize;
   size_t chunkbuflen;
@@ -1309,24 +1690,36 @@
   char *authrealm;		/* HTTP authentication realm */
   char *prolog;			/* XML declaration prolog */
-  int port;
-  unsigned int max_keep_alive;
+  unsigned long ip;		/* IP number */
+  int port;			/* port number */
+  short keep_alive;		/* connection should be kept open */
+  short tcp_keep_alive;		/* enable SO_KEEPALIVE */
+  unsigned int tcp_keep_idle; 	/* set TCP_KEEPIDLE */
+  unsigned int tcp_keep_intvl; 	/* set TCP_KEEPINTVL */
+  unsigned int tcp_keep_cnt; 	/* set TCP_KEEPCNT */
+  unsigned int max_keep_alive;  /* maximum keep-alive session (default=100) */
+  const char *proxy_http_version;/* HTTP version of proxy "1.0" or "1.1" */
   const char *proxy_host;	/* Proxy Server host name */
   int proxy_port;		/* Proxy Server port (default = 8080) */
   const char *proxy_userid;	/* Proxy Authorization user name */
   const char *proxy_passwd;	/* Proxy Authorization password */
+  const char *proxy_from;	/* X-Forwarding-For header returned by proxy */
   int status;			/* -1 when request, else error code to be returned by server */
   int error;
   int errmode;
   int errnum;
-  unsigned long idnum;
-  unsigned long ip;
+#ifndef WITH_LEANER
+  struct soap_dom_element *dom;
   struct soap_dime dime;
   struct soap_mime mime;
-  struct soap_dom_element *dom;
+  struct soap_xlist *xlist;
+#endif
 #if !defined(WITH_LEAN) || defined(SOAP_DEBUG)
   const char *logfile[SOAP_MAXLOGS];
   FILE *fdebug[SOAP_MAXLOGS];
+  struct soap_mlist *mht[SOAP_PTRHASH];
 #endif
 #ifndef WITH_LEAN
+  const char *c14ninclude;
+  const char *c14nexclude;
   struct soap_cookie *cookies;
   const char *cookie_domain;
@@ -1334,4 +1727,15 @@
   int cookie_max;
 #endif
+#ifndef WITH_NOIO
+  int ipv6_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */
+  char* ipv4_multicast_if; /* always include this to keep the soap struct size the same in v4 and v6 */
+  int ipv4_multicast_ttl; /* multicast scope */
+#ifdef WITH_IPV6
+  struct sockaddr_storage peer;	/* IPv6: set by soap_accept and by UDP recv */
+#else
+  struct sockaddr_in peer;	/* IPv4: set by soap_connect/soap_accept and by UDP recv */
+#endif
+#endif
+  size_t peerlen;
 #ifdef WITH_OPENSSL
   int (*fsslauth)(struct soap*);
@@ -1340,7 +1744,14 @@
   SSL *ssl;
   SSL_CTX *ctx;
-  short require_server_auth;
-  short require_client_auth;
-  short rsa;			/* when set, use RSA instead of DH */
+  SSL_SESSION *session;
+#else
+  void *fsslauth;		/* dummy members, to preserve struct size */
+  void *fsslverify;
+  void *bio;
+  void *ssl;
+  void *ctx;
+  void *session;
+#endif
+  unsigned short ssl_flags;
   const char *keyfile;
   const char *password;
@@ -1348,26 +1759,40 @@
   const char *cafile;
   const char *capath;
+  const char *crlfile;
   const char *randfile;
-  SSL_SESSION *session;
   char session_host[SOAP_TAGLEN];
   int session_port;
+#ifdef WITH_C_LOCALE
+  locale_t c_locale;		/* set to C locale by default */
+#else
+  void *c_locale;
 #endif
 #ifdef WITH_ZLIB
+  z_stream *d_stream;		/* decompression stream */
+  uLong z_crc;			/* internal gzip crc */
+#else
+  void *d_stream;		/* dummy members, to preserve struct size */
+  soap_int32 z_crc;
+#endif
   short zlib_state;		/* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_INFLATE */
   short zlib_in;		/* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */
   short zlib_out;		/* SOAP_ZLIB_NONE, SOAP_ZLIB_DEFLATE, or SOAP_ZLIB_GZIP */
-  z_stream d_stream;		/* decompression stream */
-  char z_buf[SOAP_BUFLEN];	/* buffer */
+  char *z_buf;			/* buffer */
   size_t z_buflen;
   unsigned short z_level;	/* compression level to be used (0=none, 1=fast to 9=best) */
-  uLong z_crc;			/* internal gzip crc */
   float z_ratio_in;		/* detected compression ratio compressed_length/length of inbound message */
   float z_ratio_out;		/* detected compression ratio compressed_length/length of outbound message */
-#endif
-/* WR[ */
 #ifdef WMW_RPM_IO
   void *rpmreqid;
-#endif /* WMW_RPM_IO */
-/* ]WR */
+#endif
+#ifdef __cplusplus
+  soap();
+  soap(soap_mode);
+  soap(soap_mode, soap_mode);
+  soap(struct soap&);
+  virtual ~soap();
+#else
+  void (*dummy)();
+#endif
 };
 
@@ -1383,5 +1808,6 @@
   void *ptr;
   unsigned int level;
-  void (*fcopy)(struct soap*, int, int, void*, const void*, size_t);
+  size_t len;
+  void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t);
 };
 
@@ -1411,4 +1837,25 @@
 #endif
 
+#ifndef WITH_LEAN
+# define soap_get0(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx])
+# define soap_get1(soap) (((soap)->bufidx>=(soap)->buflen && soap_recv(soap)) ? EOF : (unsigned char)(soap)->buf[(soap)->bufidx++])
+#else
+soap_wchar soap_get0(struct soap*);
+soap_wchar soap_get1(struct soap*);
+#endif
+
+#define soap_revget1(soap) ((soap)->bufidx--)
+#define soap_unget(soap, c) ((soap)->ahead = c)
+#define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL)
+#define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n))
+#define soap_set_imode(soap, n) ((soap)->imode |= (n))
+#define soap_clr_imode(soap, n) ((soap)->imode &= ~(n))
+#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n))
+#define soap_set_omode(soap, n) ((soap)->omode |= (n))
+#define soap_clr_omode(soap, n) ((soap)->omode &= ~(n))
+#define soap_set_mode(soap, n) ((soap)->imode |= (n), (soap)->omode |= (n))
+#define soap_clr_mode(soap, n) ((soap)->imode &= ~(n), (soap)->omode &= ~(n))
+#define soap_destroy(soap) soap_delete((soap), NULL)
+
 #ifdef HAVE_STRRCHR
 # define soap_strrchr(s, t) strrchr(s, t)
@@ -1429,6 +1876,35 @@
 #endif
 
+#if defined(WITH_OPENSSL)
+# define soap_random soap_rand()
+SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void);
+#elif defined(HAVE_RANDOM)
+# define soap_random (int)random()
+#else
+# define soap_random rand()
+#endif
+
+#ifdef WITH_NOIDREF
+# define soap_embedded(s, p, t) (0)
+# define soap_id_lookup(s, i, p, t, n, k) (p)
+# define soap_id_forward(s, h, p, len, st, tt, n, k, fc) (p)
+# define soap_reference(s, a, t) (1)
+# define soap_array_reference(s, p, a, n, t) (1)
+# define soap_embed(s, p, a, n, t, pp) (0)
+# define soap_embedded_id(s, i, p, t) (i)
+# define soap_is_embedded(s, p) (0)
+# define soap_is_single(s, p) (1)
+# define soap_lookup_type(s, i) (0)
+# define soap_getindependent(s) (0)
+# define soap_putindependent(s) (0)
+# define soap_getelement(s, n) (n)
+# define soap_putelement(s, p, t, i, n) (0)
+# define soap_markelement(s, p, n) (0)
+#endif
+
+SOAP_FMAC1 void SOAP_FMAC2 soap_header(struct soap*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_fault(struct soap*);
 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultcode(struct soap*);
+SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultsubcode(struct soap*);
 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultstring(struct soap*);
 SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultdetail(struct soap*);
@@ -1440,10 +1916,12 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_getfault(struct soap*);
 
+SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init();
 SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap*, int, const char*, const char*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_connect(struct soap*, const char*, const char*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int);
-SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*);
+SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int);
+SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_accept(struct soap*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*);
+SOAP_FMAC1 const char * SOAP_FMAC2 soap_ssl_error(struct soap*, int);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_server_context(struct soap*, unsigned short, const char*, const char*, const char*, const char*, const char*, const char*, const char*);
@@ -1465,5 +1943,7 @@
 SOAP_FMAC1 void SOAP_FMAC2 soap_set_fault(struct soap*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault(struct soap*, const char*, const char*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault_subcode(struct soap*, const char*, const char*, const char*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault(struct soap*, const char*, const char*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault_subcode(struct soap*, const char*, const char*, const char*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_set_sender_error(struct soap*, const char*, const char*, int);
 SOAP_FMAC1 int SOAP_FMAC2 soap_set_receiver_error(struct soap*, const char*, const char*, int);
@@ -1484,20 +1964,18 @@
 SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_gethex(struct soap*, int*);
 
-
-SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_lookup(struct soap*, const char*);
-SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_enter(struct soap*, const char*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*);
-
+#ifndef WITH_LEANER
+SOAP_FMAC1 int SOAP_FMAC2 soap_xop_forward(struct soap*, unsigned char**, int*, char**, char**, char**);
+SOAP_FMAC1 int SOAP_FMAC2 soap_dime_forward(struct soap*, unsigned char**, int*, char**, char**, char**);
+#endif
+
+#ifndef WITH_NOIDREF
 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup_id(struct soap*, void *p, int t, struct soap_plist**);
 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup(struct soap*, const void *p, int t, struct soap_plist**);
 SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_enter(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**);
 SOAP_FMAC1 int SOAP_FMAC2 soap_array_pointer_lookup(struct soap*, const void *p, const struct soap_array *a, int n, int t, struct soap_plist**);
-
 SOAP_FMAC1 int SOAP_FMAC2 soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type);
-
-SOAP_FMAC1 void SOAP_FMAC2 soap_begin_count(struct soap*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*);
-
+SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_lookup(struct soap*, const char*);
+SOAP_FMAC1 struct soap_ilist* SOAP_FMAC2 soap_enter(struct soap*, const char*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_embedded(struct soap*, const void *p, int t);
 SOAP_FMAC1 int SOAP_FMAC2 soap_reference(struct soap*, const void *p, int t);
@@ -1507,8 +1985,16 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_is_single(struct soap*, struct soap_plist*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_set_embedded(struct soap*, struct soap_plist*);
-
-SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char *str);
-SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other);
-SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code);
+#endif
+
+SOAP_FMAC1 int SOAP_FMAC2 soap_begin_count(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_end_count(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*);
+
+SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char*);
+SOAP_FMAC1 long SOAP_FMAC2 soap_code_int(const struct soap_code_map*, const char*, long);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_str(const struct soap_code_map*, long);
+SOAP_FMAC1 long SOAP_FMAC2 soap_code_bits(const struct soap_code_map*, const char*);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_list(struct soap*, const struct soap_code_map*, long);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_getline(struct soap*, char*, int);
@@ -1518,14 +2004,19 @@
 SOAP_FMAC1 void* SOAP_FMAC2 soap_malloc(struct soap*, size_t);
 SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap*, void*);
-SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, void (*fdelete)(struct soap_clist*));
+SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, int (*fdelete)(struct soap_clist*));
 SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*);
-
+SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap*);
+SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap*);
+
+SOAP_FMAC1 void* SOAP_FMAC2 soap_track_malloc(struct soap*, const char*, int, size_t);
+SOAP_FMAC1 void SOAP_FMAC2 soap_track_free(struct soap*, const char*, int, void*);
+
+#ifndef WITH_NOIDREF
 SOAP_FMAC1 int SOAP_FMAC2 soap_lookup_type(struct soap*, const char *id);
-
 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_lookup(struct soap*, const char *id, void **p, int t, size_t n, unsigned int k);
-SOAP_FMAC1 void* SOAP_FMAC2 soap_id_forward(struct soap*, const char *id, void *p, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, const void*, size_t));
+SOAP_FMAC1 void* SOAP_FMAC2 soap_id_forward(struct soap*, const char *id, void *p, size_t len, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t));
+#endif
 SOAP_FMAC1 void* SOAP_FMAC2 soap_id_enter(struct soap*, const char *id, void *p, int t, size_t n, unsigned int k, const char *type, const char *arrayType, void *(*finstantiate)(struct soap*, int, const char*, const char*, size_t*));
-SOAP_FMAC1 void SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, const void *q, size_t n);
+SOAP_FMAC1 void SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t, const void *q, size_t n);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_size(const int *, int);
@@ -1544,11 +2035,13 @@
 
 SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new(void);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(int);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(int, int);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(struct soap*);
-SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*,struct soap*);
+SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(soap_mode);
+SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(soap_mode, soap_mode);
+SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*);
+SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap*);
+SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, const struct soap*);
+SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap*, struct soap*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*);
-SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, int);
-SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, int, int);
+SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, soap_mode);
+SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, soap_mode, soap_mode);
 SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap*);
@@ -1566,7 +2059,4 @@
 
 SOAP_FMAC1 const char* SOAP_FMAC2 soap_value(struct soap*);
-
-SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_advance(struct soap*);
-SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_skip(struct soap*);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_match_tag(struct soap*, const char*, const char *);
@@ -1581,4 +2071,5 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_element_id(struct soap*, const char *tag, int id, const void *p, const struct soap_array *a, int d, const char *type, int n);
 SOAP_FMAC1 int SOAP_FMAC2 soap_element_result(struct soap*, const char *tag);
+SOAP_FMAC1 void SOAP_FMAC2 soap_check_result(struct soap*, const char *tag);
 SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_out(struct soap*, const char *tag);
 SOAP_FMAC1 int SOAP_FMAC2 soap_element_start_end_out(struct soap*, const char *tag);
@@ -1586,5 +2077,5 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_attribute(struct soap*, const char*, const char*);
 
-SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap*, const char *tag, int nillable);
+SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap*, const char *tag, int nillable, const char *type);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_in(struct soap*, const char *tag);
@@ -1596,26 +2087,38 @@
 
 SOAP_FMAC1 char* SOAP_FMAC2 soap_strdup(struct soap*, const char*);
+SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstrdup(struct soap*, const wchar_t*);
+SOAP_FMAC1 const char * SOAP_FMAC2 soap_strsearch(const char *big, const char *little);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_string_out(struct soap*, const char *s, int flag);
 SOAP_FMAC1 char* SOAP_FMAC2 soap_string_in(struct soap*, int, long, long);
+
+#ifndef WITH_LEANER
 SOAP_FMAC1 int SOAP_FMAC2 soap_wstring_out(struct soap*, const wchar_t *s, int flag);
 SOAP_FMAC1 wchar_t* SOAP_FMAC2 soap_wstring_in(struct soap*, int, long, long);
-
-SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, int n1, int n2);
-
-SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, struct Namespace*);
+#endif
+
+SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, size_t n1, size_t n2);
+
+SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, const struct Namespace*);
+SOAP_FMAC1 void SOAP_FMAC2 soap_set_local_namespaces(struct soap*);
 
 SOAP_FMAC1 void SOAP_FMAC2 soap_pop_namespace(struct soap*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_push_namespace(struct soap*, const char *,const char *);
-
-SOAP_FMAC1 int SOAP_FMAC2 soap_new_block(struct soap*);
-SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t);
-SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*);
-SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t);
-SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*);
-SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*);
-SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*);
-SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int);
-SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_current_namespace(struct soap *soap, const char *tag);
+
+SOAP_FMAC1 struct soap_nlist* SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n);
+
+SOAP_FMAC1 int SOAP_FMAC2 soap_store_lab(struct soap*, const char*, size_t);
+SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap*, const char*, size_t);
+
+SOAP_FMAC1 struct soap_blist* SOAP_FMAC2 soap_new_block(struct soap*);
+SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, struct soap_blist*, size_t);
+SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*, struct soap_blist*);
+SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, struct soap_blist*, size_t);
+SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*, struct soap_blist*);
+SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*, struct soap_blist*);
+SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*, struct soap_blist*);
+SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, struct soap_blist*, char*, int);
+SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*, struct soap_blist*);
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap*);
@@ -1635,10 +2138,20 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_response(struct soap*, int);
 
+SOAP_FMAC1 int SOAP_FMAC2 soap_send_empty_response(struct soap*, int status);
+SOAP_FMAC1 int SOAP_FMAC2 soap_recv_empty_response(struct soap*);
+
 SOAP_FMAC1 int SOAP_FMAC2 soap_send_fault(struct soap*);
-
 SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*);
 
+#ifndef WITH_NOSTDLIB
 SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*);
 SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*);
+# ifndef WITH_LEAN
+#  ifdef __cplusplus
+SOAP_FMAC1 void SOAP_FMAC2 soap_stream_fault(struct soap*, std::ostream&);
+#  endif
+SOAP_FMAC1 char* SOAP_FMAC2 soap_sprint_fault(struct soap*, char*, size_t);
+# endif
+#endif
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_s2byte(struct soap*, const char*, char*);
@@ -1654,9 +2167,13 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedLong(struct soap*, const char*, unsigned long*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_s2ULONG64(struct soap*, const char*, ULONG64*);
-SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap*, const char*, time_t*);
 SOAP_FMAC1 int SOAP_FMAC2 soap_s2string(struct soap*, const char*, char**);
 SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap*, const char*, char**);
 
-SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, size_t);
+#ifndef WITH_LEAN
+SOAP_FMAC1 int SOAP_FMAC2 soap_s2wchar(struct soap*, const char*, wchar_t**);
+SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap*, const char*, time_t*);
+SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, int);
+SOAP_FMAC1 char* SOAP_FMAC2 soap_s2hex(struct soap*, const unsigned char*, char*, int);
+#endif
 
 SOAP_FMAC1 const char* SOAP_FMAC2 soap_byte2s(struct soap*, char);
@@ -1672,8 +2189,13 @@
 SOAP_FMAC1 const char* SOAP_FMAC2 soap_unsignedLong2s(struct soap*, unsigned long);
 SOAP_FMAC1 const char* SOAP_FMAC2 soap_ULONG642s(struct soap*, ULONG64);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*);
+
+#ifndef WITH_LEAN
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_wchar2s(struct soap*, const wchar_t*);
 SOAP_FMAC1 const char* SOAP_FMAC2 soap_dateTime2s(struct soap*, time_t);
-SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*);
-
-SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, size_t*);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, int*);
+SOAP_FMAC1 const char* SOAP_FMAC2 soap_hex2s(struct soap*, const char*, char*, size_t, int*);
+#endif
+
 
 SOAP_FMAC1 int* SOAP_FMAC2 soap_inint(struct soap*, const char *tag, int *p, const char *, int);
@@ -1689,9 +2211,16 @@
 SOAP_FMAC1 unsigned long* SOAP_FMAC2 soap_inunsignedLong(struct soap*, const char *tag, unsigned long *p, const char *, int);
 SOAP_FMAC1 ULONG64* SOAP_FMAC2 soap_inULONG64(struct soap*, const char *tag, ULONG64 *p, const char *, int);
+SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int, long, long);
+SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p);
+
+#ifndef WITH_LEAN
 SOAP_FMAC1 time_t* SOAP_FMAC2 soap_indateTime(struct soap*, const char *tag, time_t *p, const char *, int);
-SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int, long, long);
+SOAP_FMAC1 time_t SOAP_FMAC2 soap_timegm(struct tm*);
+#endif
+
+#ifndef WITH_LEANER
 SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwstring(struct soap*, const char *tag, wchar_t **p, const char *, int, long, long);
-SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p);
 SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwliteral(struct soap*, const char *tag, wchar_t **p);
+#endif
 
 SOAP_FMAC1 int SOAP_FMAC2 soap_outbyte(struct soap*, const char *tag, int id, const char *p, const char *, int);
@@ -1707,12 +2236,18 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedLong(struct soap*, const char *tag, int id, const unsigned long *p, const char *, int);
 SOAP_FMAC1 int SOAP_FMAC2 soap_outULONG64(struct soap*, const char *tag, int id, const ULONG64 *p, const char *, int);
+SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap*, const char *tag, int id, char *const*p, const char *, int);
+SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p, const char *type);
+
+#ifndef WITH_LEAN
 SOAP_FMAC1 int SOAP_FMAC2 soap_outdateTime(struct soap*, const char *tag, int id, const time_t *p, const char *, int);
-SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap*, const char *tag, int id, char *const*p, const char *, int);
+#endif
+
+#ifndef WITH_LEANER
 SOAP_FMAC1 int SOAP_FMAC2 soap_outwstring(struct soap*, const char *tag, int id, wchar_t *const*p, const char *, int);
-SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p);
-SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p);
+SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p, const char *type);
+#endif
 
 #ifndef WITH_LEANER
-SOAP_FMAC1 int SOAP_FMAC2 soap_element_dime(struct soap *, const char*, int, const void*, const struct soap_array*, const char*, const char*, const char*, int, const char*, int);
+SOAP_FMAC1 int SOAP_FMAC2 soap_attachment(struct soap *, const char*, int, const void*, const struct soap_array*, const char*, const char*, const char*, int, const char*, int);
 SOAP_FMAC1 int SOAP_FMAC2 soap_move(struct soap*, long);
 SOAP_FMAC1 size_t SOAP_FMAC2 soap_tell(struct soap*);
@@ -1732,5 +2267,9 @@
 SOAP_FMAC1 int SOAP_FMAC2 soap_set_dime_attachment(struct soap*, char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option);
 SOAP_FMAC1 int SOAP_FMAC2 soap_set_mime_attachment(struct soap*, char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description);
+SOAP_FMAC1 void SOAP_FMAC2 soap_post_check_mime_attachments(struct soap *soap);
+SOAP_FMAC1 int SOAP_FMAC2 soap_check_mime_attachments(struct soap *soap);
+SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_get_mime_attachment(struct soap *soap, void *handle);
 SOAP_FMAC1 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*);
+SOAP_FMAC1 int SOAP_FMAC2 soap_match_cid(struct soap*, const char*, const char*);
 #endif
 
@@ -1743,9 +2282,11 @@
 
 #ifdef WITH_COOKIES
+SOAP_FMAC1 void SOAP_FMAC2 soap_getcookies(struct soap *soap, const char *val);
 SOAP_FMAC1 size_t SOAP_FMAC2 soap_encode_cookie(const char*, char*, size_t);
 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_set_cookie(struct soap*, const char*, const char*, const char*, const char*);
 SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_cookie(struct soap*, const char*, const char*, const char*);
 SOAP_FMAC1 extern char* SOAP_FMAC2 soap_cookie_value(struct soap*, const char*, const char*, const char*);
-SOAP_FMAC1 extern long SOAP_FMAC2 soap_cookie_expire(struct soap*, const char*, const char*, const char*);
+SOAP_FMAC1 extern char* SOAP_FMAC2 soap_env_cookie_value(struct soap*, const char*, const char*, const char*);
+SOAP_FMAC1 extern time_t SOAP_FMAC2 soap_cookie_expire(struct soap*, const char*, const char*, const char*);
 SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_expire(struct soap*, const char*, long, const char*, const char*);
 SOAP_FMAC1 extern int SOAP_FMAC2 soap_set_cookie_session(struct soap*, const char*, const char*, const char*);
@@ -1753,12 +2294,11 @@
 SOAP_FMAC1 extern void SOAP_FMAC2 soap_clr_cookie(struct soap*, const char*, const char*, const char*);
 SOAP_FMAC1 extern int SOAP_FMAC2 soap_getenv_cookies(struct soap*);
-SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_copy_cookies(struct soap*);
+SOAP_FMAC1 extern struct soap_cookie* SOAP_FMAC2 soap_copy_cookies(struct soap*, const struct soap*);
 SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*);
 #endif
 
 #ifdef __cplusplus
-}
-#endif
-
-#endif
-
+} /* extern "C" */
+#endif
+
+#endif
