URI of a WSDL file describing the service, which is used to automatically
configure the client. If not provided, the client will operate in non-WSDL
mode.
An associative array specifying additional options for the SOAP client.
If wsdl is provided, this is optional; otherwise,
at least location and url must be
provided.
The URL of the SOAP server to send the request to.
Required if the wsdl parameter is not provided.
If both a wsdl parameter and
location option are provided, the
location option will over-ride any location
specified in the WSDL file.
Specifies the binding style to use for this client, using the constants
SOAP_RPC and SOAP_DOCUMENT.
SOAP_RPC indicates RPC-style binding, where the
SOAP request body contains a standard encoding of a function call.
SOAP_DOCUMENT indicates document-style binding,
where the SOAP request body contains an XML document with
service-defined meaning.
If the wsdl parameter is provided, this
option is ignored, and the style is read from the WSDL file.
If neither this option nor the wsdl parameter
is provided, RPC-style is used.
Specifies the encoding style to use for this client, using the
constants SOAP_ENCODED or SOAP_LITERAL.
SOAP_ENCODED indicates encoding using the types
defined in the SOAP specification.
SOAP_LITERAL indicates encoding using a schema
defined by the service.
If the wsdl parameter is provided, this
option is ignored, and the encoding is read from the WSDL file.
If neither this option nor the wsdl parameter
is provided, the "encoded" style is used.
Enables compression of HTTP SOAP requests and responses.
The value should be the bitwise OR of three parts:
an optional SOAP_COMPRESSION_ACCEPT,
to send an "Accept-Encoding" header; either
SOAP_COMPRESSION_GZIP
or SOAP_COMPRESSION_DEFLATE to indicate
the compression algorithm to use; and a number between 1 and 9
to indicate the level of compression to use in the request.
For example, to enable two-way gzip compression with the maximum
compression level, use
SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9.
Used to map types defined in the WSDL to PHP classes.
It should be specified as an associative array with
type names from the WSDL as keys and names of PHP classes as values.
Note that the type names of an element is not necessarily the same as
the element (tag) name.
The provided class names should always be fully qualified with any
namespaces, and never
start with a leading \. The correct form can be
generated by using
::class.
Note that when creating a class, the constructor will not be called,
but magic __set() and
__get() methods for individual
properties will be.
Used to define type mappings using user-defined callback functions.
Each type mapping should be an array with keys
type_name (string specifying the
XML element type);
type_ns (string containing namespace
URI);
from_xml (callable accepting one
string parameter and returning an object) and
to_xml (callable accepting one
object parameter and returning a string).
Defines a timeout in seconds for the connection to the SOAP service.
This option does not define a timeout for services with slow responses.
To limit the time to wait for calls to finish the
default_socket_timeout
configuration option is available.
Two types of cache are available: in-memory caching, which caches the WSDL
in the memory of the current process; and disk caching, which caches the
WSDL in a file on disk, shared between all processes.
The directory to use for the disk cache is determined by the
soap.wsdl_cache_dir
configuration option.
Both caches use the same lifetime, determined by the
soap.wsdl_cache_ttl
configuration option. The in-memory cache also has a maximum number of entries
determined by the
soap.wsdl_cache_limit
configuration option.
If not specified, the
soap.wsdl_cache configuration option will be used.
Note that the following HTTP headers are generated automatically or from other
options, and will be ignored if specified in the 'header'
context option: host, connection,
user-agent, content-length,
content-type, cookie,
authorization, and proxy-authorization
When decoding a response to an array, the default behaviour is to detect whether
an element name appears once or multiple times in a particular parent element.
For elements which appear only once, an object property allows direct access to
the content; for elements which appear more than once, the property contains an
array with the content of each matching element.
If the SOAP_SINGLE_ELEMENT_ARRAYS feature is enabled,
elements which appear only once are placed in a single-element array, so that
access is consistent for all elements. This only has an effect when using a WSDL
containing a schema for the response. See Examples section for an illustration.
Specifies the SSL or TLS protocol version to use with secure HTTP
connections, instead of the default negotiation.
Specifying SOAP_SSL_METHOD_SSLv2
or SOAP_SSL_METHOD_SSLv3 will force use of SSL 2
or SSL 3, respectively.
Specifying SOAP_SSL_METHOD_SSLv23 has no effect;
the constant exists only for backwards compatibility.
As of PHP 7.2, specifying SOAP_SSL_METHOD_TLS
also has no effect; in earlier versions, it forced use of TLS 1.0.
Note that SSL versions 2 and 3 are considered insecure, and may not
be supported by the installed OpenSSL library.
This option is DEPRECATED as of PHP 8.1.0.
A more flexible alternative, which allows specifying
individual versions of TLS, is to use the
stream_context option with
the 'crypto_method' context parameter.
It says header can either be of type array or string. This is also wrong. It may not necessarily be optional because it might depend on your PHP compile time configuration.
If your instance is compiled --with-curlwrappers option, you should use array type for header in the HTTP context and if not; you should use a string separated by new line (\n) for the header. I am not sure if SoapClient respects curl_wrappers option because although it is enabled in my instance and although I am using arrays for the headers to create HTTP context for non-Soap operations; SoapClient required me to use a string. It otherwise just dropped the stream_context altogether.
So with SoapClient, you better use a string for the HTTP header like: