SOAP Client
suggest changeVersions
[{“Name”:“5.0”,“GroupName”:“PHP 5.x”},{“Name”:“5.1”,“GroupName”:“PHP 5.x”},{“Name”:“5.2”,“GroupName”:“PHP 5.x”},{“Name”:“5.3”,“GroupName”:“PHP 5.x”},{“Name”:“5.4”,“GroupName”:“PHP 5.x”},{“Name”:“5.5”,“GroupName”:“PHP 5.x”},{“Name”:“5.6”,“GroupName”:“PHP 5.x”},{“Name”:“7.0”,“GroupName”:“PHP 7.x”},{“Name”:“7.1”,“GroupName”:“PHP 7.x”}]
Syntax
- __getFunctions() // Returns array of functions for service (WSDL mode only)
- __getTypes() // Returns array of types for service (WSDL mode only)
- __getLastRequest() // Returns XML from last request (Requires
trace
option) - __getLastRequestHeaders() // Returns headers from last request (Requires
trace
option) - __getLastResponse() // Returns XML from last response (Requires
trace
option) - __getLastResponseHeaders() // Returns headers from last response (Requires
trace
option)
Parameters
Parameter | Details |
—— | —— |
$wsdl | URI of WSDL or NULL
if using non-WSDL mode |
$options | Array of options for SoapClient. Non-WSDL mode requires location
and uri
to set, all other options are optional. See table below for possible values.
Remarks
The SoapClient
class is equipped with a __call
method. This is not to be called directly. Instead this allows you to do:
$soap->requestInfo(['a', 'b', 'c']);
This will call the requestInfo
SOAP method.
Table of possible $options
values (Array of key/value pairs):
Option | Details |
—— | —— |
location | URL of SOAP server. Required in non-WSDL mode. Can be used in WSDL mode to override the URL. |
uri | Target namespace of SOAP service. Required in non-WSDL mode. |
style | Possible values are SOAP_RPC
or SOAP_DOCUMENT
. Only valid in non-WSDL mode. |
use | Possible values are SOAP_ENCODED
or SOAP_LITERAL
. Only valid in non-WSDL mode. |
soap_version | Possible values are SOAP_1_1
(default) or SOAP_1_2
. |
authentication | Enable HTTP authentication. Possible values are SOAP_AUTHENTICATION_BASIC
(default) or SOAP_AUTHENTICATION_DIGEST
. |
login | Username for HTTP authentication |
password | Password for HTTP authentication |
proxy_host | URL of proxy server |
proxy_port | Proxy server port |
proxy_login | Username for proxy |
proxy_password | Password for proxy |
local_cert | Path to HTTPS client cert (for authentication) |
passphrase | Passphrase for HTTPS client cert |
compression | Compress request / response. Value is a bitmask of SOAP_COMPRESSION_ACCEPT
with either SOAP_COMPRESSION_GZIP
or SOAP_COMPRESSION_DEFLATE
. For example: SOAP_COMPRESSION_ACCEPT \| SOAP_COMPRESSION_GZIP
. |
encoding | Internal character encoding (TODO: possible values) |
trace | Boolean, defaults to FALSE
. Enables tracing of requests so faults can be backtraced. Enables use of __getLastRequest()
, __getLastRequestHeaders()
, __getLastResponse()
and __getLastResponseHeaders()
.|
classmap | Map WSDL types to PHP classes. Value should be an array with WSDL types as keys and PHP class names as values. |
exceptions | Boolean value. Should SOAP errors exceptions (of type SoapFault). | | connection_timeout | Timeout (in seconds) for the connection to the SOAP service. | | typemap | Array of type mappings. Array should be key/value pairs with the following keys:
type_name,
type_ns(namespace URI),
from_xml(callback accepting one string parameter) and
to_xml(callback accepting one object parameter).| | cache_wsdl | How (if at all) should the WSDL file be cached. Possible values are
WSDL_CACHE_NONE,
WSDL_CACHE_DISK,
WSDL_CACHE_MEMORYor
WSDL_CACHE_BOTH. | | user_agent | String to use in the
User-Agentheader. | | stream_context | A resource for a context. | |features | Bitmask of
SOAP_SINGLE_ELEMENT_ARRAYS,
SOAP_USE_XSI_ARRAY_TYPE,
SOAP_WAIT_ONE_WAY_CALLS. | | keep_alive | (*PHP version >= 5.4 only*) *Boolean* value. Send either
Connection: Keep-Aliveheader (
TRUE) or
Connection: Closeheader (
FALSE). | | ssl_method | (*PHP version >= 5.5 only*) Which SSL/TLS version to use. Possible values are
SOAP_SSL_METHOD_TLS,
SOAP_SSL_METHOD_SSLv2,
SOAP_SSL_METHOD_SSLv3or
SOAP_SSL_METHOD_SSLv23`. |
Issue with 32 bit PHP: In 32 bit PHP, numeric strings greater than 32 bits which are automatically cast to integer by xs:long will result in it hitting the 32 bit limit, casting it to 2147483647. To work around this, cast the strings to float before passing it in to __soapCall().