|  | Home | Documentation | soap Struct Reference updated by Robert van Engelen |

soap Struct Reference
Context with engine state

Context with the engine state. More...

`#include <stdsoap2.h>`

## Public Member Functions

| soap ()
| Construct a soap context (C++ only, in C use ::soap_new or soap_init).
| soap (soap_mode input_and_output_mode)
| Construct a soap context with the specified input and output soap_mode flags (C++ only, in C use ::soap_new1 or soap_init1)).
| soap (soap_mode input_mode, soap_mode output_mode)
| Construct a soap context with the specified input and output soap_mode flags (C++ only, in C use ::soap_new2 or soap_init2)).
| soap (const struct soap &)
| Copy constructor (C++ only, in C use ::soap_copy or soap_copy_context).
struct soap & | operator= (const struct soap &)
| Assignment constructor (C++ only, in C use ::soap_copy or soap_copy_context).
void | destroy ()
| Delete all dynamically-allocated objects and data managed by this soap context (C++ only, in C use soap_end).
| ~soap ()
| Finalize and delete the soap context by finalizing with soap_done(this) (C++ only, in C use soap_free or soap_done).
*Callback to manage the verification of the certificate provided by a | peer (typically a server) int(*fsslverify)(int ok

## Public Attributes

soap_mode | imode
| The soap context input soap_mode flags that are set at context initialization and set or cleared with soap_set_imode or soap_clr_imode, respectively.
soap_mode | omode
| The soap context output soap_mode flags that are set at context initialization and set or cleared with soap_set_omode or soap_clr_omode, respectively.
SSL_CTX * | ctx
| OpenSSL context pointer.
short | version
| SOAP version (0 = no SOAP, 1 = SOAP 1.1, 2 = SOAP 1.2).
const char * | encodingStyle
| User-definable SOAP-ENV:encodingStyle URI value.
const char * | actor
| User-definable SOAP-ENV:actor (SOAP 1.1) or SOAP-ENV:role (SOAP 1.2) attribute value of all SOAP-ENV:mustUnderstand attributed header elements.
const char * | lang
| User-definable xml:lang attribute value of SOAP-ENV:Text to output the SOAP Fault string/reason (the value is en by default).
int | max_keep_alive
| User-definable maximum number of keep-alive message exchanges per connection (the value is #SOAP_MAXKEEPALIVE by default).
int | keep_alive
| HTTP keep-alive flag (try to enable when -1, disabled when 0) and counter (enabled when >0).
const char * | c14ninclude
| User-definable string to control the XML namespace prefixes that are subject to XML canonicalization with the #SOAP_XML_CANONICAL output mode flag, specified by space-separated prefixes in the string, or * to specify that all prefixes are inclusive, or NULL when unused.
const char * | c14nexclude
| User-definable string to control the XML namespace prefixes that are subject to XML canonicalization with #SOAP_XML_CANONICAL output mode flag, specified by space-separated prefixes in the string, or NULL when unused.
int | status

The soap context HTTP status code received at the client side (100 to 599), HTTP header method received at the server side (#SOAP_POST, #SOAP_PATCH, #SOAP_GET, #SOAP_PUT, #SOAP_DEL, #SOAP_HEAD, #SOAP_OPTIONS), or the HTTP method to use for sending a message with soap_connect_command or with soap_response (#SOAP_POST, #SOAP_POST_FILE, #SOAP_PATCH, #SOAP_GET, #SOAP_PUT, #SOAP_PUT, #SOAP_DEL, #SOAP_CONNECT, #SOAP_HEAD, #SOAP_OPTIONS).

int | error
| The soap context soap_status (int) error code of the last operation or #SOAP_OK (zero).
int | errnum
| The errno value of the last failed IO operation.
struct SOAP_ENV__Header * | header
| The soap::header points to a SOAP_ENV__Header structure with the SOAP Header that was received or that can be populated by the user to be sent, or NULL when no SOAP Header is present.
struct SOAP_ENV__Fault * | fault
| The soap::fault points to a SOAP_ENV__Fault structure with the SOAP Fault that was received or that can be populated by the user to be sent, or NULL when no SOAP Fault is present.
void * | user
| User-definable variable that may point to user-specified data of any type to pass the data through to callbacks and plugins.
short | mustUnderstand
| The soap::mustUnderstand flag is set when a SOAP Header element carries a SOAP-ENV:mustUnderstand attribute that is true.
short | null
| The soap::null flag is set when an element carries a xsi:nil attribute that is true.
short | body
| The soap::body flag is set when an element has element content during XML parsing or when a HTTP message has a body when parsing an HTTP header.
const char * | prolog
| User-definable XML declaration prolog (<?xml version="1.0" encoding="UTF-8"?> by default).
const char * | cookie_domain
| User-definable string that specifies the HTTP cookie domain of the running server.
const char * | cookie_path
| User-definable string that specifies the HTTP cookie path of the running server.
int | cookie_max
| User-definable maximum number of active cookies allowed to be set with soap_set_cookie before cookie memory is reused (the value is 32 by default).
struct soap_cookie * | cookies
| The cookie store is a linked list of cookies.
const char * | http_content
| String with HTTP content type header value received, can also be assigned to specify a content type header for soap_connect_command with #SOAP_POST_FILE, #SOAP_PUT and #SOAP_PATCH or for soap_response with #SOAP_FILE or for soap_PUT, soap_PATCH, soap_POST. The soap::http_content string is reset to NULL after each HTTP invocation and has to be set again when required.
const char * | http_extra_header
| User-definable string that specifies an extra HTTP header or multiple HTTP headers when separated by CRLF in the specified string, to include in the next HTTP request (client side) or to include with the HTTP response (server side). The specified headre or headers are checked by the engine to conform to HTTP header formats or otherwise will be ignored and not output.
SOAP_SOCKET | master
| The socket set by ::soap_bind (or the C++ service class bind method) to serve as the master socket bound to a specified port, or #SOAP_INVALID_SOCKET when unassigned.
SOAP_SOCKET | socket
| The socket set by ::soap_accept (or the C++ service class accept method) or ::soap_connect or soap_connect_command (or the C++ proxy methods) when successful, or #SOAP_INVALID_SOCKET when unassigned.
int | recvfd
| The file descriptor to read data from when no socket communications are set (soap::socket == #SOAP_INVALID_SOCKET) and soap:is == NULL, default value is 0 (stdin).
int | sendfd
| The file descriptor to write data to when no socket communications are set (soap::socket == #SOAP_INVALID_SOCKET) and soap:os == NULL, default value is 1 (stdout).
SOAP_SOURCE * | is
| The source to read data from when non-NULL, which in C++ is a std::istream object and in C is a 0-terminated string to be read, default value is NULL.
SOAP_SINK * | os
| The sink to write data to when non-NULL, which in C++ is a std::ostream object and in C is a pointer to a char* string variable that will be set to point to a managed 0-terminated string with the data, default value is NULL.
ULONG64 | recv_maxlength
| User-definable maximum message length that is permitted to be received, zero means unlimited (the value is 2GB by default).
int | transfer_timeout
| User-definable timeout to send or receive an entire message, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).
int | recv_timeout
| User-definable timeout to receive a packet of data, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).
int | send_timeout
| User-definable timeout to send a packet of data, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).
int | accept_timeout
| User-definable timeout when waiting to accept a request from a client at the server-side with ::soap_accept (or the C++ service class accept method), positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).
int | connect_timeout
| User-definable timeout when waiting to connect to a server at the client-side, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).
int | connect_retry
| User-definable number of retries to attempt at the client side when connecting to a server fails with SOAP_TCP_ERROR, using exponential backoff delays between reconnects, maxed at 32 seconds: 1, 2, 4, 8, 16, 32, 32, 32, ... seconds for retry values 1 to 8 respectively (the retry value is 0 by default, meaning no retry).
unsigned int | maxlevel
| User-definable maximum XML and JSON nesting level permitted, initially set to #SOAP_MAXLEVEL (the value is 10000 by default).
long | maxlength
| User-definable maximum string length parsed from XML and JSON, initially set to #SOAP_MAXLENGTH, zero or negative means unlimited (0 by default).
size_t | maxoccurs
| User-definable maximum array and container size (maximum item occurrence constraint) as parsed from XML and JSON, except when specifie XML schema validation constraints permit greater sizes, initially set to #SOAP_MAXOCCURS (the value is 100000 by default).
int | socket_flags
| User-definable socket send and recv flags, for example assign MSG_NOSIGNAL to disable sigpipe (the value is 0 by default).
int | connect_flags
| User-definable setsockopt level SOL_SOCKET flags when connecting soap::socket to a server (the value is 0 by default).
int | bind_flags
| User-definable setsockopt level SOL_SOCKET flags when binding soap::master socket (the value is 0 by default).
short | bind_inet6
| User-definable flag, when nonzero uses AF_INET6 instead of PF_UNSPEC when binding the soap::master socket in ::soap_bind (or the C++ service class bind method), to remap IPv4 to IPv6 addresses, meaningful only when used with #WITH_IPV6.
short | bind_v6only
| User-definable flag, when nonzero enables IPPROTO_IPV6 setsockopt IPV6_V6ONLY when binding the soap::master socket with ::soap_bind (or the C++ service class bind method), meaningful only when used with #WITH_IPV6.
int | accept_flags
| User-definable setsockopt level SOL_SOCKET flags (0 by default), when nonzero sets the soap::socket flags when accepting a request with ::soap_accept (or the C++ service class accept method).
unsigned short | linger_time
| User-definable linger time value, requires the SO_LINGER setsockopt flag value to be assigned to soap::socket_flags.
int | rcvbuf
| User-definable value to set SO_RCVBUF setsockopt (the value is #SOAP_BUFLEN by default).
int | sndbuf
| User-definable value to set SO_SNDBUF setsockopt (the value is #SOAP_BUFLEN by default).
int | tcp_keep_alive
| User-definable value to set SO_KEEPALIVE setsockopt (0 by default unless the #SOAP_IO_KEEPALIVE mode flag is set).
unsigned int | tcp_keep_idle
| User-definable value to set TCP_KEEPIDLE setsockopt (the value is 0 by default).
unsigned int | tcp_keep_intvl
| User-definable value to set TCP_KEEPINTVL setsockopt (the value is 0 by default).
unsigned int | tcp_keep_cnt
| User-definable value to set TCP_KEEPCNT setsockopt (the value is 0 by default).
unsigned int | ipv6_multicast_if
| User-definable value to set sockaddr_in6::sin6_scope_id when nonzero.
char * | ipv4_multicast_if
| User-definable value to set setsockopt level IPPROTO_IP to IP_MULTICAST_IF when non-NULL.
unsigned char | ipv4_multicast_ttl
| User-definable value to set setsockopt level IPPROTO_IP to IP_MULTICAST_TTL when nonzero.
const char * | client_addr
| User-definable client address to bind to before connecting to a server, when non-NULL (Windows: n/a).
const char * | client_addr_ipv6
| User-definable client address to bind to before connecting to a server, when non-NULL, requires #WITH_IPV6.
int | client_port
| User-definable client port to bind to before connecting to a server, when non-negative.
const char * | client_interface
| User-definable client interface address to override when connecting to a server, when non-NULL (Windows: n/a).
unsigned short | z_level
| User-definable compression level for gzip compression (0=none, 1=fast to 9=best) default level is 6.
float | z_ratio_in
| The compression ratio = compressed.size/uncompressed.size of the compressed message received.
float | z_ratio_out
| The compression ratio = compressed.size/uncompressed.size of the compressed message sent.
const char * | bearer
| User-definable HTTP authorization bearer token value to be sent by the client, server side receives this string when the client sends authorization bearer.
const char * | userid
| User-definable HTTP and NTLM authorization user id string for HTTP basic and NTLM authentication by the client, server side receives this string when the client uses HTTP basic authentication, for HTTP digest authentication see the gSOAP HTTP digest authentication plugin.
const char * | passwd
| User-definable HTTP and NTLM authorization password string required for HTTP basic and NTLM authentication by the client, server side receives this string when the client uses HTTP basic authentication.
const char * | authrealm
| The HTTP and NTLM authorization realm/domain string received by the client with the WWW-Authenticate or Proxy-Authenticate HTTP headers, user-definable on the server side to send a WWW-Authenticate header to require authentication (service operation should return 401 to respond with "Unauthorized"), also serves as NTLM domain value.
const char * | ntlm_challenge
| User-definable NTLM authentication challenge key string.
const char * | proxy_host
| User-definable proxy host name string which should be set to connect through an HTTP proxy.
int | proxy_port
| User-definable proxy port which should be set to connect through an HTTP proxy (the value is 8080 by default).
const char * | proxy_userid
| User-definable proxy authorization user id string to authenticate and connect to an HTTP proxy.
const char * | proxy_passwd
| User-definable proxy authorization password string to authenticate and connect to an HTTP proxy.
const char * | proxy_from
| The X-Forwarding-For HTTP header string value received.
unsigned int | ip
| The IPv4 address in numeric form of the client as received on the server side by ::soap_accept (or the C++ service class accept method), possibly set to zero when #WITH_IPV6 is used.
unsigned int | ip6 [4]
| The IPv6 address in numeric form (upper ip6[0] to lower ip6[3]) of the client as received on the server side by ::soap_accept (or the C++ service class accept method), requires #WITH_IPV6.
int | port
| The client port connected to as received on the server side by ::soap_accept (or the C++ service class accept method).
char | endpoint [SOAP_TAGLEN]
| The endpoint URL as received on the server side.
char | host [SOAP_TAGLEN]
| The host IP address of the client, as received on the server side.
char | path [SOAP_TAGLEN]
| The client request path as received on the server side.
const char * | override_host
| User-definable string to override the host name or IP address in the HTTP header when connecting at the client side.
int | override_port
| User-definable port number to override the port address in the HTTP header when connecting at the client side.
const char * | origin
| The CORS Origin HTTP header string value received.
const char * | cors_origin
| The CORS Access-Control-Allow-Origin HTTP header string value received or the user-definable value to be returned by the server when set.
const char * | cors_allow
| User-definable CORS Access-Control-Allow-Origin HTTP header string default value (the value is * by default).
const char * | cors_method
| The CORS Access-Control-Request-Method HTTP header string received.
const char * | cors_header
| The CORS Access-Control-Request-Headers HTTP header string received.
const char * | cors_methods
| User-definable CORS Access-Control-Request-Methods HTTP header string to be returned by the server.
const char * | cors_headers
| User-definable CORS Access-Control-Request-Headers HTTP header string to be returned by the server.
const char * | float_format
| User-definable floating point format string (%.9G by default, the printed format must not exceed 1023 bytes).
const char * | double_format
| User-definable double floating point format string (%.17lG by default, the printed format must not exceed 1023 bytes).
const char * | dime_id_format
| User-definable long double floating point format string (NULL by default and defined by the long_double.c custom serializer, the printed format must not exceed 1023 bytes).
*DOM tree received struct soap_dom_element * | dom
*DIME attachments received struct soap_dime | dime
*MIME attachments received struct soap_mime | mime
*Internal index that keeps track of the current position in the ::soap::buf buffer after receiving data into the buffer size_t | bufidx
*Internal index that keeps track of the length of the data available in the ::soap::buf | buffer
*Internal index that keeps track of the length of the data available in the ::soap::buf does not exceed size_t | buflen
*Internal buffer with partial data received or partial data to be | sent
*Internal buffer with partial data received or partial data to be where the data occupies ::soap::buflen bytes char | buf [SOAP_BUFLEN]
*Internal buffer to hold short | messages
*Internal buffer to hold short URLs and HTTP MIME header | lines
*Internal buffer to hold short URLs and HTTP MIME header must have at least char | msgbuf [SOAP_TMPLEN]
*Internal buffer to hold temporary strings such as string representations of primitive | values
*Internal buffer to hold temporary strings such as string representations of primitive XML tag | names
*Internal buffer to hold temporary strings such as string representations of primitive XML tag HTTP header lines and so | on
*Internal buffer to hold temporary strings such as string representations of primitive XML tag HTTP header lines and so must have at least char | tmpbuf [SOAP_TMPLEN]
*Message length counter value of the message received and counter value of the HTTP content length header to send a message ULONG64 | count
*The HTTP content length header value received or when HTTP transfer encoding is chunked ULONG64 | length
*Callback that populates and then sends HTTP headers from the client side to a connected HTTP server int(* | fpost )(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, ULONG64 count)
*Callback that populates and then sends HTTP headers from the server side to a connected client int(* | fresponse )(struct soap *soap, int status, ULONG64 count)
*Callback that sends a single HTTP header given a key value pair int(* | fposthdr )(struct soap *soap, const char *key, const char *val)
*Callback that reads and parses HTTP and MIME headers int(* | fparse )(struct soap *soap)
*Callback that consumes an HTTP header that consists of a key value pair int(* | fparsehdr )(struct soap *soap, const char *key, const char *val)
*Callback to implement logic at the server side to serve responses to HTTP GET requests from clients int(* | fget )(struct soap *soap)
*Callback to implement logic at the server side to serve responses to HTTP PUT requests from clients int(* | fput )(struct soap *soap)
*Callback to implement logic at the server side to serve responses to HTTP PATCH requests from clients int(* | fpatch )(struct soap *soap)
*Callback to implement logic at the server side to serve responses to HTTP DELETE requests from clients int(* | fdel )(struct soap *soap)
*Callback to implement logic at the server side to serve responses to HTTP OPTION requests from clients int(* | fopt )(struct soap *soap)
*Callback to implement logic at the server side to serve responses to HTTP HEAD requests from clients int(* | fhead )(struct soap *soap)
*Callback to implement logic at the server side to handle HTML | forms
*Callback to implement logic at the server side to handle HTML such as done by the callbacks provided by the HTTP FORM handler plugin int(* | fform )(struct soap *soap)
*Callback to inspect the SOAP Header received before the rest of the message with the SOAP Body is consumed int(* | fheader )(struct soap *soap)
*Callback to catch unrecognized XML encoding formats int(* | fencoding )(struct soap *soap, const char *encoding)
*Callback to catch unrecognized XML elements and overrides int(* | fignore )(struct soap *soap, const char *tag)
*Callback to validate strings against XML regex patterns int(* | fsvalidate )(struct soap *soap, const char *pattern, const char *string)
*Callback to validate wide strings against XML regex patterns int(* | fwvalidate )(struct soap *soap, const char *pattern, const wchar_t *string)
*Callback to inspect or override fault code or fault string messages void(* | fseterror )(struct soap *soap, const char **faultcode, const char **faultstring)
*Callback that opens a socket connection to a server endpoint SOAP_SOCKET(* | fopen )(struct soap *soap, const char *endpoint, const char *host, int port)
*Callback that waits for and accepts a socket connection requested by a client SOAP_SOCKET(* | faccept )(struct soap *soap, SOAP_SOCKET sock, struct sockaddr *addr, int *len)
*Callback that closes the current socket connection int(* | fclose )(struct soap *soap)
*Callback that resolves a host name by address translation int(* | fresolve )(struct soap *soap, const char *name, struct in_addr *inaddr)
*Callback that overrides the client side connecting operations int(* | fconnect )(struct soap *soap, const char *endpoint, const char *host, int port)
*Callback that executes disconnect logic before closing int(* | fdisconnect )(struct soap *soap)
*Callback that closes a given socket int(* | fclosesocket )(struct soap *soap, SOAP_SOCKET sock)
*Callback that shuts down a given socket int(* | fshutdownsocket )(struct soap *soap, SOAP_SOCKET sock, int how)
*Callback that blocks until activity is detected on the ::soap::socket or ::soap::master | socket
*Callback that blocks until activity is detected on the ::soap::socket or ::soap::master times out when ::soap::send_timeout or ::soap::recv_timeout are set int(* | fpoll )(struct soap *soap)
*Callback that receives bytes of data into the given buffer size_t(* | frecv )(struct soap *soap, char *buf, size_t len)
*Callback that sends the given bytes of data int(* | fsend )(struct soap *soap, const char *data, size_t len)
*Callback executed by the engine at the server side immediately after a server operation successfully completed int(* | fserveloop )(struct soap *soap)
*Callback to override dynamic memory allocation and management void *(* | fmalloc )(struct soap *soap, size_t size)
*Callback to open a streaming DIME attachment for reading void *(* | fdimereadopen )(struct soap *soap, void *handle, const char *id, const char *type, const char *options)
*Callback to read data in a DIME attachment stream size_t(* | fdimeread )(struct soap *soap, void *handle, char *buf, size_t len)
*Callback to close a DIME attachment stream after reading void(* | fdimereadclose )(struct soap *soap, void *handle)
*Callback to open a streaming DIME attachment for writing void *(* | fdimewriteopen )(struct soap *soap, const char *id, const char *type, const char *options)
*Callback to write data in a DIME attachment stream int(* | fdimewrite )(struct soap *soap, void *, const char *, size_t)
*Callback to close a DIME attachment stream after writing void(* | fdimewriteclose )(struct soap *soap, void *handle)
*Callback to open a streaming MIME MTOM attachment for reading void *(* | fmimereadopen )(struct soap *soap, void *, const char *, const char *, const char *)
*Callback to read data in a MIME MTOM attachment stream size_t(* | fmimeread )(struct soap *soap, void *handle, char *buf, size_t len)
*Callback to close a MIME MTOM attachment stream after reading void(* | fmimereadclose )(struct soap *soap, void *handle)
*Callback to open a streaming MIME MTOM attachment for writing void *(* | fmimewriteopen )(struct soap *soap, void *handle, const char *id, const char *type, const char *description, enum soap_mime_encoding encoding)
*Callback to write data in a MIME attachment stream int(* | fmimewrite )(struct soap *soap, void *handle, const char *buf, size_t len)
*Callback to close a MIME MTOM attachment stream after writing void(* | fmimewriteclose )(struct soap *soap, void *handle)
*Callback to initialize the OpenSSL library int(* | fsslauth )(struct soap *soap)
*Callback to manage the verification of the certificate provided by a X509_STORE_CTX * | store

## Detailed Description

Context with the engine state.

The soap context should be passed as the first parameter to all gSOAP functions and should only be used by a single thread at a time. Each thread should use a copy of the context created with ::soap_copy or with the soap::soap copy constructor.

To allocate a new soap context, use one of these three allocators that take soap_mode parameters:

struct soap *soap1 = soap_new();
struct soap *soap2 = soap_new1(input_and_output_mode);
struct soap *soap3 = soap_new2(input_mode, output_mode);
soap::soap
soap()
Construct a soap context (C++ only, in C use soap_new or soap_init).

Alternatively, use constructors in C++ as follows:

struct soap *soap1();
struct soap *soap2(input_and_output_mode);
struct soap *soap3(input_mode, output_mode);

To copy the soap context, for example to be used by another thread, use:

struct soap *soap2 = soap_copy(soap1);

Alternatively, use the copy constructor in C++ as follows:

struct soap *soap2 = new soap(soap1);

To free the soap context or a copy of a soap context, use:

soap_free(soap1);
soap_free
*Finalize and free the given ::soap context from unmanaged heap memory void soap_free(struct soap *soap)

To stack-allocate a soap context (i.e. as opposed to heap-allocating it as shown above), initialize the soap context with one of these three initializers that take soap_mode parameters:

struct soap soap1, soap2, soap3;
soap_init(&soap1);
soap_init1(&soap2, input_and_output_mode);
soap_init2(&soap3, input_mode, output_mode);
soap_init
*Allocate and initialize a new ::soap context struct soap *soap_new *() * @returns pointer to allocated and initialized ` Allocate and initialize a new ::soap context with input and output ::soap_mode flags struct soap *soap_new1 *(soap_mode input_and_output_mode) * @returns pointer to allocated and initialized ` Allocate and initialize a new ::soap context with separate input and output ::soap_mode flags struct soap *soap_new2 *(soap_mode input_mode, soap_mode output_mode) * @returns pointer to allocated and initialized ` Initialize a stack allocated ::soap context void soap_init(struct soap *soap)
soap_init1
*Initialize a stack allocated ::soap context with input and output ::soap_mode flags void soap_init1(struct soap *soap, soap_mode input_and_output_mode)
soap_init2
*Initialize a stack allocated ::soap context with input and output ::soap_mode flags void soap_init2(struct soap *soap, soap_mode input_mode, soap_mode output_mode)

Alternatively, use constructors in C++:

struct soap soap1();
struct soap soap2(input_and_output_mode);
struct soap soap3(input_mode, output_mode);

Finalization of the soap context is automatically done by the C++ destructor. In C, you should finalize a stack-allocated soap context before it is reclaimed by the stack:

soap_done(&soap1);
soap_done
*Finalize the given ::soap i e when the ::soap context is stack automatically invoked in C by the ::soap destructor on the ::soap context to delete void soap_done(struct soap *soap)

Before freeing or finalizating a soap context, you may want to delete all data allocated in managed heap memory with these two calls in this specific order:

soap_destroy(soap1);
soap_end(soap1);
soap_end
*Delete all data from heap memory managed by the specified ::soap context and release the freed memory back to the heap int soap_end(struct soap *soap) * @returns `

Alternatively, in C++ you can simply invoke one method to perform both calls at once:

soap1.destroy();
soap::destroy
void destroy()
Delete all dynamically-allocated objects and data managed by this soap context (C++ only,...

## Constructor & Destructor Documentation

## ◆ soap() [1/4]

soap::soap | ( |  | ) |

Construct a soap context (C++ only, in C use ::soap_new or soap_init).

## ◆ soap() [2/4]

soap::soap | ( | soap_mode | input_and_output_mode | ) |

Construct a soap context with the specified input and output soap_mode flags (C++ only, in C use ::soap_new1 or soap_init1)).

Parameters

  input_and_output_mode | input and output soap_mode flags

## ◆ soap() [3/4]

soap::soap | ( | soap_mode | input_mode,
|  | soap_mode | output_mode )

Construct a soap context with the specified input and output soap_mode flags (C++ only, in C use ::soap_new2 or soap_init2)).

Parameters

  input_mode | input soap_mode flags
  output_mode | output soap_mode flags

## ◆ soap() [4/4]

soap::soap | ( | const struct soap & |  | ) |

Copy constructor (C++ only, in C use ::soap_copy or soap_copy_context).

## ◆ ~soap()

soap::~soap | ( |  | ) |

Finalize and delete the soap context by finalizing with soap_done(this) (C++ only, in C use soap_free or soap_done).

## Member Function Documentation

## ◆ destroy()

void soap::destroy | ( |  | ) |

Delete all dynamically-allocated objects and data managed by this soap context (C++ only, in C use soap_end).

## ◆ operator=()

struct soap & soap::operator= | ( | const struct soap & |  | ) |

Assignment constructor (C++ only, in C use ::soap_copy or soap_copy_context).

Returns
  this soap context

## Member Data Documentation

## ◆ accept_flags

int soap::accept_flags

User-definable setsockopt level SOL_SOCKET flags (0 by default), when nonzero sets the soap::socket flags when accepting a request with ::soap_accept (or the C++ service class accept method).

Example:

struct soap *soap = soap_new();
soap->accept_flags = SO_NOSIGPIPE; // no sigpipe (this is not portable)

Other ways to disable sigpipe:

struct soap *soap = soap_new();
soap->socket_flags = MSG_NOSIGNAL;
#include <signal.h>
void sigpipe_handle(int) { }
signal(SIGPIPE, sigpipe_handle);

See also
  soap::socket_flags, soap::connect_flags, soap::bind_flags.

## ◆ accept_timeout

int soap::accept_timeout

User-definable timeout when waiting to accept a request from a client at the server-side with ::soap_accept (or the C++ service class accept method), positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).

Example:

#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
soap->accept_timeout = 3600; // exit loop when no request arrives in one hour
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG)))
{
while (1)
{
if (soap_valid_socket(soap_accept(soap)))
{
if (soap_serve(soap))
soap_print_fault(soap, stderr);
}
else if (soap->errnum) // accept failed, try again after 1 second
{
soap_print_fault(soap, stderr);
sleep(1);
}
else // accept timed out, quit looping
{
break;
}
soap_destroy(soap);
soap_end(soap);
}
}
soap_free(soap);
}
soap_print_fault
void soap_print_fault(struct soap *soap, FILE *fd)
Print error message on the specified output.
soap_serve
*Bind and listen to a port SOAP_SOCKET soap_bind *(struct soap *soap, const char *host, int port, int backlog) * @returns the ` Accept a connection with a client SOAP_SOCKET soap_accept *(struct soap *soap) * @returns the ` Serve a pending request in soap_serve)(struct soap *soap) * @returns `
Definition stdsoap2.h:7466
soap_valid_socket
#define soap_valid_socket(sock)
Function macro to check if a socket is valid, i.e. not equal to #SOAP_INVALID_SOCKET.
Definition stdsoap2.h:1354
soap
Context with the engine state.
Definition stdsoap2.h:2929
soap::errnum
int errnum
The errno value of the last failed IO operation.
Definition stdsoap2.h:3052

See also
  soap::error, soap::errnum, soap::connect_timeout, soap::recv_timeout, soap::send_timeout, soap::transfer_timeout, soap::recv_maxlength.

## ◆ actor

const char* soap::actor

User-definable SOAP-ENV:actor (SOAP 1.1) or SOAP-ENV:role (SOAP 1.2) attribute value of all SOAP-ENV:mustUnderstand attributed header elements.

Example:

#include "soapH.h"
struct soap *soap = soap_new();
... // context initializations
// add a SOAP Header to the message
SOAP_ENV__Header header;
header->ns__required_value = 123; // a header element marked mustUnderstand
soap->header = &header;
// add SOAP-ENV:role="http://www.w3.org/2002/06/soap-envelope/role/next";
soap->actor = "http://www.w3.org/2002/06/soap-envelope/role/next";
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
SOAP_ENV__Header
SOAP Header structure.
Definition stdsoap2.h:9546
soap::header
struct SOAP_ENV__Header * header
The soap::header points to a SOAP_ENV__Header structure with the SOAP Header that was received or tha...
Definition stdsoap2.h:3080
soap::endpoint
char endpoint[SOAP_TAGLEN]
The endpoint URL as received on the server side.
Definition stdsoap2.h:4143

See also
  SOAP_ENV__Header.

## ◆ authrealm

const char* soap::authrealm

The HTTP and NTLM authorization realm/domain string received by the client with the WWW-Authenticate or Proxy-Authenticate HTTP headers, user-definable on the server side to send a WWW-Authenticate header to require authentication (service operation should return 401 to respond with "Unauthorized"), also serves as NTLM domain value.

See also
  soap::userid, soap::passwd.

## ◆ bearer

const char* soap::bearer

User-definable HTTP authorization bearer token value to be sent by the client, server side receives this string when the client sends authorization bearer.

Example:

struct soap *soap = soap_new();
if (soap_ssl_client_context(soap, ...))
exit(EXIT_FAILURE);
soap->bearer = "bearer-token";
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
soap_ssl_client_context
*Initialize the client side SSL TLS context int soap_ssl_client_context(struct soap *soap, soap_ssl_flags flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *randfile) * @returns `
int main()
{
struct soap *soap = soap_new();
if (soap_ssl_server_context(soap, ...))
exit(EXIT_FAILURE);
... // serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve
}
int ns__webmethod(struct soap *soap, ...)
{
if (!soap->bearer || strcmp(soap->bearer, "bearer-token"))
return 401; // Unauthorized
... // process the request data and populate the response data
return SOAP_OK;
}
SOAP_OK
#define SOAP_OK
The soap_status code for no error (zero).
Definition stdsoap2.h:2392
soap_ssl_server_context
*Initialize the server side SSL TLS context int soap_ssl_server_context(struct soap *soap, soap_ssl_flags flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *dhfile, const char *randfile, const char *sid) * @returns `
soap::bearer
const char * bearer
User-definable HTTP authorization bearer token value to be sent by the client, server side receives t...
Definition stdsoap2.h:3877

See also
  soap_ssl_client_context, soap_ssl_server_context, soap::userid, soap::passwd, soap::ntlm_challenge and the HTTP digest plugin documentation.

## ◆ bind_flags

int soap::bind_flags

User-definable setsockopt level SOL_SOCKET flags when binding soap::master socket (the value is 0 by default).

Example

struct soap *soap = soap_new();
soap->bind_flags = SO_REUSEADDR; // immediate port reuse when binding
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG))
... // success

See also
  soap::socket_flags, soap::connect_flags, soap::accept_flags, #WITH_IPV6, #WITH_IPV6_V6ONLY, #SOAP_IO_UDP, soap::bind_inet6, soap::bind_v6only, soap::rcvbuf, soap::sndbuf, soap::master.

## ◆ bind_inet6

short soap::bind_inet6

User-definable flag, when nonzero uses AF_INET6 instead of PF_UNSPEC when binding the soap::master socket in ::soap_bind (or the C++ service class bind method), to remap IPv4 to IPv6 addresses, meaningful only when used with #WITH_IPV6.

Example:

// requires compilation with compile-time flag -D WITH_IPV6
struct soap *soap = soap_new();
soap->bind_inet6 = 1;
soap->bind_v6only = 1;
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG)) // IPv6 address binding
... // success

See also
  soap::bind_v6only.

Note
  Requires compilation with #WITH_IPV6.

## ◆ bind_v6only

short soap::bind_v6only

User-definable flag, when nonzero enables IPPROTO_IPV6 setsockopt IPV6_V6ONLY when binding the soap::master socket with ::soap_bind (or the C++ service class bind method), meaningful only when used with #WITH_IPV6.

Example:

// requires compilation with compile-time flag -D WITH_IPV6
struct soap *soap = soap_new();
soap->bind_inet6 = 1;
soap->bind_v6only = 1;
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG)) // IPv6 address binding
... // success

See also
  soap::bind_inet6.

Note
  Requires compilation with #WITH_IPV6.

## ◆ body

short soap::body

The soap::body flag is set when an element has element content during XML parsing or when a HTTP message has a body when parsing an HTTP header.

## ◆ buf

* Internal buffer with partial data received or partial data to be where the data occupies ::soap::buflen bytes char soap::buf[SOAP_BUFLEN]

## ◆ buffer

* Internal index that keeps track of the length of the data available in the ::soap::buf soap::buffer

## ◆ bufidx

* Internal index that keeps track of the current position in the ::soap::buf buffer after receiving data into the buffer size_t soap::bufidx

## ◆ buflen

* Internal index that keeps track of the length of the data available in the ::soap::buf does not exceed size_t soap::buflen

## ◆ c14nexclude

const char* soap::c14nexclude

User-definable string to control the XML namespace prefixes that are subject to XML canonicalization with #SOAP_XML_CANONICAL output mode flag, specified by space-separated prefixes in the string, or NULL when unused.

## ◆ c14ninclude

const char* soap::c14ninclude

User-definable string to control the XML namespace prefixes that are subject to XML canonicalization with the #SOAP_XML_CANONICAL output mode flag, specified by space-separated prefixes in the string, or * to specify that all prefixes are inclusive, or NULL when unused.

## ◆ client_addr

const char* soap::client_addr

User-definable client address to bind to before connecting to a server, when non-NULL (Windows: n/a).

When non-NULL, sets the client address specified as IPv4 or IPv6 or as a host address to bind to before connecting to a server. The value is reset to NULL after connecting successfully or unsuccessfully to the server.

Example:

struct soap *soap = soap_new();
soap->client_addr = "12.34.56.78"; // client binds to 12.34.56.78 when connecting to endpoint
soap->client_port = 8080; // optional, to also specify a port to bind to
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

Note
  Cannot be used on Windows platforms.

See also
  soap::client_addr_ipv6, soap::client_port, soap::client_interface.

## ◆ client_addr_ipv6

const char* soap::client_addr_ipv6

User-definable client address to bind to before connecting to a server, when non-NULL, requires #WITH_IPV6.

When non-NULL and soap::client_addr is non-NULL and when connecting to a IPv6 server, sets the client address specified as IPv6 or as a host address to bind to before connecting to the server. The value is reset to NULL after connecting successfully or unsuccessfully to the server.

Example:

struct soap *soap = soap_new();
soap->client_addr = "12.34.56.78"; // client binds to 12.34.56.78 when connecting to a IPv4 endpoint
soap->client_addr_ipv6 = "2001:db8:0:1; // but the client binds 2001:db8:0:1 when connecting to a IPv6 endpoint
soap->client_port = 8080; // optional, to also specify a port to bind to
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

Note
  Requires compilation with #WITH_IPV6 or #WITH_IPV6_V6ONLY.

See also
  soap::client_addr, soap::client_port, soap::client_interface.

## ◆ client_interface

const char* soap::client_interface

User-definable client interface address to override when connecting to a server, when non-NULL (Windows: n/a).

When non-NULL, sets the client address before connecting to a server. The value is reset to NULL after connecting successfully or unsuccessfully to the server. Does not bind the address, unlike soap::client_addr and soap::client_addr_ipv6.

Note
  Cannot be used on Windows platforms.

See also
  soap::client_addr, soap::client_addr_ipv6, soap::client_addr_ipv6.

## ◆ client_port

int soap::client_port

User-definable client port to bind to before connecting to a server, when non-negative.

When non-negative, executes a bind with this port number before connecting to a server. The value is reset to -1 after connecting successfully or unsuccessfully to the server.

Example:

struct soap *soap = soap_new();
soap->client_port = 18000; // client binds to port 18000 when connecting to endpoint
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

See also
  soap::client_addr, soap::client_addr_ipv6, soap::client_interface.

## ◆ connect_flags

int soap::connect_flags

User-definable setsockopt level SOL_SOCKET flags when connecting soap::socket to a server (the value is 0 by default).

Examples:

struct soap *soap = soap_new();
soap->connect_flags = SO_LINGER;
soap->linger_time = 5;
struct soap *soap = soap_new();
soap->connect_flags = SO_BROADCAST;

See also
  soap::socket_flags, soap::bind_flags, soap::accept_flags.

## ◆ connect_retry

int soap::connect_retry

User-definable number of retries to attempt at the client side when connecting to a server fails with SOAP_TCP_ERROR, using exponential backoff delays between reconnects, maxed at 32 seconds: 1, 2, 4, 8, 16, 32, 32, 32, ... seconds for retry values 1 to 8 respectively (the retry value is 0 by default, meaning no retry).

Example:

#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
soap->connect_timeout = 30; // 30 seconds max connect stall time
soap->connect_retry = 4; // retry 4 more times (waiting 1, 2, 4, 8 seconds between retries)
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
{
soap_print_fault(soap, stderr);
if (soap->errnum == 0) // timed out, exit program
exit(EXIT_FAILURE);
}
else
{
... // success
}
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
}

See also
  soap::error, soap::errnum, soap::connect_timeout, soap::recv_timeout, soap::send_timeout, soap::transfer_timeout, soap::recv_maxlength, SOAP_TCP_ERROR.

## ◆ connect_timeout

int soap::connect_timeout

User-definable timeout when waiting to connect to a server at the client-side, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).

Example:

#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
soap->connect_timeout = 30; // 30 seconds max connect stall time
soap->connect_retry = 4; // retry 4 more times (waiting 1, 2, 4, 8 seconds between retries)
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
{
soap_print_fault(soap, stderr);
if (soap->errnum == 0) // timed out, exit program
exit(EXIT_FAILURE);
}
else
{
... // success
}
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
}

See also
  soap::error, soap::errnum, soap::connect_retry, soap::accept_timeout, soap::recv_timeout, soap::send_timeout, soap::transfer_timeout, soap::recv_maxlength.

## ◆ cookie_domain

const char* soap::cookie_domain

User-definable string that specifies the HTTP cookie domain of the running server.

## ◆ cookie_max

int soap::cookie_max

User-definable maximum number of active cookies allowed to be set with soap_set_cookie before cookie memory is reused (the value is 32 by default).

## ◆ cookie_path

const char* soap::cookie_path

User-definable string that specifies the HTTP cookie path of the running server.

## ◆ cookies

struct soap_cookie* soap::cookies

The cookie store is a linked list of cookies.

## ◆ cors_allow

const char* soap::cors_allow

User-definable CORS Access-Control-Allow-Origin HTTP header string default value (the value is * by default).

CORS is automatic at the server side. At the client side, CORS requires the HTTP OPTIONS method with CORS headers.

See also
  soap::origin.

## ◆ cors_header

const char* soap::cors_header

The CORS Access-Control-Request-Headers HTTP header string received.

CORS is automatic at the server side. At the client side, CORS requires the HTTP OPTIONS method with CORS headers.

See also
  soap::origin.

## ◆ cors_headers

const char* soap::cors_headers

User-definable CORS Access-Control-Request-Headers HTTP header string to be returned by the server.

CORS is automatic at the server side. At the client side, CORS requires the HTTP OPTIONS method with CORS headers.

See also
  soap::origin.

## ◆ cors_method

const char* soap::cors_method

The CORS Access-Control-Request-Method HTTP header string received.

CORS is automatic at the server side. At the client side, CORS requires the HTTP OPTIONS method with CORS headers.

See also
  soap::origin.

## ◆ cors_methods

const char* soap::cors_methods

User-definable CORS Access-Control-Request-Methods HTTP header string to be returned by the server.

CORS is automatic at the server side. At the client side, CORS requires the HTTP OPTIONS method with CORS headers.

See also
  soap::origin.

## ◆ cors_origin

const char* soap::cors_origin

The CORS Access-Control-Allow-Origin HTTP header string value received or the user-definable value to be returned by the server when set.

See also
  soap::origin.

## ◆ count

* Message length counter value of the message received and counter value of the HTTP content length header to send a message ULONG64 soap::count

See also
  soap_begin_count, soap_end_count, #SOAP_IO_LENGTH, #SOAP_IO_CHUNK.

## ◆ ctx

SSL_CTX* soap::ctx

OpenSSL context pointer.

This pointer is non-NULL after calling soap_ssl_server_context or soap_ssl_client_context and points to the OpenSSL context which can be configured with OpenSSL API functions such as SSL_CTX_set_cipher_list.

Note
  Requires compilation with #WITH_OPENSSL.

See also
  soap_ssl_server_context, soap_ssl_client_context.

## ◆ dime

* DIME attachments received struct soap_dime soap::dime

This structure contains a linked list of DIME attachments received.

## ◆ dime_id_format

const char* soap::dime_id_format

User-definable long double floating point format string (NULL by default and defined by the long_double.c custom serializer, the printed format must not exceed 1023 bytes).

Example:

#include "soapH.h"
struct soap *soap = soap_new();
soap->float_format = "%g";
soap->double_format = "%g";
soap->long_double_format = "%Lg";

Note
  Requires #import "custom/long_double.h" in the .h file for soapcpp2 to generate code that supports long double and compiling <i>gsoap/custom/long_double.c</i> to serialize long double. */ const char *long_double_format; User-definable format string to generate DIME content IDs /** The DIME ID format string should contain exactly one d or x` field and no other fields. The default format string is "cid:id%d". Should not be changed unless required by protocol updates.

## ◆ dom

* DOM tree received struct soap_dom_element* soap::dom

This pointer points to the DOM tree received when #SOAP_XML_DOM mode is enabled and the engine is configured with #WITH_DOM.

See also
  #WITH_DOM, #SOAP_XML_DOM.

## ◆ double_format

const char* soap::double_format

User-definable double floating point format string (%.17lG by default, the printed format must not exceed 1023 bytes).

Example:

#include "soapH.h"
struct soap *soap = soap_new();
soap->float_format = "%g";
soap->double_format = "%g";
soap->long_double_format = "%Lg";

## ◆ encodingStyle

const char* soap::encodingStyle

User-definable SOAP-ENV:encodingStyle URI value.

This URI string value is pre-defined by the engine depending on the SOAP protocol version used, setting this to NULL means no SOAP encodingStyle. Setting this to an empty string "" means that the engine will set the encodingStyle URI according to the SOAP version used. However, the encodingStyle is always set if the interface header file for soappcpp2 explicitly specifies an encoding or literal.

See also
  soap::version, ::soap_set_version.

## ◆ endpoint

char soap::endpoint[SOAP_TAGLEN]

The endpoint URL as received on the server side.

On the server side, the URL endpoint string is extracted from the HTTP header by soap::fparse called by soap_begin_recv and consists of the concatenated string of soap::host, soap::port, and soap::path to form a valid URL.

See also
  soap::ip, soap::ip6, soap::host, soap::port, soap::path, soap_query.

## ◆ errnum

int soap::errnum

The errno value of the last failed IO operation.

The soap::errnum value is set to the value or errno when a #SOAP_EOF or #SOAP_TCP_ERROR error occurred. This allows for reporting the error condition with soap_print_fault, soap_stream_fault, and soap_sprint_fault. For the #SOAP_EOF error, soap::errnum is set to zero when IO operations timed out, when a client's connection attempt to a server timed out, or when a server-side ::soap_accept timed out.

See also
  soap::error, soap::connect_timeout, soap::accept_timeout, soap::recv_timeout, soap::send_timeout.

## ◆ error

int soap::error

The soap context soap_status (int) error code of the last operation or #SOAP_OK (zero).

See also
  soap_status, soap::errnum.

## ◆ fault

struct SOAP_ENV__Fault* soap::fault

The soap::fault points to a SOAP_ENV__Fault structure with the SOAP Fault that was received or that can be populated by the user to be sent, or NULL when no SOAP Fault is present.

## ◆ float_format

const char* soap::float_format

User-definable floating point format string (%.9G by default, the printed format must not exceed 1023 bytes).

Example:

#include "soapH.h"
struct soap *soap = soap_new();
soap->float_format = "%g";
soap->double_format = "%g";
soap->long_double_format = "%Lg";

## ◆ forms

* Callback to implement logic at the server side to handle HTML soap::forms

## ◆ header

struct SOAP_ENV__Header* soap::header

The soap::header points to a SOAP_ENV__Header structure with the SOAP Header that was received or that can be populated by the user to be sent, or NULL when no SOAP Header is present.

Example:

#include "soapH.h"
struct soap *soap = soap_new();
... // context initializations
// add a SOAP Header to the message
SOAP_ENV__Header header;
header->ns__someHeaderValue = 123;
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
{
soap_print_fault(soap, stderr);
}
else
{
if (soap->header) // received a SOAP_ENV__Header?
... // yes, inspect SOAP_ENV__Header headers
}
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

See also
  SOAP_ENV__Header, soap::actor.

## ◆ host

char soap::host[SOAP_TAGLEN]

The host IP address of the client, as received on the server side.

On the server side, the host string is the IPv4 or IPv6 address, depending on #WITH_IPV6. On the client side, the host string is extracted from soap::endpoint, i.e. the endpoint URL of the server.

See also
  soap::ip, soap::ip6, soap::endpoint, soap::port, soap::path, soap_query.

## ◆ http_content

const char* soap::http_content

String with HTTP content type header value received, can also be assigned to specify a content type header for soap_connect_command with #SOAP_POST_FILE, #SOAP_PUT and #SOAP_PATCH or for soap_response with #SOAP_FILE or for soap_PUT, soap_PATCH, soap_POST. The soap::http_content string is reset to NULL after each HTTP invocation and has to be set again when required.

See also
  soap_connect_command, soap_PUT, soap_PATCH, soap_POST, soap_response.

## ◆ http_extra_header

const char* soap::http_extra_header

User-definable string that specifies an extra HTTP header or multiple HTTP headers when separated by CRLF in the specified string, to include in the next HTTP request (client side) or to include with the HTTP response (server side). The specified headre or headers are checked by the engine to conform to HTTP header formats or otherwise will be ignored and not output.

Examples:

#include "soapH.h"
struct soap *soap = soap_new();
... // context initializations
soap->http_extra_header = "X-CUSTOM-RequestMessageNumber: 1\r\nX-CUSTOM-TotalRequests: 5";
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
if (soap_ssl_server_context(soap, ...))
exit(EXIT_FAILURE);
... // serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve
}
int ns__webmethod(struct soap *soap, ...)
{
... // process the request data and populate the response data
soap->http_extra_header = "X-CUSTOM-ResponseMessageNumber: 1";
return SOAP_OK;
}
soap::http_extra_header
const char * http_extra_header
User-definable string that specifies an extra HTTP header or multiple HTTP headers when separated by ...
Definition stdsoap2.h:3143

See also
  soap_GET, soap_PUT, soap_PATCH, soap_POST, soap_DELETE, soap::fparsehdr.

## ◆ imode

soap_mode soap::imode

The soap context input soap_mode flags that are set at context initialization and set or cleared with soap_set_imode or soap_clr_imode, respectively.

See also
  soap::omode, soap_set_omode, soap_set_mode, soap_clr_omode, soap_clr_mode.

## ◆ ip

unsigned int soap::ip

The IPv4 address in numeric form of the client as received on the server side by ::soap_accept (or the C++ service class accept method), possibly set to zero when #WITH_IPV6 is used.

Example:

#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
soap->accept_timeout = 3600; // exit loop when no request arrives in one hour
... // context initializations
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG)))
{
while (1)
{
if (soap_valid_socket(soap_accept(soap)))
{
printf("Client host = %s port = %d path = %s ip = %d.%d.%d.%d\n", soap->host, soap->port, soap->path, soap->ip >> 24, (soap->ip >> 16) & 0xFF, (soap->ip >> 8) & 0xFF, soap->ip & 0xFF);
if (soap_serve(soap))
soap_print_fault(soap, stderr);
}
else if (soap->errnum) // accept failed, try again after 1 second
{
soap_print_fault(soap, stderr);
sleep(1);
}
else // accept timed out, quit looping
{
break;
}
soap_destroy(soap);
soap_end(soap);
}
}
soap_free(soap);
}

See also
  soap::host, soap::port, soap::ip6, ::soap_bind, ::soap_accept, soap_ssl_accept, soap_serve.

## ◆ ip6

unsigned int soap::ip6[4]

The IPv6 address in numeric form (upper ip6[0] to lower ip6[3]) of the client as received on the server side by ::soap_accept (or the C++ service class accept method), requires #WITH_IPV6.

Example:

#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
soap->accept_timeout = 3600; // exit loop when no request arrives in one hour
... // context initializations
if (soap_valid_socket(soap_bind(soap, NULL, PORTNUM, BACKLOG)))
{
while (1)
{
if (soap_valid_socket(soap_accept(soap)))
{
printf("Client host = %s port = %d path = %s ", soap->host, soap->port, soap->path);
if (soap->ip)
printf("ip4 = %d.%d.%d.%d\n", soap->ip >> 24, (soap->ip >> 16) & 0xFF, (soap->ip >> 8) & 0xFF, soap->ip & 0xFF);
else
printf("ip6 = %.8x%.8x%.8x%.8x\n", soap->ip6[0], soap->ip6[1], soap->ip6[2], soap->ip6[3]);
if (soap_serve(soap))
soap_print_fault(soap, stderr);
}
else if (soap->errnum) // accept failed, try again after 1 second
{
soap_print_fault(soap, stderr);
sleep(1);
}
else // accept timed out, quit looping
{
break;
}
soap_destroy(soap);
soap_end(soap);
}
}
soap_free(soap);
}

Note
  Requires compilation with #WITH_IPV6 or #WITH_IPV6_V6ONLY.

See also
  soap::host, soap::port, soap::ip, ::soap_bind, ::soap_accept, soap_ssl_accept, soap_serve.

## ◆ ipv4_multicast_if

char* soap::ipv4_multicast_if

User-definable value to set setsockopt level IPPROTO_IP to IP_MULTICAST_IF when non-NULL.

This value is used by the engine for UDP multicast messaging at the client side, sets setsockopt level IPPROTO_IP to IP_MULTICAST_IF with value soap::ipv4_multicast_if when non-NULL.

See also
  #WITH_IPV6, #SOAP_IO_UDP, soap::ipv6_multicast_if, soap::ipv4_multicast_ttl.

## ◆ ipv4_multicast_ttl

unsigned char soap::ipv4_multicast_ttl

User-definable value to set setsockopt level IPPROTO_IP to IP_MULTICAST_TTL when nonzero.

This value is used by the engine for UDP multicast messaging at the client side, sets setsockopt level IPPROTO_IP to IP_MULTICAST_TTL with value soap::ipv4_multicast_ttl when nonzero. Requires #WITH_IPV6.

Example:

struct soap *soap = soap_new();
in_addr_t addr = inet_addr("1.2.3.4"); // optional
soap->send_timeout = 5; // 5 seconds max socket delay
soap->connect_flags = SO_BROADCAST; // required for broadcast
soap->ipv4_multicast_if = &addr; // optional for IPv4, see setsockopt IPPROTO_IP IP_MULTICAST_IF
soap->ipv6_multicast_if = addr; // optional for IPv6 (requires WITH_IPV6), multicast sin6_scope_id
soap->ipv4_multicast_ttl = 1; // optional, see setsockopt IPPROTO_IP, IP_MULTICAST_TTL

Refer to the socket options for IPPROTO_IP IP_MULTICAST_TTL to limit the lifetime of the packet. Multicast datagrams are sent with a default value of 1, to prevent them to be forwarded beyond the local network. This parameter can be set between 1 to 255.

See also
  #WITH_IPV6, #SOAP_IO_UDP, soap::ipv6_multicast_if, soap::ipv4_multicast_if.

## ◆ ipv6_multicast_if

unsigned int soap::ipv6_multicast_if

User-definable value to set sockaddr_in6::sin6_scope_id when nonzero.

This value is used by the engine for UDP multicast messaging at the client side, sets sockaddr_in6::sin6_scope_id to soap::ipv6_multicast_if when nonzero. Requires #WITH_IPV6.

See also
  #WITH_IPV6, #SOAP_IO_UDP, soap::ipv4_multicast_if, soap::ipv4_multicast_ttl.

## ◆ is

SOAP_SOURCE* soap::is

The source to read data from when non-NULL, which in C++ is a std::istream object and in C is a 0-terminated string to be read, default value is NULL.

Examples:

// C example
#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
soap->is = "<ns:someElement xmlns:ns="urn:example"><text>example</text></ns:someElement>\n";
// parse and deserialize XML into a ns__someElement structure
if (soap_read_ns__someElement(soap, &data))
... // an error occurred
soap->is = NULL;
SOAP_DOM_TREE
#define SOAP_DOM_TREE
soap_mode DOM input flag value to ignore id and xsi:type XML attributes and disables deserialization ...
Definition stdsoap2.h:2249
// C++ example
#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
std::stringstream ss("<ns:someElement xmlns:ns="urn:example"><text>example</text></ns:someElement>\n");
soap->is = &ss;
// parse and deserialize XML into a ns__someElement structure
if (soap_read_ns__someElement(soap, &data))
... // an error occurred
soap->is = NULL;

## ◆ keep_alive

int soap::keep_alive

HTTP keep-alive flag (try to enable when -1, disabled when 0) and counter (enabled when >0).

See also
  #SOAP_IO_KEEPALIVE, soap_serve, ::soap_closesock, soap::max_keep_alive.

## ◆ lang

const char* soap::lang

User-definable xml:lang attribute value of SOAP-ENV:Text to output the SOAP Fault string/reason (the value is en by default).

See also
  SOAP_ENV__Reason.

## ◆ length

* The HTTP content length header value received or when HTTP transfer encoding is chunked ULONG64 soap::length

## ◆ lines

* Internal buffer to hold short URLs and HTTP MIME header soap::lines

## ◆ linger_time

unsigned short soap::linger_time

User-definable linger time value, requires the SO_LINGER setsockopt flag value to be assigned to soap::socket_flags.

Example:

struct soap *soap = soap_new();
soap->connect_flags = SO_LINGER;
soap->linger_time = 5;

## ◆ master

SOAP_SOCKET soap::master

The socket set by ::soap_bind (or the C++ service class bind method) to serve as the master socket bound to a specified port, or #SOAP_INVALID_SOCKET when unassigned.

See also
  ::soap_bind, soap_valid_socket.

## ◆ max_keep_alive

int soap::max_keep_alive

User-definable maximum number of keep-alive message exchanges per connection (the value is #SOAP_MAXKEEPALIVE by default).

Example:

struct soap *soap = soap_new1(SOAP_IO_KEEPALIVE); // enable HTTP keep-alive
soap->max_keep_alive = 50; // 50 max keep-alive exchanges (SOAP_MAXKEEPALIVE by default)
SOAP_IO_KEEPALIVE
#define SOAP_IO_KEEPALIVE
soap_mode IO input and output flag value to keep the socket connection alive for #SOAP_MAXKEEPALIVE m...
Definition stdsoap2.h:1732

See also
  #SOAP_IO_KEEPALIVE, soap_serve, soap::keep_alive.

## ◆ maxlength

long soap::maxlength

User-definable maximum string length parsed from XML and JSON, initially set to #SOAP_MAXLENGTH, zero or negative means unlimited (0 by default).

The length of a string is the number of characters it contains. Multi-byte strings with UTF-8 content (enabled with #SOAP_C_UTFSTRING) contain up to the specified number of multi-byte characters. The byte length depends on the UTF-8 encoding. The specified limit applies to strings that are not subject to string length schema validation constraints, to ensure that schema validation is not affected.

Example:

struct soap *soap = soap_new();
soap->maxlength = 256; // limit string lengths to 256 characters (unlimited by default)

See also
  soap::recv_maxlength, soap::maxlevel, soap::maxoccurs.

## ◆ maxlevel

unsigned int soap::maxlevel

User-definable maximum XML and JSON nesting level permitted, initially set to #SOAP_MAXLEVEL (the value is 10000 by default).

Example:

struct soap *soap = soap_new();
soap->maxlevel = 10; // limit XML nesting depth to 10 (10000 by default)

See also
  soap::recv_maxlength, soap::maxlength, soap::maxoccurs.

## ◆ maxoccurs

size_t soap::maxoccurs

User-definable maximum array and container size (maximum item occurrence constraint) as parsed from XML and JSON, except when specifie XML schema validation constraints permit greater sizes, initially set to #SOAP_MAXOCCURS (the value is 100000 by default).

The specified occurrence limit applies to arrays and containers that are not subject to occurrence validation constraints (minOccurs and maxOccurs, to ensure that schema validation is not affected.

Example:

struct soap *soap = soap_new();
soap->maxoccurs = 100; // limit arrays and containers to 100 items (100000 by default)

See also
  soap::recv_maxlength, soap::maxlevel, soap::maxlength.

## ◆ messages

* Internal buffer to hold short soap::messages

## ◆ mime

* MIME attachments received struct soap_mime soap::mime

This structure contains a linked list of MIME attachments received.

## ◆ msgbuf

* Internal buffer to hold short URLs and HTTP MIME header must have at least char soap::msgbuf[SOAP_TMPLEN]

## ◆ mustUnderstand

short soap::mustUnderstand

The soap::mustUnderstand flag is set when a SOAP Header element carries a SOAP-ENV:mustUnderstand attribute that is true.

## ◆ names

* Internal buffer to hold temporary strings such as string representations of primitive XML tag soap::names

## ◆ ntlm_challenge

const char* soap::ntlm_challenge

User-definable NTLM authentication challenge key string.

Examples:

#include "soapH.h"
struct soap *soap = soap_new();
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...) == 401) // Unauthorized, got soap->authrealm with NTLM domain
{
soap->userid = "user-id"; // NTLM auth credential
soap->passwd = "user-pw"; // NTLM auth credential
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...)) // try again
soap_print_fault(soap, stderr);
else
... // success
}
else
{
... // success
}
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
#include "soapH.h"
struct soap *soap = soap_new();
soap->ntlm_challenge = ""; // pretend we've been challenged
soap->userid = "user-id"; // NTLM credential
soap->passwd = "user-pw"; // NTLM credential
soap->authrealm = "server-domain"; // NTLM domain
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

Note
  Requires compilation with #WITH_NTLM and linking libntlm available at http://www.nongnu.org/libntlm for non-Windows platforms.

See also
  soap::bearer, soap::userid, soap::passwd, soap::proxy_userid, soap::proxy_passwd.

## ◆ null

short soap::null

The soap::null flag is set when an element carries a xsi:nil attribute that is true.

## ◆ omode

soap_mode soap::omode

The soap context output soap_mode flags that are set at context initialization and set or cleared with soap_set_omode or soap_clr_omode, respectively.

See also
  soap::imode, soap_set_omode, soap_set_mode, soap_clr_omode, soap_clr_mode.

## ◆ on

* Internal buffer to hold temporary strings such as string representations of primitive XML tag HTTP header lines and so soap::on

## ◆ origin

const char* soap::origin

The CORS Origin HTTP header string value received.

CORS is automatic at the server side. The server internally calls the soap::fopt callback to serve the OPTION method CORS request, which returns HTTP 200 OK with CORS headers. The default value of the CORS Access-Control-Allow-Origin header is "*".

At the client side, CORS requires the HTTP OPTIONS method with CORS headers. Use the following code to send HTTP OPTIONS with CORS headers to a server:

#include "soapH.h"
struct soap *soap = soap_new();
soap->origin = "http://example.com";
soap->cors_method = "POST"; // request method is POST
soap->cors_header = "..."; // list of comma-separated request headers (may be omitted)
if (soap_connect_command(soap, SOAP_OPTIONS, endpoint, NULL)
|| soap_end_send(soap)
|| soap_recv_empty_response(soap))
soap_print_fault(soap, stderr);
else if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_connect_command
*Connect to a server int soap_connect_command(struct soap *soap, soap_http_command http_command, const char *endpoint, const char *action) * @returns `
soap_recv_empty_response
*Receive an HTTP response message from the server that is assumed to be empty int soap_recv_empty_response(struct soap *soap) * @returns `
SOAP_OPTIONS
#define SOAP_OPTIONS
Definition stdsoap2.h:7018
soap_end_send
*Finalize the context after sending int soap_end_send(struct soap *soap) * @returns `

See also
  soap::cors_origin, soap::cors_allow, soap::cors_method, soap::cors_header, soap::cors_methods, soap::cors_header.

## ◆ os

SOAP_SINK* soap::os

The sink to write data to when non-NULL, which in C++ is a std::ostream object and in C is a pointer to a char* string variable that will be set to point to a managed 0-terminated string with the data, default value is NULL.

Examples:

// C example
#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
char *cs = NULL;
... // populate the data
soap->os = &cs;
// serialize ns__someElement structure as XML
if (soap_write_ns__someElement(soap, &data))
... // an error occurred
soap->os = NULL;
const char *xml = cs; // string allocated and managed by the context
// C++ example
#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
... // populate the data
std::stringstream ss;
soap->os = &ss;
// serialize ns__someElement structure as XML
if (soap_write_ns__someElement(soap, &data))
... // an error occurred
soap->os = NULL;
std::string xml = ss.str();

## ◆ override_host

const char* soap::override_host

User-definable string to override the host name or IP address in the HTTP header when connecting at the client side.

Example:

#include "soapH.h"
struct soap *soap = soap_new1(SOAP_IO_CHUNK);
... // initializations
soap->override_host = "server-domain-or-IP";
soap->override_port = 1234;
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
SOAP_IO_CHUNK
#define SOAP_IO_CHUNK
soap_mode IO output flag value to send HTTP chunked messages, buffers the message in packets of size ...
Definition stdsoap2.h:1672

See also
  soap::override_port.

## ◆ override_port

int soap::override_port

User-definable port number to override the port address in the HTTP header when connecting at the client side.

See also
  soap::override_host.

## ◆ passwd

const char* soap::passwd

User-definable HTTP and NTLM authorization password string required for HTTP basic and NTLM authentication by the client, server side receives this string when the client uses HTTP basic authentication.

See also
  soap::userid, soap::authrealm.

## ◆ path

char soap::path[SOAP_TAGLEN]

The client request path as received on the server side.

The URL path string is extracted from the HTTP header by soap::fparse called by soap_begin_recv and starts with a "/".

See also
  soap::ip, soap::ip6, soap::endpoint, soap::host, soap::port, soap_query.

## ◆ port

int soap::port

The client port connected to as received on the server side by ::soap_accept (or the C++ service class accept method).

See also
  soap::ip, soap::ip6.

## ◆ prolog

const char* soap::prolog

User-definable XML declaration prolog (<?xml version="1.0" encoding="UTF-8"?> by default).

## ◆ proxy_from

const char* soap::proxy_from

The X-Forwarding-For HTTP header string value received.

## ◆ proxy_host

const char* soap::proxy_host

User-definable proxy host name string which should be set to connect through an HTTP proxy.

Example:

#include "soapH.h"
struct soap *soap = soap_new();
soap->proxy_host = "proxy-domain-or-IP";
soap->proxy_port = 3128;
soap->proxy_userid = "proxy-id";
soap->proxy_passwd = "proxy-pw";
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);

See also
  soap::bearer, soap::userid, soap::passwd, soap::ntlm_challenge, soap::http_extra_header, and the HTTP digest plugin documentation.

## ◆ proxy_passwd

const char* soap::proxy_passwd

User-definable proxy authorization password string to authenticate and connect to an HTTP proxy.

See also
  soap::proxy_host.

## ◆ proxy_port

int soap::proxy_port

User-definable proxy port which should be set to connect through an HTTP proxy (the value is 8080 by default).

See also
  soap::proxy_host.

## ◆ proxy_userid

const char* soap::proxy_userid

User-definable proxy authorization user id string to authenticate and connect to an HTTP proxy.

See also
  soap::proxy_host.

## ◆ rcvbuf

int soap::rcvbuf

User-definable value to set SO_RCVBUF setsockopt (the value is #SOAP_BUFLEN by default).

Example:

struct soap *soap = soap_new();
soap->rcvbuf = 32768; // setsockopt SO_RCVBUF size

## ◆ recv_maxlength

ULONG64 soap::recv_maxlength

User-definable maximum message length that is permitted to be received, zero means unlimited (the value is 2GB by default).

Example:

struct soap *soap = soap_new();
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)

## ◆ recv_timeout

int soap::recv_timeout

User-definable timeout to receive a packet of data, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)

See also
  soap::error, soap::errnum, soap::connect_timeout, soap::accept_timeout, soap::send_timeout, soap::transfer_timeout, soap::recv_maxlength.

## ◆ recvfd

int soap::recvfd

The file descriptor to read data from when no socket communications are set (soap::socket == #SOAP_INVALID_SOCKET) and soap:is == NULL, default value is 0 (stdin).

Example:

#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
if ((soap->recvfd = open("doc.xml", O_RDONLY)) == 0)
... // an error occurred
// parse and deserialize XML into a ns__someElement structure
if (soap_read_ns__someElement(soap, &data))
... // an error occurred
close(soap->recvfd);
soap->recvfd = 0;

## ◆ send_timeout

int soap::send_timeout

User-definable timeout to send a packet of data, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)

See also
  soap::error, soap::errnum, soap::connect_timeout, soap::accept_timeout, soap::recv_timeout, soap::transfer_timeout, soap::recv_maxlength.

## ◆ sendfd

int soap::sendfd

The file descriptor to write data to when no socket communications are set (soap::socket == #SOAP_INVALID_SOCKET) and soap:os == NULL, default value is 1 (stdout).

Example:

#include "soapH.h"
struct soap *soap = soap_new1(SOAP_DOM_TREE);
struct ns__someElement data;
... // populate the data
if ((soap->sendfd = open("doc.xml", O_CREAT | O_RDWR, 0644)) == 0)
... // an error occurred
// serialize ns__someElement structure as XML
if (soap_write_ns__someElement(soap, &data))
... // an error occurred
close(soap->sendfd);
soap->sendfd = 1;

## ◆ sent

* Internal buffer with partial data received or partial data to be soap::sent

## ◆ sndbuf

int soap::sndbuf

User-definable value to set SO_SNDBUF setsockopt (the value is #SOAP_BUFLEN by default).

Example:

struct soap *soap = soap_new();
soap->sndbuf = 32768; // setsockopt SO_SNDBUF size

## ◆ socket [1/2]

* Callback that blocks until activity is detected on the ::soap::socket or ::soap::master soap::socket

## ◆ socket [2/2]

SOAP_SOCKET soap::socket

The socket set by ::soap_accept (or the C++ service class accept method) or ::soap_connect or soap_connect_command (or the C++ proxy methods) when successful, or #SOAP_INVALID_SOCKET when unassigned.

See also
  ::soap_accept, ::soap_connect, soap_connect_command, soap_valid_socket.

## ◆ socket_flags

int soap::socket_flags

User-definable socket send and recv flags, for example assign MSG_NOSIGNAL to disable sigpipe (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->socket_flags = MSG_NOSIGNAL; // no sigpipe (this is not portable)

Other ways to disable sigpipe:

struct soap *soap = soap_new();
soap->connect_flags = SO_NOSIGPIPE;
soap->bind_flags = SO_NOSIGPIPE;
#include <signal.h>
void sigpipe_handle(int) { }
signal(SIGPIPE, sigpipe_handle);

See also
  soap::connect_flags, soap::bind_flags, soap::accept_flags.

## ◆ status

int soap::status

The soap context HTTP status code received at the client side (100 to 599), HTTP header method received at the server side (#SOAP_POST, #SOAP_PATCH, #SOAP_GET, #SOAP_PUT, #SOAP_DEL, #SOAP_HEAD, #SOAP_OPTIONS), or the HTTP method to use for sending a message with soap_connect_command or with soap_response (#SOAP_POST, #SOAP_POST_FILE, #SOAP_PATCH, #SOAP_GET, #SOAP_PUT, #SOAP_PUT, #SOAP_DEL, #SOAP_CONNECT, #SOAP_HEAD, #SOAP_OPTIONS).

See also
  soap_connect_command, soap_GET, soap_PUT, soap_PATCH, soap_POST, soap_DELETE, soap_response.

## ◆ store

*Callback to manage the verification of the certificate provided by a X509_STORE_CTX* soap::store

## ◆ tcp_keep_alive

int soap::tcp_keep_alive

User-definable value to set SO_KEEPALIVE setsockopt (0 by default unless the #SOAP_IO_KEEPALIVE mode flag is set).

Example:

struct soap *soap = soap_new();
soap->tcp_keep_alive = 1; // setsockopt SO_KEEPALIVE
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

HTTP keep-alive together with TCP SO_KEEPALIVE is enabled with:

struct soap *soap = soap_new1(SOAP_IO_KEEPALIVE); // enable HTTP keep-alive
soap->max_keep_alive = 50; // 50 max keep-alive exchanges for SOAP_IO_KEEPALIVE (SOAP_MAXKEEPALIVE by default)
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

See also
  #SOAP_IO_KEEPALIVE, soap::tcp_keep_idle, soap::tcp_keep_intvl and soap::tcp_keep_cnt.

## ◆ tcp_keep_cnt

unsigned int soap::tcp_keep_cnt

User-definable value to set TCP_KEEPCNT setsockopt (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->tcp_keep_alive = 1; // setsockopt SO_KEEPALIVE
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

HTTP keep-alive with TCP SO_KEEPALIVE is enabled with:

struct soap *soap = soap_new1(SOAP_IO_KEEPALIVE); // enable HTTP keep-alive
soap->max_keep_alive = 50; // 50 max keep-alive exchanges (SOAP_MAXKEEPALIVE by default)
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

See also
  soap::tcp_keep_alive, soap::tcp_keep_idle and soap::tcp_keep_intvl.

## ◆ tcp_keep_idle

unsigned int soap::tcp_keep_idle

User-definable value to set TCP_KEEPIDLE setsockopt (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->tcp_keep_alive = 1; // setsockopt SO_KEEPALIVE
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

HTTP keep-alive with TCP SO_KEEPALIVE is enabled with:

struct soap *soap = soap_new1(SOAP_IO_KEEPALIVE); // enable HTTP keep-alive
soap->max_keep_alive = 50; // 50 max keep-alive exchanges (SOAP_MAXKEEPALIVE by default)
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

See also
  soap::tcp_keep_alive, soap::tcp_keep_intvl and soap::tcp_keep_cnt.

## ◆ tcp_keep_intvl

unsigned int soap::tcp_keep_intvl

User-definable value to set TCP_KEEPINTVL setsockopt (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->tcp_keep_alive = 1; // setsockopt SO_KEEPALIVE
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

HTTP keep-alive with TCP SO_KEEPALIVE is enabled with:

struct soap *soap = soap_new1(SOAP_IO_KEEPALIVE); // enable HTTP keep-alive
soap->max_keep_alive = 50; // 50 max keep-alive exchanges (SOAP_MAXKEEPALIVE by default)
soap->tcp_keep_idle = 30; // time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
soap->tcp_keep_intvl = 120; // time in seconds between individual keepalive probes
soap->tcp_keep_cnt = 5; // maximum number of keepalive probes TCP should send before dropping the connection

See also
  soap::tcp_keep_alive, soap::tcp_keep_idle and soap::tcp_keep_cnt.

## ◆ tmpbuf

* Internal buffer to hold temporary strings such as string representations of primitive XML tag HTTP header lines and so must have at least char soap::tmpbuf[SOAP_TMPLEN]

## ◆ transfer_timeout

int soap::transfer_timeout

User-definable timeout to send or receive an entire message, positive timeout values are seconds, negative timeout values are microseconds, zero means no timeout (the value is 0 by default).

Example:

struct soap *soap = soap_new();
soap->send_timeout = soap_recv_timeout = 5; // 5 seconds max socket stall time (unlimited by default)
soap->transfer_timeout = 30; // 30 seconds max message transfer time (unlimited by default)
soap->recv_maxlength = 1048576; // limit messages received to 1MB (2GB by default)

See also
  soap::error, soap::errnum, soap::connect_timeout, soap::accept_timeout, soap::recv_timeout, soap::send_timeout, soap::recv_maxlength.

## ◆ user

void* soap::user

User-definable variable that may point to user-specified data of any type to pass the data through to callbacks and plugins.

## ◆ userid

const char* soap::userid

User-definable HTTP and NTLM authorization user id string for HTTP basic and NTLM authentication by the client, server side receives this string when the client uses HTTP basic authentication, for HTTP digest authentication see the gSOAP HTTP digest authentication plugin.

Examples:

#include "soapH.h"
struct soap *soap = soap_new();
if (soap_ssl_client_context(soap, ...))
exit(EXIT_FAILURE);
soap->userid = "user-id"; // HTTP basic auth credential
soap->passwd = "user-pw"; // HTTP basic auth credential
soap->authrealm = "server-domain"; // if known in advance, see example below
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...))
soap_print_fault(soap, stderr);
else
... // success
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
#include "soapH.h"
struct soap *soap = soap_new();
if (soap_ssl_client_context(soap, ...))
exit(EXIT_FAILURE);
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...) == 401) // Unauthorized, got soap->authrealm
{
soap->userid = "user-id"; // HTTP basic auth credential
soap->passwd = "user-pw"; // HTTP basic auth credential
if (soap_call_ns__webmethod(soap, endpoint, NULL, ...)) // try again
soap_print_fault(soap, stderr);
else
... // success
}
else
{
... // success
}
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
#include "soapH.h"
int main()
{
struct soap *soap = soap_new();
if (soap_ssl_server_context(soap, ...))
exit(EXIT_FAILURE);
... // serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve
}
int ns__webmethod(struct soap *soap, ...)
{
if (!soap->userid ||
!soap->passwd ||
!soap->authrealm ||
strcmp(soap->userid, "user-id") ||
strcmp(soap->passwd, "user-pw") ||
strcmp(soap->authrealm, "server-domain"))
return 401; // Unauthorized
... // process the request data and populate the response data
return SOAP_OK;
}
soap::passwd
const char * passwd
User-definable HTTP and NTLM authorization password string required for HTTP basic and NTLM authentic...
Definition stdsoap2.h:3952
soap::userid
const char * userid
User-definable HTTP and NTLM authorization user id string for HTTP basic and NTLM authentication by t...
Definition stdsoap2.h:3947
soap::authrealm
const char * authrealm
The HTTP and NTLM authorization realm/domain string received by the client with the WWW-Authenticate ...
Definition stdsoap2.h:3957

See also
  soap::passwd, soap::authrealm, soap_ssl_client_context, soap::bearer, soap::ntlm_challenge, soap::http_extra_header, soap::proxy_userid, soap::proxy_passwd and the HTTP digest plugin documentation.

## ◆ values

* Internal buffer to hold temporary strings such as string representations of primitive soap::values

## ◆ version

short soap::version

SOAP version (0 = no SOAP, 1 = SOAP 1.1, 2 = SOAP 1.2).

The SOAP version is determined from the SOAP or XML message received. The version is automatically set before sending messages when SOAP 1.1 or SOAP 1.2 namespaces are defined in the Namespace table or when SOAP namespaces are omitted from the table. The version can be explicitly set or overruled by calling ::soap_set_version.

See also
  soap::encodingStyle, ::soap_set_version.

## ◆ z_level

unsigned short soap::z_level

User-definable compression level for gzip compression (0=none, 1=fast to 9=best) default level is 6.

See also
  #WITH_GZIP, #WITH_ZLIB, #SOAP_ENC_ZLIB, soap::z_ratio_in, soap::z_ratio_out.

## ◆ z_ratio_in

float soap::z_ratio_in

The compression ratio = compressed.size/uncompressed.size of the compressed message received.

See also
  #WITH_GZIP, #WITH_ZLIB, #SOAP_ENC_ZLIB, soap::z_level, soap::z_ratio_out.

## ◆ z_ratio_out

float soap::z_ratio_out

The compression ratio = compressed.size/uncompressed.size of the compressed message sent.

See also
  #WITH_GZIP, #WITH_ZLIB, #SOAP_ENC_ZLIB, soap::z_level, soap::z_ratio_in.