![]() |
Home | Documentation |
Callback functions
updated Fri Jan 17 2025 by Robert van Engelen
|
This module defines the callback functions of the soap context to modify its behavior, as is done by plugins. More...
Variables | |
int(* | soap::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 client-side to a connected HTTP server. | |
int(* | soap::fresponse )(struct soap *soap, int status, ULONG64 count) |
Callback that populates and then sends HTTP headers from the server-side to a connected client. | |
int(* | soap::fposthdr )(struct soap *soap, const char *key, const char *val) |
Callback that sends a single HTTP header given a key-value pair. | |
int(* | soap::fparse )(struct soap *soap) |
Callback that reads and parses HTTP and MIME headers. | |
int(* | soap::fparsehdr )(struct soap *soap, const char *key, const char *val) |
Callback that consumes an HTTP header that consists of a key-value pair. | |
int(* | soap::fget )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP GET requests from clients. | |
int(* | soap::fput )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP PUT requests from clients. | |
int(* | soap::fpatch )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP PATCH requests from clients. | |
int(* | soap::fdel )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP DELETE requests from clients. | |
int(* | soap::fopt )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP OPTION requests from clients. | |
int(* | soap::fhead )(struct soap *soap) |
Callback to implement logic at the server-side to serve responses to HTTP HEAD requests from clients. | |
int(* | soap::fform )(struct soap *soap) |
Callback to implement logic at the server-side to handle HTML forms, such as done by the callbacks provided by the HTTP FORM handler plugin. | |
int(* | soap::fheader )(struct soap *soap) |
Callback to inspect the SOAP Header received before the rest of the message with the SOAP Body is consumed. | |
int(* | soap::fencoding )(struct soap *soap, const char *encoding) |
Callback to catch unrecognized XML encoding formats. | |
int(* | soap::fignore )(struct soap *soap, const char *tag) |
Callback to catch unrecognized XML elements and overrides #SOAP_XML_STRICT validation errors for these. | |
int(* | soap::fsvalidate )(struct soap *soap, const char *pattern, const char *string) |
Callback to validate strings against XML regex patterns. | |
int(* | soap::fwvalidate )(struct soap *soap, const char *pattern, const wchar_t *string) |
Callback to validate wide strings against XML regex patterns. | |
void(* | soap::fseterror )(struct soap *soap, const char **faultcode, const char **faultstring) |
Callback to inspect or override fault code or fault string messages. | |
SOAP_SOCKET(* | soap::fopen )(struct soap *soap, const char *endpoint, const char *host, int port) |
Callback that opens a socket connection to a server endpoint. | |
SOAP_SOCKET(* | soap::faccept )(struct soap *soap, SOAP_SOCKET sock, struct sockaddr *addr, int *len) |
Callback that waits for and accepts a socket connection requested by a client. | |
int(* | soap::fclose )(struct soap *soap) |
Callback that closes the current socket connection. | |
int(* | soap::fresolve )(struct soap *soap, const char *name, struct in_addr *inaddr) |
Callback that resolves a host name by address translation. | |
int(* | soap::fconnect )(struct soap *soap, const char *endpoint, const char *host, int port) |
Callback that overrides the client-side connecting operations. | |
int(* | soap::fdisconnect )(struct soap *soap) |
Callback that executes disconnect logic before closing. | |
int(* | soap::fclosesocket )(struct soap *soap, SOAP_SOCKET sock) |
Callback that closes a given socket. | |
int(* | soap::fshutdownsocket )(struct soap *soap, SOAP_SOCKET sock, int how) |
Callback that shuts down a given socket. | |
int(* | soap::fpoll )(struct soap *soap) |
Callback that blocks until activity is detected on the soap::socket or soap::master socket, times out when soap::send_timeout or soap::recv_timeout are set. | |
size_t(* | soap::frecv )(struct soap *soap, char *buf, size_t len) |
Callback that receives bytes of data into the given buffer. | |
int(* | soap::fsend )(struct soap *soap, const char *data, size_t len) |
Callback that sends the given bytes of data. | |
int(* | soap::fserveloop )(struct soap *soap) |
Callback executed by the engine at the server side immediately after a server operation successfully completed. | |
void *(* | soap::fmalloc )(struct soap *soap, size_t size) |
Callback to override dynamic memory allocation and management. | |
void *(* | soap::fdimereadopen )(struct soap *soap, void *handle, const char *id, const char *type, const char *options) |
Callback to open a streaming DIME attachment for reading. | |
size_t(* | soap::fdimeread )(struct soap *soap, void *handle, char *buf, size_t len) |
Callback to read data in a DIME attachment stream. | |
void(* | soap::fdimereadclose )(struct soap *soap, void *handle) |
Callback to close a DIME attachment stream after reading. | |
void *(* | soap::fdimewriteopen )(struct soap *soap, const char *id, const char *type, const char *options) |
Callback to open a streaming DIME attachment for writing. | |
int(* | soap::fdimewrite )(struct soap *soap, void *, const char *, size_t) |
Callback to write data in a DIME attachment stream. | |
void(* | soap::fdimewriteclose )(struct soap *soap, void *handle) |
Callback to close a DIME attachment stream after writing. | |
void *(* | soap::fmimereadopen )(struct soap *soap, void *, const char *, const char *, const char *) |
Callback to open a streaming MIME/MTOM attachment for reading. | |
size_t(* | soap::fmimeread )(struct soap *soap, void *handle, char *buf, size_t len) |
Callback to read data in a MIME/MTOM attachment stream. | |
void(* | soap::fmimereadclose )(struct soap *soap, void *handle) |
Callback to close a MIME/MTOM attachment stream after reading. | |
void *(* | soap::fmimewriteopen )(struct soap *soap, void *handle, const char *id, const char *type, const char *description, enum soap_mime_encoding encoding) |
Callback to open a streaming MIME/MTOM attachment for writing. | |
int(* | soap::fmimewrite )(struct soap *soap, void *handle, const char *buf, size_t len) |
Callback to write data in a MIME attachment stream. | |
void(* | soap::fmimewriteclose )(struct soap *soap, void *handle) |
Callback to close a MIME/MTOM attachment stream after writing. | |
int(* | soap::fsslauth )(struct soap *soap) |
Callback to initialize the OpenSSL library. | |
int(* | soap::fsslverify )(int ok, X509_STORE_CTX *store) |
Callback to manage the verification of the certificate provided by a peer (typically a server) |
This module defines the callback functions of the soap context to modify its behavior, as is done by plugins.
HTTP callbacks:
XML and SOAP callbacks:
Socket connection callbacks:
IO callbacks:
Server keep-alive loop callback:
Memory allocation callback:
Streaming DIME attachment callbacks:
Streaming MIME/MTOM attachment callbacks:
OpenSSL, GNUTLS and WolfSSL client-side SSL/TLS certificate verification callbacks:
To pass user-specified data to callbacks and plugins, assign a value to the soap::user variable of the context which can be accessed within the callback or plugin.
SOAP_SOCKET(* soap::faccept) (struct soap *soap, SOAP_SOCKET sock, struct sockaddr *addr, int *len) |
Callback that waits for and accepts a socket connection requested by a client.
This callback is called by soap_accept (or the C++ service class accept method) to wait for and accept a socket connection requested by a client. Returns a valid socket or #SOAP_INVALID_SOCKET when an error occurred and sets soap::error to a soap_status value. The built-in function assigned to soap::faccept is tcp_accept.
soap | soap context |
sock | master socket |
addr | points to a sockaddr structure to be populated |
len | points to the length of the sockaddr structure, the length may be reduced by the callback function with the actual size of the sockaddr structure populated |
Callback that closes the current socket connection.
This callback is called by the engine at the client-side to close the current socket connection before a new socket connection is established. This callback may be called multiple times (e.g. by the engine and by plugins) to close the same socket soap::socket. Checks internally if soap::socket == #SOAP_INVALID_SOCKET before closing, which means that the socket was already closed. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fclose is tcp_disconnect.
soap | soap context |
int(* soap::fclosesocket) (struct soap *soap, SOAP_SOCKET sock) |
Callback that closes a given socket.
This callback is called to close a socket by the engine. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fclosesocket is tcp_closesocket.
soap | soap context |
sock | socket to close |
Callback that overrides the client-side connecting operations.
This callback is called by the engine to optionally override client-side connecting. The parameters host and port were micro-parsed from the endpoint prior to passing them to this callback. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fconnect.
soap | soap context |
endpoint | URL of the endpoint connected to (string) |
host | URL host of the endpoint connected to (string) |
port | URL port of the endpoint connected to (int) |
Callback to implement logic at the server-side to serve responses to HTTP DELETE requests from clients.
This callback is called by the service dispatcher when an HTTP DELETE request is pending. Redefine this callback to respond to HTTP DELETE requests, see the http_post HTTP POST plugin for more details. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fdel is the internal static function http_del that returns the #SOAP_DEL_METHOD error.
soap | soap context |
Callback to read data in a DIME attachment stream.
This callback is called by the engine to read a chunk of attachment data to transmit. The handle parameter contains the handle returned by the soap::fdimereadopen callback. The buf parameter is the buffer of length len into which a chunk of data should be written by the callback. The actual amount of data written into the buffer may be less than len and this actual amount should be returned by the callback. A return value of zero indicates an error and soap::error should be set. The __size member variable of the attachment struct/class with data (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members) should be set by the application prior to the serialization of the message with attachments. The value of __size indicates the total size of the attachment data to be transmitted. If the __size member variable is zero and HTTP chunking is enabled (with #SOAP_IO_CHUNK), then DIME chunked transfers are activated by the engine, which is more flexible since the attachment data size does not need to be determined in adance. To use DIME chunked transfers, enable HTTP chunking with #SOAP_IO_CHUNK (also #SOAP_IO_STORE can be used, but this buffers the entire message in memory before transmission) and set the __size member variable of the attachment struct/class to zero. When DIME attachment chunking is enabled, this callback should completely fill the buf buffer with len bytes unless the last data chunk is reached and fewer bytes are returned.
See the example provided with the documentation for soap::fdimereadopen. To enable chunked DIME attachments, replace the last part of the example with:
soap | soap context |
handle | the value of the handle returned by soap::fdimereadopen |
buf | buffer to fill |
len | length of the buffer in bytes |
Callback to close a DIME attachment stream after reading.
This callback is called by the engine to close the DIME attachment stream after reading. The handle parameter contains the handle returned by the soap::fdimereadopen callback.
See the examples provided with the documentation for soap::fdimereadopen and soap::fdimeread.
soap | soap context |
handle | the value of the of the handle returned by soap::fdimereadopen |
void *(* soap::fdimereadopen) (struct soap *soap, void *handle, const char *id, const char *type, const char *options) |
Callback to open a streaming DIME attachment for reading.
This callback is called by the engine to start sending a streaming DIME attachment. This callback opens a stream to start reading the attachment data to send. The actual data stream will be read in chunks using the soap::fdimeread callback until no more data is available and the soap::fdimereadclose callback is called to close the stream. The handle parameter contains the value of the __ptr member variable of the attachment struct/class with data (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members), which should be a pointer to specific information such as a file descriptor or a pointer to a some application-specific data to be passed to this callback. Both the __ptr and __size members of the attachment struct/class should have been set by the application prior to the serialization of the message with attachments. If the __size is zero and HTTP chunking is enabled (with #SOAP_IO_CHUNK), then chunked DIME attachments are sent, see soap::fdimeread. The id, type and options parameters are the id (optional ID), type (a MIME type) and options (DIME options are set with soap_dime_option) of the attachment struct/class, respectively, of which at least one member should be non-NULL. The callback should return the handle parameter value or another pointer value, which is passed as the new handle parameter to soap::fdimeread and soap::fdimereadclose callbacks. When an error occurred in this callback, the callback should return NULL and set soap::error to an error code, e.g. using soap_receiver_fault. The callback may return NULL and set soap::error to #SOAP_OK when this specific DIME attachment should not to be streamed and the engine will simply skip it.
This mechanism also works for DIME attachments attached with soap_set_dime_attachment.
The maximum size of DIME attachments that the engine allows to be received is limited to #SOAP_MAXDIMESIZE. Increase this size as necessary.
soap | soap context |
handle | the value of the __ptr member variable of the attachment struct/class with data |
id | the value of the id member variable of the attachment struct/class with data |
type | the value of the type member variable of the attachment struct/class with data |
options | the value of the options member variable of the attachment struct/class with data |
Callback to write data in a DIME attachment stream.
This callback is called by the engine to write a chunk of attachment data received. The handle parameter contains the handle returned by the soap::fdimewriteopen callback. The buf parameter contains the data of length len. Returns #SOAP_OK or a soap_status (int) error code.
soap | soap context |
handle | the value of the handle returned by soap::fdimewriteopen |
Callback to close a DIME attachment stream after writing.
This callback is called by the engine to close the DIME attachment stream after writing. The handle parameter contains the handle returned by the soap::fdimewriteopen callback.
soap | soap context |
handle | the value of the of the handle returned by soap::fdimewriteopen |
void *(* soap::fdimewriteopen) (struct soap *soap, const char *id, const char *type, const char *options) |
Callback to open a streaming DIME attachment for writing.
Called by the to start receiving a streaming DIME attachment. This callback opens a stream to start writing the attachment data received. The actual data stream will be written in chunks using the soap::fdimewrite callback until no more data is available and the soap::fdimewriteclose callback is called to close the stream. The id, type and options parameters are the id, type and options of the attachment struct/class (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members), respectively. The callback should return a handle, which is passed to the soap::fdimewrite and soap::fdimewriteclose callbacks. The __ptr member variable of the attachment struct/class is set by the engine to the value of this handle. The __size member variable is set to the size of the attachment received. The maximum DIME attachment size received is limited by #SOAP_MAXDIMESIZE.
The maximum size of DIME attachments that the engine allows to be received is limited to #SOAP_MAXDIMESIZE. Increase this size as necessary.
soap | soap context |
id | the value of the id member variable of the attachment struct/class with data |
type | the value of the type member variable of the attachment struct/class with data |
options | the value of the options member variable of the attachment struct/class with data |
Callback that executes disconnect logic before closing.
This callback is called by the engine soap_closesock before the soap::fclose callback is called to shutdown/disconnect. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fdisconnect.
soap | soap context |
Callback to catch unrecognized XML encoding formats.
This callback is called when an unrecognized XML encoding format is encountered in an XML PI. Supported encoding formats are latin (ASCII) and UTF-8. Other encoding formats can be rejected or supported by setting this callback. To reject the encoding, return a nonzero error code. To accept the encoding without further action, return #SOAP_OK. To decode the encoding, the input stream should be redictected through a decoder, for example by overriding the soap::frecv callback with a specific handler to convert the encoding.
soap | soap context |
encoding | XML encoding extracted from the XML PI header |
Callback to implement logic at the server-side to handle HTML forms, such as done by the callbacks provided by the HTTP FORM handler plugin.
This callback is called by the HTTP FORM handler plugin to parse HTML forms received with HTTP POST and PUT requests, see the ;:http_form HTTP FORM plugin for more details. The HTTP body with the form data should be parsed by this callback, otherwise HTTP keep-alive messages will end up out of sync as a result of the current position not being advanced to the end of the HTTP body. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fform.
soap | soap context |
Callback to implement logic at the server-side to serve responses to HTTP GET requests from clients.
This callback is called by the service dispatcher when an HTTP GET request is pending. Redefine this callback to respond to HTTP GET requests with content, see the http_get HTTP GET plugin for more details. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fget is the internal static function http_get that returns the #SOAP_GET_METHOD error.
soap | soap context |
Callback to implement logic at the server-side to serve responses to HTTP HEAD requests from clients.
This callback is called by the service dispatcher when an HTTP HEAD request is pending. Redefine this callback to respond to HTTP HEAD requests more specifically. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fhead is the internal static function http_200 that returns HTTP 200 OK.
soap | soap context |
Callback to inspect the SOAP Header received before the rest of the message with the SOAP Body is consumed.
This callback is called immediately after parsing a SOAP Header into the soap::header structure. The SOAP Header structure soap::header can be inspected by this function and verified or rejected before the rest of the message with the SOAP Body is consumed. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fheader.
soap | soap context |
Callback to catch unrecognized XML elements and overrides #SOAP_XML_STRICT validation errors for these.
This callback is called when an unrecognized XML element was encountered on the input that could be ignored depending on some specified logic. The tag parameter is the offending XML element tag name string. The callback should return #SOAP_OK to ignore the element or return an soap_status error code such as #SOAP_TAG_MISMATCH to trigger a validation error. This callback also overrides mustUnderstand attributes on unrecognized SOAP Header elements that normally raise faults. It is strongly recommended that the callback returns #SOAP_MUSTUNDERSTAND when soap::mustUnderstand != 0. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fignore.
soap | soap context |
tag | XML tag name |
Callback to override dynamic memory allocation and management.
This callback can be used to override memory allocation and management done by soap_malloc in C. Memory allocated via this callback will not be managed and not be automatically released by the engine. Instead, the application using this callback should release allocated memory. All allocations done by soap_malloc are replaced with a call to soap::fmalloc. However, no other allocations, such as soap_new and soap_new_T for C++ classes, are affected. This callback is therefore not useful for C++ applications. Returns a pointer to dynamically allocated memory or NULL on failure to allocate. No built-in function is assigned to soap::fmalloc.
soap | soap context |
size | number of bytes to allocate |
Callback to read data in a MIME/MTOM attachment stream.
This callback is called by the engine to read a chunk of attachment data to transmit. The handle parameter contains the handle returned by the soap::fmimereadopen callback. The buf parameter is the buffer of length len into which a chunk of data should be written by the callback. The actual amount of data written into the buffer may be less than len and this actual amount should be returned by the callback. A return value of zero indicates an error and soap::error should be set. The __size member variable of the attachment struct/class with data (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members) should be set by the application prior to the serialization of the message with attachments. The value of __size indicates the total size of the attachment data to be transmitted. If the __size member variable is zero and HTTP chunking is enabled (with #SOAP_IO_CHUNK), then MIME/MTOM chunked transfers are activated by the engine, which is more flexible since the attachment data size does not need to be determined in advance. To use MIME/MTOM chunked transfers, enable HTTP chunking with #SOAP_IO_CHUNK (also #SOAP_IO_STORE can be used, but this buffers the entire message in memory before transmission) and set the __size member variable of the attachment struct/class to zero. When MIME/MTOM attachment chunking is enabled, this callback should completely fill the buf buffer with len bytes unless the last data chunk is reached and fewer bytes are returned.
See the example provided with the documentation for soap::fmimereadopen.
soap | soap context |
handle | the value of the handle returned by soap::fmimereadopen |
buf | buffer to fill |
len | length of the buffer in bytes |
Callback to close a MIME/MTOM attachment stream after reading.
This callback is called by the engine to close the MIME/MTOM attachment stream after reading. The handle parameter contains the handle returned by the soap::fmimereadopen callback.
See the example provided with the documentation for soap::fmimereadopen.
soap | soap context |
handle | the value of the of the handle returned by soap::fmimereadopen |
Callback to open a streaming MIME/MTOM attachment for reading.
This callback is called by the engine to start sending a streaming MIME/MTOM attachment. This callback opens a stream to start reading the attachment data to send. The actual data stream will be read in chunks using the soap::fmimeread callback until no more data is available and the soap::fmimereadclose callback is called to close the stream. The handle parameter contains the value of the __ptr member variable of the attachment struct/class with data (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members), which should be a pointer to specific information such as a file descriptor or a pointer to a some application-specific data to be passed to this callback. Both the __ptr and __size members of the attachment struct/class should have been set by the application prior to the serialization of the message with attachments. If the __size is zero and HTTP chunking is enabled (with #SOAP_IO_CHUNK), then chunked MIME/MTOM attachments are sent, see soap::fmimeread. The id, type and options parameters are the id (an optional ID), type (a MIME type) and options (a descriptive string) of the attachment struct/class, respectively, of which at least one member should be non-NULL. The callback should return the handle parameter value or another pointer value, which is passed as the new handle parameter to soap::fmimeread and soap::fmimereadclose callbacks. When an error occurred in this callback, the callback should return NULL and set soap::error to an error code, e.g. using soap_receiver_fault. The callback may return NULL and set soap::error to #SOAP_OK when this specific MIME/MTOM attachment should not to be streamed and the engine will simply skip it.
To enable chunked MIME/MTOM attachments, replace the last part of the example with:
This mechanism also works for MIME/MTOM attachments that are explicitly attached with soap_set_mime_attachment.
soap | soap context |
handle | the value of the __ptr member variable of the attachment struct/class with data |
id | the value of the id member variable of the attachment struct/class with data |
type | the value of the type member variable of the attachment struct/class with data |
options | the value of the options member variable of the attachment struct/class with data |
Callback to write data in a MIME attachment stream.
This callback is called by the engine to write a chunk of attachment data received. The handle parameter contains the handle returned by the soap::fmimewriteopen callback. The buf parameter contains the data of length len. Returns #SOAP_OK or a soap_status (int) error code.
soap | soap context |
handle | the value of the handle returned by soap::fmimewriteopen |
Callback to close a MIME/MTOM attachment stream after writing.
This callback is called by the engine to close the MIME/MTOM attachment stream after writing. The handle parameter contains the handle returned by the soap::fmimewriteopen callback.
soap | soap context |
handle | the value of the of the handle returned by soap::fmimewriteopen |
void *(* soap::fmimewriteopen) (struct soap *soap, void *handle, const char *id, const char *type, const char *description, enum soap_mime_encoding encoding) |
Callback to open a streaming MIME/MTOM attachment for writing.
Called by the to start receiving a streaming MIME/MTOM attachment. This callback opens a stream to start writing the attachment data received. The actual data stream will be written in chunks using the soap::fmimewrite callback until no more data is available and the soap::fmimewriteclose callback is called to close the stream. The id, type and options parameters are the id, type and options of the attachment struct/class (e.g. xsd__base64Binary or _xop__Include with __ptr, __size, id, type and options members), respectively. The callback should return a handle, which is passed to the soap::fmimewrite and soap::fmimewriteclose callbacks. The __ptr member variable of the attachment struct/class is set by the engine to the value of this handle. The __size member variable is set to the size of the attachment received.
soap | soap context |
id | the value of the id member variable of the attachment struct/class with data |
type | the value of the type member variable of the attachment struct/class with data |
options | the value of the options member variable of the attachment struct/class with data |
Callback that opens a socket connection to a server endpoint.
This callback is called by the engine at the client-side by soap_connect or soap_connect_command to open a TCP or UDP connection to a server specified at an endpoint. Parameters host and port are micro-parsed from endpoint before being passed to soap::fopen. Returns a valid socket or #SOAP_INVALID_SOCKET with a soap::error set to a soap_status (int) error code and soap::errnum set to errno of the connection failure. The built-in function assigned to soap::fopen is tcp_connect.
soap | soap context |
endpoint | URL of the endpoint to connect to (string) |
host | URL host of the endpoint to connect to (string) |
port | URL port of the endpoint to connect to (int) |
Callback to implement logic at the server-side to serve responses to HTTP OPTION requests from clients.
Called by the service dispatcher when an HTTP OPTION request is pending. Redefine this callback to respond to HTTP OPTION requests, see the http_post HTTP POST plugin for more details. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fopt is the internal static function http_200 that returns HTTP 200 OK.
soap | soap context |
Callback that reads and parses HTTP and MIME headers.
This callback is called by the engine (as a client or server) to read and parse HTTP headers or MIME headers. When redefined, this function should read or skip the entire HTTP header to reach the message body. Function soap_getline is used by this callback to read each header line into an internal buffer soap::msgbuf with soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf)). Returns #SOAP_OK, or a gSOAP error code. The built-in function assigned to soap::fparse is http_parse.
soap | soap context |
Callback that consumes an HTTP header that consists of a key-value pair.
This callback is called by soap::fparse, consumes an HTTP header that is split in a key-value pair and updates the soap context state accordingly. The context is updated with the HTTP header information received, but HTTP headers are not literally retained by the engine. Returns #SOAP_OK or #SOAP_STOP to prevent further reading of the HTTP body, or a soap_status (int) error code. The built-in function assigned to soap::fparsehdr is http_parse_header.
soap | soap context |
key | HTTP header key received (non-NULL string) |
val | HTTP header value received (non-NULL string) or an empty string |
Callback to implement logic at the server-side to serve responses to HTTP PATCH requests from clients.
This callback is called by the service dispatcher when an HTTP PATCH request is pending. Redefine this callback to respond to HTTP PATCH requests, see the http_post HTTP POST plugin for more details. Returns #SOAP_OK or a soap_status error code. The built-in function assigned to soap::fpatch is the internal static function http_patch that returns the #SOAP_PATCH_METHOD error.
soap | soap context |
Callback that blocks until activity is detected on the soap::socket or soap::master socket, times out when soap::send_timeout or soap::recv_timeout are set.
This callback is called by the engine to wait for activity on the soap::socket or soap::master socket using poll or select. Times out when soap::send_timeout or soap::recv_timeout are nonzero. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fpoll is soap_poll.
soap | soap context |
int(* soap::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 client-side to a connected HTTP server.
This callback is called at the client side by the engine to send HTTP headers to the connected server. The parameters host, port, and path were micro-parsed from the endpoint prior to passing them to this callback. Parameter action is the SOAP Action header. Parameter count is the length of the HTTP body with the message or 0 when HTTP chunking is used. This callback sends the headers with POST by default, or when soap::status == #SOAP_POST or soap::status == #SOAP_POST_FILE. Alternatively, sends the HTTP headers with GET when soap::status == #SOAP_GET, PATCH when soap::status == #SOAP_PATCH, PUT when soap::status == #SOAP_PUT, DELETE when soap::status == #SOAP_DEL, CONNECT when soap::status == #SOAP_CONNECT, HEAD when soap::status == #SOAP_HEAD or OPTIONS when soap::status == #SOAP_OPTIONS. Extra HTTP headers are added when soap::http_extra_header is set to one or more header lines separated by CRLF. When redefining this callback, use function soap_send to write the header contents. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap:fpost is http_post.
soap | soap context |
endpoint | URL of the endpoint connected to (string) |
host | URL host of the endpoint connected to (string) |
port | URL port of the endpoint connected to (int) |
path | URL path of the endpoint connected to (string) |
action | SOAP Action or NULL (string) |
count | HTTP content-length or 0 for HTTP chunked transfers (size_t) |
Callback that sends a single HTTP header given a key-value pair.
This callback is called by soap::fpost and soap::fresponse to send an HTTP header with a key and an optional value. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fposthdr is http_post_header.
soap | soap context |
key | HTTP header key (string) |
val | optional HTTP header value (string), omitted when NULL |
Callback to implement logic at the server-side to serve responses to HTTP PUT requests from clients.
This callback is called by the service dispatcher when an HTTP PUT request is pending. Redefine this callback to respond to HTTP PUT requests, see the http_post HTTP POST plugin for more details. Returns #SOAP_OK or a soap_status error code. The built-in function assigned to soap::fput is the internal static function http_put that returns the #SOAP_PUT_METHOD error.
soap | soap context |
Callback that receives bytes of data into the given buffer.
This callback is called by the engine to receive (or read) data into a specified buffer buf and len. The source for the data to read by this callback is soap::is when non-NULL, soap::socket when valid, or soap::recvfd. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::frecv is frecv.
soap | soap context |
buf | buffer to fill with bytes to be read (string) |
len | maximum size of the buffer (size_t) |
Callback that resolves a host name by address translation.
This callback is called by soap_bind (or the C++ service class bind method) at the server-side and by soap_connect or soap_connect_command at the client-side with a host name parameter to resolve to address inaddr by address translation. When successful sets parameter inaddr and returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fresolve is tcp_gethost.
soap | soap context |
name | host name (string) |
inaddr | points to in_addr structure to set |
Callback that populates and then sends HTTP headers from the server-side to a connected client.
This callback is called at the server side by the engine to send the HTTP headers to the connected client. The parameter status should be an HTTP status error code or #SOAP_OK (200 OK) or #SOAP_HTML or #SOAP_FILE. Using #SOAP_HTML sets the content-type header to text/html; charset=utf-8. Using #SOAP_FILE sets the content-type header to the value of soap::http_content. Extra HTTP headers are added when soap::http_extra_header is set to one or more header lines separated by CRLF. When redefining this callback, use function soap_send to write the header contents. Returns #SOAP_OK or a soap_status error code. The built-in function assigned to soap::fresponse is http_response.
soap | soap context |
status | HTTP status code (> 100) or #SOAP_OK (200 OK), or #SOAP_HTML or #SOAP_FILE |
count | HTTP content-length or 0 for HTTP chunked transfers |
Callback that sends the given bytes of data.
This callback is called by the engine to send (or write) data specified by data bytes of length len. The sink for the data to be sent to is typically soap::socket, soap::sendfd or soap::os. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fsend is fsend.
soap | soap context |
data | bytes to be send (string) |
len | number of bytes to be send (size_t) |
Callback executed by the engine at the server side immediately after a server operation successfully completed.
This callback is called after each successful completion of a server operation in the server loop. Executes immediately after sending the response to a client and before the next keep-alive server loop iteration when enabled with #SOAP_IO_KEEPALIVE. This callback can be used to reclaim resources in the keep-alive server loop, for example managed memory can be reclaimed by calling soap_destroy and soap_end in that order and all deserialized and other dynamically-allocated data managed by the context will be deallocated. Returns #SOAP_OK or a soap_status (int) error code. No built-in function is assigned to soap::fserveloop.
soap | soap context |
Callback to inspect or override fault code or fault string messages.
This callback is called by the engine when an error is raised to allow inspection or overriding of the fault code or fault string messages before the error is reported or transmitted. No built-in function is assigned to soap::fseterror.
soap | soap context |
faultcode | pointer to a string with the fault code message or NULL, can be reassigned |
faultstring | pointer to a string with the fault string message or NULL, can be reassigned |
int(* soap::fshutdownsocket) (struct soap *soap, SOAP_SOCKET sock, int how) |
Callback that shuts down a given socket.
This callback is called to shut down a socket by the engine. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fshutdownsocket is tcp_shutdownsocket.
soap | soap context |
sock | socket to shut down |
how | SHUT_RD (=0), SHUT_WR (=1) or SHUT_RDWR (=2) |
Callback to initialize the OpenSSL library.
This callback is called to initialize the OpenSSL, GNUTLS, or WolfSSL context for HTTPS connections configured with the parameters passed to soap_ssl_client_context and soap_ssl_server_context. Returns #SOAP_OK or a soap_status (int) error code. The built-in function assigned to soap::fsslauth is ssl_auth_init.
soap | soap context |
int(* soap::fsslverify) (int ok, X509_STORE_CTX *store) |
Callback to manage the verification of the certificate provided by a peer (typically a server)
This callback is called by the engine to manage the verification of the certificate provided by a peer, such as the certificate provided by a server connected over HTTPS or to verify the certificate included with a WS-Security message. To require certificate verification of a server connected via HTTPS, use soap_ssl_client_context with #SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION. To require certificate verification of a client connected to a server, use soap_ssl_server_context with #SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION. The ok parameter of this callback indicates whether the verification of the certificate in question passed (ok == 1) or failed (ok == 0) as determined by the OpenSSL library based on the soap_ssl_client_context or soap_ssl_server_context configuration. If the callback returns 1 then the handshake is continued and the connection maybe established. To return 1 when ok == 0 requires resetting the error state with X509_STORE_CTX_set_error(store, X509_V_OK). If the callback returns 0 then the handshake is immediately terminated with "verification failed" and a verification failure alert is sent to the peer. The built-in function assigned to soap::fsslverify is ssl_verify_callback or when #SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE is used ssl_verify_callback_allow_expired_certificate.
ok | when 1: the certificate passed, when 0: the certificate did not pass |
Callback to validate strings against XML regex patterns.
This callback is called to validate a string against an XML regex pattern. Patterns use XML schema regex syntax. This callback allows user-defined pattern validation that is normally disabled. Returns #SOAP_OK when the string matches the pattern or #SOAP_TYPE when the string does not match. No built-in function is assigned to soap::fsvalidate.
soap | soap context |
pattern | regex in XML schema syntax |
string | to match pattern against |
Callback to validate wide strings against XML regex patterns.
This callback is called to validate a wide string against an XML regex pattern. Patterns use XML schema regex syntax. This callback allows user-defined pattern validation that is normally disabled. Returns #SOAP_OK when the string matches the pattern or #SOAP_TYPE when the string does not match. No built-in function is assigned to soap::fwvalidate.
soap | soap context |
pattern | regex in XML schema syntax |
string | to match pattern against |