Documentation

soap_transport_http extends nusoap_base
in package

transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CURL extension for HTTPS support

Tags
author

Dietrich Ayala dietrich@ganx4.com

author

Scott Nichol snichol@users.sourceforge.net

access

public

Table of Contents

$authtype  : mixed
$certRequest  : mixed
$ch  : mixed
$ch_options  : mixed
$charencoding  : bool
toggles automatic encoding of special characters as entities (should always be true, I think)
$debug_str  : string
Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
$debugLevel  : int
the debug level for this instance
$digest_uri  : mixed
$digestRequest  : mixed
$encoding  : mixed
$error_str  : string
Current error string (manipulated by getError/setError)
$host  : mixed
$incoming_cookies  : mixed
$incoming_headers  : mixed
$incoming_payload  : mixed
$namespaces  : array<string|int, mixed>
namespaces in an array of prefix => uri
$outgoing_headers  : mixed
$outgoing_payload  : mixed
$password  : mixed
$path  : mixed
$persistentConnection  : mixed
$port  : mixed
$protocol_version  : mixed
$proxy  : mixed
$request_method  : mixed
$response_status_line  : mixed
$revision  : string
CVS revision for HTTP headers.
$scheme  : mixed
$soap_defencoding  : string
charset encoding for outgoing messages
$title  : string
Identification for HTTP headers.
$typemap  : array<string|int, mixed>
XML Schema types in an array of uri => (array of xml type => php type) is this legacy yet? no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.
$uri  : mixed
$url  : mixed
$use_curl  : mixed
$usedNamespaces  : array<string|int, mixed>
namespaces used in the current context, e.g. during serialization
$username  : mixed
$useSOAPAction  : mixed
$version  : string
Version for HTTP headers.
$xmlEntities  : array<string|int, mixed>
XML entities to convert
$XMLSchemaVersion  : string
set schema version
__construct()  : mixed
constructor
__toString()  : string
represents the object as a string
appendDebug()  : mixed
adds debug data to the instance debug string without formatting
buildPayload()  : void
Writes the payload, including HTTP headers, to $this->outgoing_payload.
clearDebug()  : mixed
clears the current debug data for this instance
connect()  : bool
establish an HTTP connection
contractQname()  : string
contracts (changes namespace to prefix) a qualified name
debug()  : mixed
adds debug data to the instance debug string with formatting
decodeChunked()  : mixed
decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6
expandEntities()  : mixed
expands entities, e.g. changes '<' to '&lt;'.
expandQname()  : string
expands (changes prefix to namespace) a qualified name
formatDump()  : string
formats a string to be inserted into an HTML stream
getCookiesForRequest()  : string
sort out cookies for the current request
getDebug()  : debug
gets the current debug data for this instance
getDebugAsXMLComment()  : debug
gets the current debug data for this instance as an XML comment this may change the contents of the debug data
getDebugLevel()  : int
gets the debug level for this instance
getError()  : mixed
returns error string if present
getGlobalDebugLevel()  : int
gets the global debug level, which applies to future instances
getLocalPart()  : string
returns the local part of a prefixed string returns the original string, if not prefixed
getmicrotime()  : string
returns the time in ODBC canonical form with microseconds
getNamespaceFromPrefix()  : mixed
pass it a prefix, it returns a namespace
getPrefix()  : mixed
returns the prefix part of a prefixed string returns false, if not prefixed
getPrefixFromNamespace()  : mixed
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace
getResponse()  : string
gets the SOAP response via HTTP[S]
io_method()  : string
gets the I/O method to use
isArraySimpleOrStruct()  : string
detect if array is a simple array or a struct (associative array)
isSkippableCurlHeader()  : mixed
Test if the given string starts with a header that is to be skipped.
parseCookie()  : array<string|int, mixed>
parse an incoming Cookie into it's parts
send()  : string
sends the SOAP request and gets the SOAP response via HTTP[S]
sendHTTPS()  : string
sends the SOAP request and gets the SOAP response via HTTPS using CURL
sendRequest()  : bool
sends the SOAP request via HTTP[S]
serialize_val()  : string
serializes PHP values in accordance w/ section 5. Type information is not serialized if $use == 'literal'.
serializeEnvelope()  : string
serializes a message
setContentType()  : mixed
sets the content-type for the SOAP message to be sent
setCredentials()  : mixed
if authenticating, set user credentials here
setCurlOption()  : mixed
sets a cURL option
setDebugLevel()  : mixed
sets the debug level for this instance
setEncoding()  : mixed
use http encoding
setError()  : bool
sets error string
setGlobalDebugLevel()  : mixed
sets the global debug level, which applies to future instances
setHeader()  : mixed
sets an HTTP header
setProxy()  : mixed
set proxy info here
setSOAPAction()  : mixed
set the soapaction value
setURL()  : mixed
sets the URL to which to connect
unsetHeader()  : mixed
unsets an HTTP header
usePersistentConnection()  : bool
specifies that an HTTP persistent connection should be used
varDump()  : string
Returns a string with the output of var_dump

Properties

$authtype

public mixed $authtype = ''

$certRequest

public mixed $certRequest = array()

$ch_options

public mixed $ch_options = array()

$charencoding

toggles automatic encoding of special characters as entities (should always be true, I think)

public bool $charencoding = rue
Tags
access

private

$debug_str

Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)

public string $debug_str = ''
Tags
access

private

$debugLevel

the debug level for this instance

public int $debugLevel
Tags
access

private

$digest_uri

public mixed $digest_uri = ''

$digestRequest

public mixed $digestRequest = array()

$encoding

public mixed $encoding = ''

$error_str

Current error string (manipulated by getError/setError)

public string $error_str = ''
Tags
access

private

$incoming_cookies

public mixed $incoming_cookies = array()

$incoming_headers

public mixed $incoming_headers = array()

$incoming_payload

public mixed $incoming_payload = ''

$namespaces

namespaces in an array of prefix => uri

public array<string|int, mixed> $namespaces = array('SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xsd' => 'http://www.w3.org/2001/XMLSchema', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/')

this is "seeded" by a set of constants, but it may be altered by code

Tags
access

public

$outgoing_headers

public mixed $outgoing_headers = array()

$outgoing_payload

public mixed $outgoing_payload = ''

$password

public mixed $password = ''

$persistentConnection

public mixed $persistentConnection = alse

$protocol_version

public mixed $protocol_version = '1.0'

$proxy

public mixed $proxy = ull

$request_method

public mixed $request_method = 'POST'

$response_status_line

public mixed $response_status_line

$revision

CVS revision for HTTP headers.

public string $revision = '$Revision: 1.123 $'
Tags
access

private

$scheme

public mixed $scheme = ''

$soap_defencoding

charset encoding for outgoing messages

public string $soap_defencoding = 'ISO-8859-1'
Tags
access

public

$title

Identification for HTTP headers.

public string $title = 'NuSOAP'
Tags
access

private

$typemap

XML Schema types in an array of uri => (array of xml type => php type) is this legacy yet? no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.

public array<string|int, mixed> $typemap = array('http://www.w3.org/2001/XMLSchema' => array( 'string' => 'string', 'boolean' => 'boolean', 'float' => 'double', 'double' => 'double', 'decimal' => 'double', 'duration' => '', 'dateTime' => 'string', 'time' => 'string', 'date' => 'string', 'gYearMonth' => '', 'gYear' => '', 'gMonthDay' => '', 'gDay' => '', 'gMonth' => '', 'hexBinary' => 'string', 'base64Binary' => 'string', // abstract "any" types 'anyType' => 'string', 'anySimpleType' => 'string', // derived datatypes 'normalizedString' => 'string', 'token' => 'string', 'language' => '', 'NMTOKEN' => '', 'NMTOKENS' => '', 'Name' => '', 'NCName' => '', 'ID' => '', 'IDREF' => '', 'IDREFS' => '', 'ENTITY' => '', 'ENTITIES' => '', 'integer' => 'integer', 'nonPositiveInteger' => 'integer', 'negativeInteger' => 'integer', 'long' => 'integer', 'int' => 'integer', 'short' => 'integer', 'byte' => 'integer', 'nonNegativeInteger' => 'integer', 'unsignedLong' => '', 'unsignedInt' => '', 'unsignedShort' => '', 'unsignedByte' => '', 'positiveInteger' => '', ), 'http://www.w3.org/2000/10/XMLSchema' => array('i4' => '', 'int' => 'integer', 'boolean' => 'boolean', 'string' => 'string', 'double' => 'double', 'float' => 'double', 'dateTime' => 'string', 'timeInstant' => 'string', 'base64Binary' => 'string', 'base64' => 'string', 'ur-type' => 'array'), 'http://www.w3.org/1999/XMLSchema' => array('i4' => '', 'int' => 'integer', 'boolean' => 'boolean', 'string' => 'string', 'double' => 'double', 'float' => 'double', 'dateTime' => 'string', 'timeInstant' => 'string', 'base64Binary' => 'string', 'base64' => 'string', 'ur-type' => 'array'), 'http://soapinterop.org/xsd' => array('SOAPStruct' => 'struct'), 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64' => 'string', 'array' => 'array', 'Array' => 'array'), 'http://xml.apache.org/xml-soap' => array('Map'))
Tags
access

public

$use_curl

public mixed $use_curl = alse

$usedNamespaces

namespaces used in the current context, e.g. during serialization

public array<string|int, mixed> $usedNamespaces = array()
Tags
access

private

$username

public mixed $username = ''

$useSOAPAction

public mixed $useSOAPAction = rue

$version

Version for HTTP headers.

public string $version = '0.9.5'
Tags
access

private

$xmlEntities

XML entities to convert

public array<string|int, mixed> $xmlEntities = array('quot' => '"', 'amp' => '&', 'lt' => '<', 'gt' => '>', 'apos' => "'")
Tags
access

public

deprecated
see
expandEntities

$XMLSchemaVersion

set schema version

public string $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
Tags
access

public

Methods

__construct()

constructor

public __construct(string $url[, array<string|int, mixed> $curl_options = null ][, bool $use_curl = false ]) : mixed
Parameters
$url : string

The URL to which to connect

$curl_options : array<string|int, mixed> = null

User-specified cURL options

$use_curl : bool = false

Whether to try to force cURL use

Tags
access

public

Return values
mixed

__toString()

represents the object as a string

public __toString() : string
Tags
access

public

Return values
string

appendDebug()

adds debug data to the instance debug string without formatting

public appendDebug(string $string) : mixed
Parameters
$string : string

debug data

Tags
access

public

Return values
mixed

buildPayload()

Writes the payload, including HTTP headers, to $this->outgoing_payload.

public buildPayload(string $data[, string $cookie_str = '' ]) : void
Parameters
$data : string

HTTP body

$cookie_str : string = ''

data for HTTP Cookie header

Tags
access

private

Return values
void

clearDebug()

clears the current debug data for this instance

public clearDebug() : mixed
Tags
access

public

Return values
mixed

connect()

establish an HTTP connection

public connect(mixed $connection_timeout[, int $response_timeout = 30 ]) : bool
Parameters
$connection_timeout : mixed
$response_timeout : int = 30

set response timeout in seconds

Tags
access

private

Return values
bool

true if connected, false if not

contractQname()

contracts (changes namespace to prefix) a qualified name

public contractQname(string $qname) : string
Parameters
$qname : string

qname

Tags
access

private

Return values
string

contracted qname

debug()

adds debug data to the instance debug string with formatting

public debug(string $string) : mixed
Parameters
$string : string

debug data

Tags
access

private

Return values
mixed

decodeChunked()

decode a string that is encoded w/ "chunked' transfer encoding as defined in RFC2068 19.4.6

public decodeChunked(string $buffer, string $lb) : mixed
Parameters
$buffer : string
$lb : string
Tags
returns

string

access

public

deprecated
Return values
mixed

expandEntities()

expands entities, e.g. changes '<' to '&lt;'.

public expandEntities(string $val) : mixed
Parameters
$val : string

The string in which to expand entities.

Tags
access

private

Return values
mixed

expandQname()

expands (changes prefix to namespace) a qualified name

public expandQname(string $qname) : string
Parameters
$qname : string

qname

Tags
access

private

Return values
string

expanded qname

formatDump()

formats a string to be inserted into an HTML stream

public formatDump(string $str) : string
Parameters
$str : string

The string to format

Tags
access

public

deprecated
Return values
string

The formatted string

getCookiesForRequest()

sort out cookies for the current request

public getCookiesForRequest(array<string|int, mixed> $cookies[, bool $secure = false ]) : string
Parameters
$cookies : array<string|int, mixed>

array with all cookies

$secure : bool = false

is the send-content secure or not?

Tags
access

private

Return values
string

for Cookie-HTTP-Header

getDebug()

gets the current debug data for this instance

public getDebug() : debug
Tags
access

public

Return values
debug

data

getDebugAsXMLComment()

gets the current debug data for this instance as an XML comment this may change the contents of the debug data

public getDebugAsXMLComment() : debug
Tags
access

public

Return values
debug

data as an XML comment

getDebugLevel()

gets the debug level for this instance

public getDebugLevel() : int
Tags
access

public

Return values
int

Debug level 0-9, where 0 turns off

getError()

returns error string if present

public getError() : mixed
Tags
access

public

Return values
mixed

error string or false

getGlobalDebugLevel()

gets the global debug level, which applies to future instances

public getGlobalDebugLevel() : int
Tags
access

public

Return values
int

Debug level 0-9, where 0 turns off

getLocalPart()

returns the local part of a prefixed string returns the original string, if not prefixed

public getLocalPart(string $str) : string
Parameters
$str : string

The prefixed string

Tags
access

public

Return values
string

The local part

getmicrotime()

returns the time in ODBC canonical form with microseconds

public getmicrotime() : string
Tags
access

public

Return values
string

The time in ODBC canonical form with microseconds

getNamespaceFromPrefix()

pass it a prefix, it returns a namespace

public getNamespaceFromPrefix(string $prefix) : mixed
Parameters
$prefix : string

The prefix

Tags
access

public

Return values
mixed

The namespace, false if no namespace has the specified prefix

getPrefix()

returns the prefix part of a prefixed string returns false, if not prefixed

public getPrefix(string $str) : mixed
Parameters
$str : string

The prefixed string

Tags
access

public

Return values
mixed

The prefix or false if there is no prefix

getPrefixFromNamespace()

returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace

public getPrefixFromNamespace(string $ns) : mixed
Parameters
$ns : string

The namespace

Tags
access

public

Return values
mixed

The prefix, false if the namespace has no prefixes

getResponse()

gets the SOAP response via HTTP[S]

public getResponse() : string
Tags
access

private

Return values
string

the response (also sets member variables like incoming_payload)

io_method()

gets the I/O method to use

public io_method() : string
Tags
access

private

Return values
string

I/O method to use (socket|curl|unknown)

isArraySimpleOrStruct()

detect if array is a simple array or a struct (associative array)

public isArraySimpleOrStruct(mixed $val) : string
Parameters
$val : mixed

The PHP array

Tags
access

private

Return values
string

(arraySimple|arrayStruct)

isSkippableCurlHeader()

Test if the given string starts with a header that is to be skipped.

public isSkippableCurlHeader(string &$data) : mixed

Skippable headers result from chunked transfer and proxy requests.

Parameters
$data : string

The string to check.

Tags
returns

boolean Whether a skippable header was found.

access

private

Return values
mixed

parseCookie()

parse an incoming Cookie into it's parts

public parseCookie(string $cookie_str) : array<string|int, mixed>
Parameters
$cookie_str : string

content of cookie

Tags
access

private

Return values
array<string|int, mixed>

with data of that cookie

send()

sends the SOAP request and gets the SOAP response via HTTP[S]

public send(string $data, int $timeout[, int $response_timeout = 30 ][, array<string|int, mixed> $cookies = null ]) : string
Parameters
$data : string

message data

$timeout : int

set connection timeout in seconds

$response_timeout : int = 30

set response timeout in seconds

$cookies : array<string|int, mixed> = null

cookies to send

Tags
access

public

Return values
string

data

sendHTTPS()

sends the SOAP request and gets the SOAP response via HTTPS using CURL

public sendHTTPS(string $data, int $timeout[, int $response_timeout = 30 ], array<string|int, mixed> $cookies) : string
Parameters
$data : string

message data

$timeout : int

set connection timeout in seconds

$response_timeout : int = 30

set response timeout in seconds

$cookies : array<string|int, mixed>

cookies to send

Tags
access

public

deprecated
Return values
string

data

sendRequest()

sends the SOAP request via HTTP[S]

public sendRequest(string $data[, array<string|int, mixed> $cookies = null ]) : bool
Parameters
$data : string

message data

$cookies : array<string|int, mixed> = null

cookies to send

Tags
access

private

Return values
bool

true if OK, false if problem

serialize_val()

serializes PHP values in accordance w/ section 5. Type information is not serialized if $use == 'literal'.

public serialize_val(mixed $val[, string $name = false ][, string $type = false ][, string $name_ns = false ][, string $type_ns = false ][, array<string|int, mixed> $attributes = false ][, string $use = 'encoded' ][, bool $soapval = false ]) : string
Parameters
$val : mixed

The value to serialize

$name : string = false

The name (local part) of the XML element

$type : string = false

The XML schema type (local part) for the element

$name_ns : string = false

The namespace for the name of the XML element

$type_ns : string = false

The namespace for the type of the element

$attributes : array<string|int, mixed> = false

The attributes to serialize as name=>value pairs

$use : string = 'encoded'

The WSDL "use" (encoded|literal)

$soapval : bool = false

Whether this is called from soapval.

Tags
access

public

Return values
string

The serialized element, possibly with child elements

serializeEnvelope()

serializes a message

public serializeEnvelope(string $body[, mixed $headers = false ][, array<string|int, mixed> $namespaces = array() ][, string $style = 'rpc' ][, string $use = 'encoded' ][, string $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/' ]) : string
Parameters
$body : string

the XML of the SOAP body

$headers : mixed = false

optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array

$namespaces : array<string|int, mixed> = array()

optional the namespaces used in generating the body and headers

$style : string = 'rpc'

optional (rpc|document)

$use : string = 'encoded'

optional (encoded|literal)

$encodingStyle : string = 'http://schemas.xmlsoap.org/soap/encoding/'

optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)

Tags
access

public

Return values
string

the message

setContentType()

sets the content-type for the SOAP message to be sent

public setContentType(string $type[, mixed $charset = false ]) : mixed
Parameters
$type : string

the content type, MIME style

$charset : mixed = false

character set used for encoding (or false)

Tags
access

public

Return values
mixed

setCredentials()

if authenticating, set user credentials here

public setCredentials(string $username, string $password[, string $authtype = 'basic' ][, array<string|int, mixed> $digestRequest = array() ][, array<string|int, mixed> $certRequest = array() ]) : mixed
Parameters
$username : string
$password : string
$authtype : string = 'basic'

(basic|digest|certificate|ntlm)

$digestRequest : array<string|int, mixed> = array()

(keys must be nonce, nc, realm, qop)

$certRequest : array<string|int, mixed> = array()

(keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs)

Tags
access

public

Return values
mixed

setCurlOption()

sets a cURL option

public setCurlOption(mixed $option, mixed $value) : mixed
Parameters
$option : mixed

The cURL option (always integer?)

$value : mixed

The cURL option value

Tags
access

private

Return values
mixed

setDebugLevel()

sets the debug level for this instance

public setDebugLevel(int $level) : mixed
Parameters
$level : int

Debug level 0-9, where 0 turns off

Tags
access

public

Return values
mixed

setEncoding()

use http encoding

public setEncoding([string $enc = 'gzip, deflate' ]) : mixed
Parameters
$enc : string = 'gzip, deflate'

encoding style. supported values: gzip, deflate, or both

Tags
access

public

Return values
mixed

setError()

sets error string

public setError(mixed $str) : bool
Parameters
$str : mixed
Tags
access

private

Return values
bool

$string error string

setGlobalDebugLevel()

sets the global debug level, which applies to future instances

public setGlobalDebugLevel(int $level) : mixed
Parameters
$level : int

Debug level 0-9, where 0 turns off

Tags
access

public

Return values
mixed

setHeader()

sets an HTTP header

public setHeader(string $name, string $value) : mixed
Parameters
$name : string

The name of the header

$value : string

The value of the header

Tags
access

private

Return values
mixed

setProxy()

set proxy info here

public setProxy(string $proxyhost, string $proxyport[, string $proxyusername = '' ][, string $proxypassword = '' ][, string $proxyauthtype = 'basic' ]) : mixed
Parameters
$proxyhost : string

use an empty string to remove proxy

$proxyport : string
$proxyusername : string = ''
$proxypassword : string = ''
$proxyauthtype : string = 'basic'

(basic|ntlm)

Tags
access

public

Return values
mixed

setSOAPAction()

set the soapaction value

public setSOAPAction(string $soapaction) : mixed
Parameters
$soapaction : string
Tags
access

public

Return values
mixed

setURL()

sets the URL to which to connect

public setURL(string $url) : mixed
Parameters
$url : string

The URL to which to connect

Tags
access

private

Return values
mixed

unsetHeader()

unsets an HTTP header

public unsetHeader(string $name) : mixed
Parameters
$name : string

The name of the header

Tags
access

private

Return values
mixed

usePersistentConnection()

specifies that an HTTP persistent connection should be used

public usePersistentConnection() : bool
Tags
access

public

Return values
bool

whether the request was honored by this method.

varDump()

Returns a string with the output of var_dump

public varDump(mixed $data) : string
Parameters
$data : mixed

The variable to var_dump

Tags
access

public

Return values
string

The output of var_dump

Search results