diff --git a/lib/class.nusoap_base.php b/lib/class.nusoap_base.php
index 318c6ef..32b1776 100644
--- a/lib/class.nusoap_base.php
+++ b/lib/class.nusoap_base.php
@@ -141,7 +141,7 @@ class nusoap_base {
* @access public
*/
var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
-
+
/**
* charset encoding for outgoing messages
*
@@ -222,7 +222,7 @@ class nusoap_base {
*
* @access public
*/
- function nusoap_base() {
+ function __construct() {
$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
}
@@ -408,7 +408,7 @@ function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=fals
$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
$this->appendDebug('value=' . $this->varDump($val));
$this->appendDebug('attributes=' . $this->varDump($attributes));
-
+
if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
$this->debug("serialize_val: serialize soapval");
$xml = $val->serialize($use);
@@ -982,7 +982,7 @@ function iso8601_to_timestamp($datestr){
function usleepWindows($usec)
{
$start = gettimeofday();
-
+
do
{
$stop = gettimeofday();
@@ -993,4 +993,4 @@ function usleepWindows($usec)
}
-?>
\ No newline at end of file
+?>
diff --git a/lib/class.soap_fault.php b/lib/class.soap_fault.php
index 1515b50..6a54eae 100644
--- a/lib/class.soap_fault.php
+++ b/lib/class.soap_fault.php
@@ -45,7 +45,7 @@ class nusoap_fault extends nusoap_base {
* @param string $faultstring human readable error message
* @param mixed $faultdetail detail, typically a string or array of string
*/
- function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
+ function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
parent::nusoap_base();
$this->faultcode = $faultcode;
$this->faultactor = $faultactor;
@@ -87,4 +87,4 @@ class soap_fault extends nusoap_fault {
}
-?>
\ No newline at end of file
+?>
diff --git a/lib/class.soap_transport_http.php b/lib/class.soap_transport_http.php
index 12043c7..4698209 100644
--- a/lib/class.soap_transport_http.php
+++ b/lib/class.soap_transport_http.php
@@ -339,7 +339,7 @@ function connect($connection_timeout=0,$response_timeout=30){
if (isset($this->certRequest['verifyhost'])) {
$this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
} else {
- $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
+ $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
}
if (isset($this->certRequest['sslcertfile'])) {
$this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
diff --git a/lib/class.soapclient.php b/lib/class.soapclient.php
index 3361a03..7f08b66 100644
--- a/lib/class.soapclient.php
+++ b/lib/class.soapclient.php
@@ -95,7 +95,7 @@ class nusoap_client extends nusoap_base {
* @param string $portName optional portName in WSDL document
* @access public
*/
- function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
+ function __construct($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
parent::nusoap_base();
$this->endpoint = $endpoint;
$this->proxyhost = $proxyhost;
@@ -164,7 +164,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->faultstring = '';
$this->faultcode = '';
$this->opData = array();
-
+
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
$this->appendDebug('params=' . $this->varDump($params));
$this->appendDebug('headers=' . $this->varDump($headers));
@@ -235,7 +235,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
// no WSDL
//$this->namespaces['ns1'] = $namespace;
$nsPrefix = 'ns' . rand(1000, 9999);
- // serialize
+ // serialize
$payload = '';
if ($use = 'literal wrapped') {
// 'literal wrapped' is only sensible (and defined) for 'document'.
@@ -316,7 +316,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->return = $return;
$this->debug('sent message successfully and got a(n) '.gettype($return));
$this->appendDebug('return=' . $this->varDump($return));
-
+
// fault?
if(is_array($return) && isset($return['faultcode'])){
$this->debug('got fault');
@@ -324,10 +324,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->fault = true;
foreach($return as $k => $v){
$this->$k = $v;
- if(is_scalar($v))
- $this->debug("$k = $v
");
- else
- $this->debug("$k = ".print_r($v, true)."
");
+ $this->debug("$k = $v
");
}
return $return;
} elseif ($style == 'document') {
@@ -488,7 +485,7 @@ function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
$this->persistentConnection = $http;
}
}
-
+
if($err = $http->getError()){
$this->setError('HTTP Error: '.$err);
return false;
@@ -652,7 +649,7 @@ function setCredentials($username, $password, $authtype = 'basic', $certRequest
$this->authtype = $authtype;
$this->certRequest = $certRequest;
}
-
+
/**
* use HTTP encoding
*
@@ -663,7 +660,7 @@ function setHTTPEncoding($enc='gzip, deflate'){
$this->debug("setHTTPEncoding(\"$enc\")");
$this->http_encoding = $enc;
}
-
+
/**
* Set whether to try to use cURL connections if possible
*
@@ -684,7 +681,7 @@ function useHTTPPersistentConnection(){
$this->debug("useHTTPPersistentConnection");
$this->persistentConnection = true;
}
-
+
/**
* gets the default RPC parameter setting.
* If true, default is that call params are like RPC even for document style.
@@ -714,7 +711,7 @@ function getDefaultRpcParams() {
function setDefaultRpcParams($rpcParams) {
$this->defaultRpcParams = $rpcParams;
}
-
+
/**
* dynamically creates an instance of a proxy class,
* allowing user to directly call methods from wsdl
@@ -844,7 +841,7 @@ function getProxyClassCode() {
function getHTTPBody($soapmsg) {
return $soapmsg;
}
-
+
/**
* gets the HTTP content type for the current request.
*
@@ -856,7 +853,7 @@ function getHTTPBody($soapmsg) {
function getHTTPContentType() {
return 'text/xml';
}
-
+
/**
* gets the HTTP content type charset for the current request.
* returns false for non-text content types.
diff --git a/lib/nusoap.php b/lib/nusoap.php
index dac53a8..a05c2ff 100644
--- a/lib/nusoap.php
+++ b/lib/nusoap.php
@@ -141,7 +141,7 @@ class nusoap_base {
* @access public
*/
var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema';
-
+
/**
* charset encoding for outgoing messages
*
@@ -222,7 +222,7 @@ class nusoap_base {
*
* @access public
*/
- function nusoap_base() {
+ function __construct() {
$this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
}
@@ -408,7 +408,7 @@ function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=fals
$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
$this->appendDebug('value=' . $this->varDump($val));
$this->appendDebug('attributes=' . $this->varDump($attributes));
-
+
if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
$this->debug("serialize_val: serialize soapval");
$xml = $val->serialize($use);
@@ -982,7 +982,7 @@ function iso8601_to_timestamp($datestr){
function usleepWindows($usec)
{
$start = gettimeofday();
-
+
do
{
$stop = gettimeofday();
@@ -1038,8 +1038,8 @@ class nusoap_fault extends nusoap_base {
* @param string $faultstring human readable error message
* @param mixed $faultdetail detail, typically a string or array of string
*/
- function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
- parent::nusoap_base();
+ function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
+ parent::__construct();
$this->faultcode = $faultcode;
$this->faultactor = $faultactor;
$this->faultstring = $faultstring;
@@ -1093,7 +1093,7 @@ class soap_fault extends nusoap_fault {
* @access public
*/
class nusoap_xmlschema extends nusoap_base {
-
+
// files
var $schema = '';
var $xml = '';
@@ -1122,7 +1122,7 @@ class nusoap_xmlschema extends nusoap_base {
var $depth_array = array();
var $message = array();
var $defaultNamespace = array();
-
+
/**
* constructor
*
@@ -1131,8 +1131,8 @@ class nusoap_xmlschema extends nusoap_base {
* @param string $namespaces namespaces defined in enclosing XML
* @access public
*/
- function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
- parent::nusoap_base();
+ function __construct($schema='',$xml='',$namespaces=array()){
+ parent::__construct();
$this->debug('nusoap_xmlschema class instantiated, inside constructor');
// files
$this->schema = $schema;
@@ -1222,7 +1222,7 @@ function parseString($xml,$type){
$this->debug("XML payload:\n" . $xml);
$this->setError($errstr);
}
-
+
xml_parser_free($this->parser);
} else{
$this->debug('no xml passed to parseString()!!');
@@ -1244,7 +1244,7 @@ function CreateTypeName($ename) {
}
return $scope . $ename . '_ContainedType';
}
-
+
/**
* start-element handler
*
@@ -1254,13 +1254,13 @@ function CreateTypeName($ename) {
* @access private
*/
function schemaStartElement($parser, $name, $attrs) {
-
+
// position in the total number of elements, starting from 0
$pos = $this->position++;
$depth = $this->depth++;
// set self as current value for this depth
$this->depth_array[$depth] = $pos;
- $this->message[$pos] = array('cdata' => '');
+ $this->message[$pos] = array('cdata' => '');
if ($depth > 0) {
$this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
} else {
@@ -1274,7 +1274,7 @@ function schemaStartElement($parser, $name, $attrs) {
} else {
$prefix = '';
}
-
+
// loop thru attributes, expanding, and registering namespace declarations
if(count($attrs) > 0){
foreach($attrs as $k => $v){
@@ -1350,7 +1350,7 @@ function schemaStartElement($parser, $name, $attrs) {
$aname = $attrs['ref'];
$this->attributes[$attrs['ref']] = $attrs;
}
-
+
if($this->currentComplexType){ // This should *always* be
$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
}
@@ -1643,8 +1643,8 @@ function serializeSchema(){
$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
}
}
- }
- }
+ }
+ }
// complex types
foreach($this->complexTypes as $typeName => $attrs){
$contentStr = '';
@@ -1941,12 +1941,12 @@ function typeToForm($name,$type){
}
return $buffer;
}
-
+
/**
* adds a complex type to the schema
- *
+ *
* example: array
- *
+ *
* addType(
* 'ArrayOfstring',
* 'complexType',
@@ -1956,9 +1956,9 @@ function typeToForm($name,$type){
* array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
* 'xsd:string'
* );
- *
+ *
* example: PHP associative array ( SOAP Struct )
- *
+ *
* addType(
* 'SOAPStruct',
* 'complexType',
@@ -1966,7 +1966,7 @@ function typeToForm($name,$type){
* 'all',
* array('myVar'=> array('name'=>'myVar','type'=>'string')
* );
- *
+ *
* @param name
* @param typeClass (complexType|simpleType|attribute)
* @param phpType: currently supported are array and struct (php assoc array)
@@ -1994,11 +1994,11 @@ function addComplexType($name,$typeClass='complexType',$phpType='array',$composi
'attrs' => $attrs,
'arrayType' => $arrayType
);
-
+
$this->xdebug("addComplexType $name:");
$this->appendDebug($this->varDump($this->complexTypes[$name]));
}
-
+
/**
* adds a simple type to the schema
*
@@ -2019,7 +2019,7 @@ function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $php
'type' => $restrictionBase,
'enumeration' => $enumeration
);
-
+
$this->xdebug("addSimpleType $name:");
$this->appendDebug($this->varDump($this->simpleTypes[$name]));
}
@@ -2037,7 +2037,7 @@ function addElement($attrs) {
}
$this->elements[ $attrs['name'] ] = $attrs;
$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
-
+
$this->xdebug("addElement " . $attrs['name']);
$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
}
@@ -2119,8 +2119,8 @@ class soapval extends nusoap_base {
* @param mixed $attributes associative array of attributes to add to element serialization
* @access public
*/
- function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
- parent::nusoap_base();
+ function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
+ parent::__construct();
$this->name = $name;
$this->type = $type;
$this->value = $value;
@@ -2211,8 +2211,8 @@ class soap_transport_http extends nusoap_base {
* @param boolean $use_curl Whether to try to force cURL use
* @access public
*/
- function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
- parent::nusoap_base();
+ function __construct($url, $curl_options = NULL, $use_curl = false){
+ parent::__construct();
$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
$this->appendDebug($this->varDump($curl_options));
$this->setURL($url);
@@ -2276,12 +2276,12 @@ function setURL($url) {
$this->debug("parsed URL $k = $v");
$this->$k = $v;
}
-
+
// add any GET params to path
if(isset($u['query']) && $u['query'] != ''){
$this->path .= '?' . $u['query'];
}
-
+
// set default port
if(!isset($u['port'])){
if($u['scheme'] == 'https'){
@@ -2290,10 +2290,10 @@ function setURL($url) {
$this->port = 80;
}
}
-
+
$this->uri = $this->path;
$this->digest_uri = $this->uri;
-
+
// build headers
if (!isset($u['port'])) {
$this->setHeader('Host', $this->host);
@@ -2373,7 +2373,7 @@ function connect($connection_timeout=0,$response_timeout=30){
} else {
$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
}
-
+
// test pointer
if(!$this->fp) {
$msg = 'Couldn\'t open socket connection to server ' . $this->url;
@@ -2386,7 +2386,7 @@ function connect($connection_timeout=0,$response_timeout=30){
$this->setError($msg);
return false;
}
-
+
// set response timeout
$this->debug('set response timeout to ' . $response_timeout);
socket_set_timeout( $this->fp, $response_timeout);
@@ -2475,10 +2475,10 @@ function connect($connection_timeout=0,$response_timeout=30){
// recent versions of cURL turn on peer/host checking by default,
// while PHP binaries are not compiled with a default location for the
// CA cert bundle, so disable peer/host checking.
- //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
+ //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
$this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0);
$this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0);
-
+
// support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo)
if ($this->authtype == 'certificate') {
$this->debug('set cURL certificate options');
@@ -2493,7 +2493,7 @@ function connect($connection_timeout=0,$response_timeout=30){
if (isset($this->certRequest['verifyhost'])) {
$this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
} else {
- $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2);
+ $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
}
if (isset($this->certRequest['sslcertfile'])) {
$this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
@@ -2565,7 +2565,7 @@ function connect($connection_timeout=0,$response_timeout=30){
* @access public
*/
function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
-
+
$this->debug('entered send() with data of length: '.strlen($data));
$this->tryagain = true;
@@ -2577,18 +2577,18 @@ function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
if (!$this->connect($timeout, $response_timeout)){
return false;
}
-
+
// send request
if (!$this->sendRequest($data, $cookies)){
return false;
}
-
+
// get response
$respdata = $this->getResponse();
} else {
$this->setError("Too many tries to get an OK response ($this->response_status_line)");
}
- }
+ }
$this->debug('end of send()');
return $respdata;
}
@@ -2608,7 +2608,7 @@ function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
return $this->send($data, $timeout, $response_timeout, $cookies);
}
-
+
/**
* if authenticating, set user credentials here
*
@@ -2630,21 +2630,21 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
} elseif ($authtype == 'digest') {
if (isset($digestRequest['nonce'])) {
$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
-
+
// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
-
+
// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
-
+
// H(A1) = MD5(A1)
$HA1 = md5($A1);
-
+
// A2 = Method ":" digest-uri-value
$A2 = $this->request_method . ':' . $this->digest_uri;
-
+
// H(A2)
$HA2 = md5($A2);
-
+
// KD(secret, data) = H(concat(secret, ":", data))
// if qop == auth:
// request-digest = <"> < KD ( H(A1), unq(nonce-value)
@@ -2655,7 +2655,7 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
// ) <">
// if qop is missing,
// request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
-
+
$unhashedDigest = '';
$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
$cnonce = $nonce;
@@ -2664,10 +2664,10 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
} else {
$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
}
-
+
$hashedDigest = md5($unhashedDigest);
-
- $opaque = '';
+
+ $opaque = '';
if (isset($digestRequest['opaque'])) {
$opaque = ', opaque="' . $digestRequest['opaque'] . '"';
}
@@ -2686,7 +2686,7 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
$this->authtype = $authtype;
$this->digestRequest = $digestRequest;
}
-
+
/**
* set the soapaction value
*
@@ -2696,7 +2696,7 @@ function setCredentials($username, $password, $authtype = 'basic', $digestReques
function setSOAPAction($soapaction) {
$this->setHeader('SOAPAction', '"' . $soapaction . '"');
}
-
+
/**
* use http encoding
*
@@ -2716,7 +2716,7 @@ function setEncoding($enc='gzip, deflate') {
$this->encoding = $enc;
}
}
-
+
/**
* set proxy info here
*
@@ -2745,7 +2745,7 @@ function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword =
unsetHeader('Proxy-Authorization');
}
}
-
+
/**
* Test if the given string starts with a header that is to be skipped.
@@ -2786,7 +2786,7 @@ function decodeChunked($buffer, $lb){
// length := 0
$length = 0;
$new = '';
-
+
// read chunk-size, chunk-extension (if any) and CRLF
// get the position of the linebreak
$chunkend = strpos($buffer, $lb);
@@ -2801,7 +2801,7 @@ function decodeChunked($buffer, $lb){
while ($chunk_size > 0) {
$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
-
+
// Just in case we got a broken connection
if ($chunkend == FALSE) {
$chunk = substr($buffer,$chunkstart);
@@ -2810,7 +2810,7 @@ function decodeChunked($buffer, $lb){
$length += strlen($chunk);
break;
}
-
+
// read chunk-data and CRLF
$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
// append chunk-data to entity-body
@@ -2819,7 +2819,7 @@ function decodeChunked($buffer, $lb){
$length += strlen($chunk);
// read chunk-size and CRLF
$chunkstart = $chunkend + strlen($lb);
-
+
$chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb);
if ($chunkend == FALSE) {
break; //Just in case we got a broken connection
@@ -2830,7 +2830,7 @@ function decodeChunked($buffer, $lb){
}
return $new;
}
-
+
/**
* Writes the payload, including HTTP headers, to $this->outgoing_payload.
*
@@ -2875,7 +2875,7 @@ function buildPayload($data, $cookie_str = '') {
// header/body separator
$this->outgoing_payload .= "\r\n";
-
+
// add data
$this->outgoing_payload .= $data;
}
@@ -2947,7 +2947,7 @@ function sendRequest($data, $cookies = NULL) {
*/
function getResponse(){
$this->incoming_payload = '';
-
+
if ($this->io_method() == 'socket') {
// loop until headers have been retrieved
$data = '';
@@ -3018,7 +3018,7 @@ function getResponse(){
$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
}
}
-
+
// loop until msg has been received
if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
$content_length = 2147483647; // ignore any content-length header
@@ -3084,22 +3084,22 @@ function getResponse(){
$this->debug('read body of length ' . strlen($data));
$this->incoming_payload .= $data;
$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
-
+
// close filepointer
if(
- (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
+ (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') ||
(! $this->persistentConnection) || feof($this->fp)){
fclose($this->fp);
$this->fp = false;
$this->debug('closed socket');
}
-
+
// connection was closed unexpectedly
if($this->incoming_payload == ''){
$this->setError('no response from server');
return false;
}
-
+
// decode transfer-encoding
// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){
// if(!$data = $this->decodeChunked($data, $lb)){
@@ -3110,7 +3110,7 @@ function getResponse(){
// set decoded payload
// $this->incoming_payload = $header_data.$lb.$lb.$data;
// }
-
+
} else if ($this->io_method() == 'curl') {
// send and receive
$this->debug('send and receive with cURL');
@@ -3136,7 +3136,7 @@ function getResponse(){
// close curl
$this->debug('No cURL error, closing cURL');
curl_close($this->ch);
-
+
// try removing skippable headers
$savedata = $data;
while ($this->isSkippableCurlHeader($data)) {
@@ -3159,7 +3159,7 @@ function getResponse(){
}
}
}
-
+
// separate content from HTTP headers
if ($pos = strpos($data,"\r\n\r\n")) {
$lb = "\r\n";
@@ -3219,7 +3219,7 @@ function getResponse(){
$this->debug('Server wants digest authentication');
// remove "Digest " from our elements
$digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
-
+
// parse elements into array
$digestElements = explode(',', $digestString);
foreach ($digestElements as $val) {
@@ -3238,7 +3238,7 @@ function getResponse(){
$this->setError('HTTP authentication failed');
return false;
}
-
+
if (
($http_status >= 300 && $http_status <= 307) ||
($http_status >= 400 && $http_status <= 417) ||
@@ -3306,13 +3306,13 @@ function getResponse(){
} else {
$this->debug('No Content-Encoding header');
}
-
+
if(strlen($data) == 0){
$this->debug('no data after headers!');
$this->setError('no data present after HTTP headers');
return false;
}
-
+
return $data;
}
@@ -3384,7 +3384,7 @@ function parseCookie($cookie_str) {
} else {
$path = '/';
}
-
+
$cookie_param = ';secure;';
if (strpos($cookie_str, $cookie_param) !== FALSE) {
$secure = true;
@@ -3403,12 +3403,12 @@ function parseCookie($cookie_str) {
'path' => $path,
'expires' => $expires,
'secure' => $secure
- );
+ );
return $cookie;
}
return false;
}
-
+
/**
* sort out cookies for the current request
*
@@ -3628,8 +3628,8 @@ class nusoap_server extends nusoap_base {
* @param mixed $wsdl file path or URL (string), or wsdl instance (object)
* @access public
*/
- function nusoap_server($wsdl=false){
- parent::nusoap_base();
+ function __construct($wsdl=false){
+ parent::__construct();
// turn on debugging?
global $debug;
global $HTTP_SERVER_VARS;
@@ -4235,7 +4235,7 @@ function send_response() {
//begin code to compress payload - by John
// NOTE: there is no way to know whether the Web server will also compress
// this data.
- if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
+ if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
if (strstr($this->headers['accept-encoding'], 'gzip')) {
if (function_exists('gzencode')) {
if (isset($this->debug_flag) && $this->debug_flag) {
@@ -4362,7 +4362,7 @@ function parseRequest($headers, $data) {
function getHTTPBody($soapmsg) {
return $soapmsg;
}
-
+
/**
* gets the HTTP content type for the current response.
*
@@ -4374,7 +4374,7 @@ function getHTTPBody($soapmsg) {
function getHTTPContentType() {
return 'text/xml';
}
-
+
/**
* gets the HTTP content type charset for the current response.
* returns false for non-text content types.
@@ -4533,7 +4533,7 @@ function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style=
if(false == $namespace) {
$namespace = "http://$SERVER_NAME/soap/$serviceName";
}
-
+
if(false == $endpoint) {
if ($HTTPS == '1' || $HTTPS == 'on') {
$SCHEME = 'https';
@@ -4542,11 +4542,11 @@ function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style=
}
$endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
}
-
+
if(false == $schemaTargetNamespace) {
$schemaTargetNamespace = $namespace;
}
-
+
$this->wsdl = new wsdl;
$this->wsdl->serviceName = $serviceName;
$this->wsdl->endpoint = $endpoint;
@@ -4588,15 +4588,15 @@ class soap_server extends nusoap_server {
/**
* parses a WSDL file, allows access to it's data, other utility methods.
* also builds WSDL structures programmatically.
-*
+*
* @author Dietrich Ayala
* @author Scott Nichol
* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
-* @access public
+* @access public
*/
class wsdl extends nusoap_base {
// URL or filename of the root of this WSDL
- var $wsdl;
+ var $wsdl;
// define internal arrays of bindings, ports, operations, messages, etc.
var $schemas = array();
var $currentSchema;
@@ -4614,9 +4614,9 @@ class wsdl extends nusoap_base {
var $opData = array();
var $status = '';
var $documentation = false;
- var $endpoint = '';
+ var $endpoint = '';
// array of wsdl docs to import
- var $import = array();
+ var $import = array();
// parser vars
var $parser;
var $position = 0;
@@ -4639,7 +4639,7 @@ class wsdl extends nusoap_base {
/**
* constructor
- *
+ *
* @param string $wsdl WSDL document URL
* @param string $proxyhost
* @param string $proxyport
@@ -4649,10 +4649,10 @@ class wsdl extends nusoap_base {
* @param integer $response_timeout set the response timeout
* @param array $curl_options user-specified cURL options
* @param boolean $use_curl try to use cURL
- * @access public
+ * @access public
*/
- function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
- parent::nusoap_base();
+ function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
+ parent::__construct();
$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
$this->proxyhost = $proxyhost;
$this->proxyport = $proxyport;
@@ -4715,7 +4715,7 @@ function fetchWSDL($wsdl) {
}
}
}
- }
+ }
}
}
// WSDL imports
@@ -4741,18 +4741,18 @@ function fetchWSDL($wsdl) {
}
}
}
- }
+ }
}
// add new data to operation data
foreach($this->bindings as $binding => $bindingData) {
if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
foreach($bindingData['operations'] as $operation => $data) {
$this->debug('post-parse data gathering for ' . $operation);
- $this->bindings[$binding]['operations'][$operation]['input'] =
- isset($this->bindings[$binding]['operations'][$operation]['input']) ?
+ $this->bindings[$binding]['operations'][$operation]['input'] =
+ isset($this->bindings[$binding]['operations'][$operation]['input']) ?
array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
- $this->bindings[$binding]['operations'][$operation]['output'] =
+ $this->bindings[$binding]['operations'][$operation]['output'] =
isset($this->bindings[$binding]['operations'][$operation]['output']) ?
array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
@@ -4769,16 +4769,16 @@ function fetchWSDL($wsdl) {
$this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
$this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
$this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
- }
- }
+ }
+ }
}
}
/**
* parses the wsdl document
- *
+ *
* @param string $wsdl path or URL
- * @access private
+ * @access private
*/
function parseWSDL($wsdl = '') {
$this->debug("parse WSDL at path=$wsdl");
@@ -4788,7 +4788,7 @@ function parseWSDL($wsdl = '') {
$this->setError('no wsdl passed to parseWSDL()!!');
return false;
}
-
+
// parse $wsdl for url format
$wsdl_props = parse_url($wsdl);
@@ -4831,24 +4831,24 @@ function parseWSDL($wsdl = '') {
$wsdl_string = '';
while ($data = fread($fp, 32768)) {
$wsdl_string .= $data;
- }
+ }
fclose($fp);
} else {
$errstr = "Bad path to WSDL file $path";
$this->debug($errstr);
$this->setError($errstr);
return false;
- }
+ }
}
$this->debug('Parse WSDL');
// end new code added
// Create an XML parser.
- $this->parser = xml_parser_create();
+ $this->parser = xml_parser_create();
// Set the options for parsing the XML data.
// xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
- xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
// Set the object for the parser.
- xml_set_object($this->parser, $this);
+ xml_set_object($this->parser, $this);
// Set the element handlers for the parser.
xml_set_element_handler($this->parser, 'start_element', 'end_element');
xml_set_character_data_handler($this->parser, 'character_data');
@@ -4865,7 +4865,7 @@ function parseWSDL($wsdl = '') {
$this->debug("XML payload:\n" . $wsdl_string);
$this->setError($errstr);
return false;
- }
+ }
// free the parser
xml_parser_free($this->parser);
$this->debug('Parsing WSDL done');
@@ -4874,15 +4874,15 @@ function parseWSDL($wsdl = '') {
return false;
}
return true;
- }
+ }
/**
* start-element handler
- *
+ *
* @param string $parser XML parser object
* @param string $name element name
* @param string $attrs associative array of attributes
- * @access private
+ * @access private
*/
function start_element($parser, $name, $attrs)
{
@@ -4901,10 +4901,10 @@ function start_element($parser, $name, $attrs)
} else {
// position in the total number of elements, starting from 0
$pos = $this->position++;
- $depth = $this->depth++;
+ $depth = $this->depth++;
// set self as current value for this depth
$this->depth_array[$depth] = $pos;
- $this->message[$pos] = array('cdata' => '');
+ $this->message[$pos] = array('cdata' => '');
// process attributes
if (count($attrs) > 0) {
// register namespace declarations
@@ -4914,11 +4914,11 @@ function start_element($parser, $name, $attrs)
$this->namespaces[$ns_prefix] = $v;
} else {
$this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
- }
+ }
if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
$this->XMLSchemaVersion = $v;
$this->namespaces['xsi'] = $v . '-instance';
- }
+ }
}
}
// expand each attribute prefix to its namespace
@@ -4926,22 +4926,22 @@ function start_element($parser, $name, $attrs)
$k = strpos($k, ':') ? $this->expandQname($k) : $k;
if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
$v = strpos($v, ':') ? $this->expandQname($v) : $v;
- }
+ }
$eAttrs[$k] = $v;
- }
+ }
$attrs = $eAttrs;
} else {
$attrs = array();
- }
+ }
// get element prefix, namespace and name
if (preg_match('/:/', $name)) {
// get ns prefix
- $prefix = substr($name, 0, strpos($name, ':'));
+ $prefix = substr($name, 0, strpos($name, ':'));
// get ns
- $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
+ $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
// get unqualified name
$name = substr(strstr($name, ':'), 1);
- }
+ }
// process attributes, expanding any prefixes to namespaces
// find status, register data
switch ($this->status) {
@@ -4950,12 +4950,12 @@ function start_element($parser, $name, $attrs)
if (isset($attrs['type'])) {
$this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
$this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
- }
+ }
if (isset($attrs['element'])) {
$this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
$this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
- }
- }
+ }
+ }
break;
case 'portType':
switch ($name) {
@@ -4964,25 +4964,25 @@ function start_element($parser, $name, $attrs)
$this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
if (isset($attrs['parameterOrder'])) {
$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
- }
+ }
break;
case 'documentation':
$this->documentation = true;
- break;
+ break;
// merge input/output data
default:
$m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
$this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
break;
- }
+ }
break;
case 'binding':
switch ($name) {
- case 'binding':
+ case 'binding':
// get ns prefix
if (isset($attrs['style'])) {
$this->bindings[$this->currentBinding]['prefix'] = $prefix;
- }
+ }
$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
break;
case 'header':
@@ -4991,17 +4991,17 @@ function start_element($parser, $name, $attrs)
case 'operation':
if (isset($attrs['soapAction'])) {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
- }
+ }
if (isset($attrs['style'])) {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
- }
+ }
if (isset($attrs['name'])) {
$this->currentOperation = $attrs['name'];
$this->debug("current binding operation: $this->currentOperation");
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
- }
+ }
break;
case 'input':
$this->opStatus = 'input';
@@ -5014,9 +5014,9 @@ function start_element($parser, $name, $attrs)
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
} else {
$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
- }
+ }
break;
- }
+ }
break;
case 'service':
switch ($name) {
@@ -5024,7 +5024,7 @@ function start_element($parser, $name, $attrs)
$this->currentPort = $attrs['name'];
$this->debug('current port: ' . $this->currentPort);
$this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
-
+
break;
case 'address':
$this->ports[$this->currentPort]['location'] = $attrs['location'];
@@ -5032,9 +5032,9 @@ function start_element($parser, $name, $attrs)
$this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
$this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
break;
- }
+ }
break;
- }
+ }
// set status
switch ($name) {
case 'import':
@@ -5070,11 +5070,11 @@ function start_element($parser, $name, $attrs)
$this->currentBinding = $this->getLocalPart($attrs['name']);
} else {
$this->currentBinding = $attrs['name'];
- }
+ }
$this->status = 'binding';
$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
- }
+ }
break;
case 'service':
$this->serviceName = $attrs['name'];
@@ -5084,20 +5084,20 @@ function start_element($parser, $name, $attrs)
case 'definitions':
foreach ($attrs as $name => $value) {
$this->wsdl_info[$name] = $value;
- }
+ }
break;
- }
- }
- }
+ }
+ }
+ }
/**
* end-element handler
- *
+ *
* @param string $parser XML parser object
* @param string $name element name
- * @access private
+ * @access private
*/
- function end_element($parser, $name){
+ function end_element($parser, $name){
// unset schema status
if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
$this->status = "";
@@ -5105,38 +5105,38 @@ function end_element($parser, $name){
$this->currentSchema->clearDebug();
$this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
$this->debug('Parsing WSDL schema done');
- }
+ }
if ($this->status == 'schema') {
$this->currentSchema->schemaEndElement($parser, $name);
} else {
// bring depth down a notch
$this->depth--;
- }
+ }
// end documentation
if ($this->documentation) {
//TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
//$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
$this->documentation = false;
- }
- }
+ }
+ }
/**
* element content handler
- *
+ *
* @param string $parser XML parser object
* @param string $data element content
- * @access private
+ * @access private
*/
function character_data($parser, $data)
{
$pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
if (isset($this->message[$pos]['cdata'])) {
$this->message[$pos]['cdata'] .= $data;
- }
+ }
if ($this->documentation) {
$this->documentation .= $data;
- }
- }
+ }
+ }
/**
* if authenticating, set user credentials here
@@ -5155,21 +5155,21 @@ function setCredentials($username, $password, $authtype = 'basic', $certRequest
$this->authtype = $authtype;
$this->certRequest = $certRequest;
}
-
+
function getBindingData($binding)
{
if (is_array($this->bindings[$binding])) {
return $this->bindings[$binding];
- }
+ }
}
-
+
/**
* returns an assoc array of operation names => operation data
- *
+ *
* @param string $portName WSDL port name
* @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported)
- * @return array
- * @access public
+ * @return array
+ * @access public
*/
function getOperations($portName = '', $bindingType = 'soap') {
$ops = array();
@@ -5201,15 +5201,15 @@ function getOperations($portName = '', $bindingType = 'soap') {
$this->debug("getOperations found no operations for port '$portName' bindingType $bindingType");
}
return $ops;
- }
-
+ }
+
/**
* returns an associative array of data necessary for calling an operation
- *
+ *
* @param string $operation name of operation
* @param string $bindingType type of binding eg: soap, soap12
- * @return array
- * @access public
+ * @return array
+ * @access public
*/
function getOperationData($operation, $bindingType = 'soap')
{
@@ -5229,19 +5229,19 @@ function getOperationData($operation, $bindingType = 'soap')
if ($operation == $bOperation) {
$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
return $opData;
- }
- }
+ }
+ }
}
- }
+ }
}
-
+
/**
* returns an associative array of data necessary for calling an operation
- *
+ *
* @param string $soapAction soapAction for operation
* @param string $bindingType type of binding eg: soap, soap12
- * @return array
- * @access public
+ * @return array
+ * @access public
*/
function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
if ($bindingType == 'soap') {
@@ -5257,12 +5257,12 @@ function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') {
foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
if ($opData['soapAction'] == $soapAction) {
return $opData;
- }
- }
+ }
+ }
}
- }
+ }
}
-
+
/**
* returns an array of information about a given type
* returns false if no type exists by the given name
@@ -5473,7 +5473,7 @@ function popout(){ // Hides message
*
* @param mixed $debug whether to put debug=1 in endpoint URL
* @return string serialization of WSDL
- * @access public
+ * @access public
*/
function serialize($debug = 0)
{
@@ -5481,15 +5481,15 @@ function serialize($debug = 0)
$xml .= "\nnamespaces as $k => $v) {
$xml .= " xmlns:$k=\"$v\"";
- }
+ }
// 10.9.02 - add poulter fix for wsdl and tns declarations
if (isset($this->namespaces['wsdl'])) {
$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
- }
+ }
if (isset($this->namespaces['tns'])) {
$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
- }
- $xml .= '>';
+ }
+ $xml .= '>';
// imports
if (sizeof($this->import) > 0) {
foreach($this->import as $ns => $list) {
@@ -5500,8 +5500,8 @@ function serialize($debug = 0)
$xml .= '';
}
}
- }
- }
+ }
+ }
// types
if (count($this->schemas)>=1) {
$xml .= "\n\n";
@@ -5511,7 +5511,7 @@ function serialize($debug = 0)
}
}
$xml .= '';
- }
+ }
// messages
if (count($this->messages) >= 1) {
foreach($this->messages as $msgName => $msgParts) {
@@ -5528,11 +5528,11 @@ function serialize($debug = 0)
foreach($this->typemap as $ns => $types) {
if (isset($types[$partType])) {
$typePrefix = $this->getPrefixFromNamespace($ns);
- }
- }
+ }
+ }
if (!isset($typePrefix)) {
die("$partType has no namespace!");
- }
+ }
}
$ns = $this->getNamespaceFromPrefix($typePrefix);
$localPart = $this->getLocalPart($partType);
@@ -5549,8 +5549,8 @@ function serialize($debug = 0)
}
}
$xml .= '';
- }
- }
+ }
+ }
// bindings & porttypes
if (count($this->bindings) >= 1) {
$binding_xml = '';
@@ -5578,7 +5578,7 @@ function serialize($debug = 0)
$portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . '';
@@ -5586,12 +5586,12 @@ function serialize($debug = 0)
$portType_xml .= "\n" . ' ';
$portType_xml .= "\n" . ' ';
$portType_xml .= "\n" . ' ';
- }
+ }
$portType_xml .= "\n" . '';
$binding_xml .= "\n" . '';
- }
+ }
$xml .= $portType_xml . $binding_xml;
- }
+ }
// services
$xml .= "\nserviceName . '">';
if (count($this->ports) >= 1) {
@@ -5599,11 +5599,11 @@ function serialize($debug = 0)
$xml .= "\n" . ' ';
$xml .= "\n" . ' ';
$xml .= "\n" . ' ';
- }
- }
+ }
+ }
$xml .= "\n" . '';
return $xml . "\n";
- }
+ }
/**
* determine whether a set of parameters are unwrapped
@@ -5648,7 +5648,7 @@ function parametersMatchWrapped($type, &$parameters) {
$phpType = $typeDef['phpType'];
$arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
$this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
-
+
// we expect a complexType or element of complexType
if ($phpType != 'struct') {
$this->debug("in parametersMatchWrapped: not a struct");
@@ -5689,7 +5689,7 @@ function parametersMatchWrapped($type, &$parameters) {
* TODO
* - multi-ref serialization
* - validate PHP values against type definitions, return errors if invalid
- *
+ *
* @param string $operation operation name
* @param string $direction (input|output)
* @param mixed $parameters parameter value(s)
@@ -5700,12 +5700,12 @@ function parametersMatchWrapped($type, &$parameters) {
function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') {
$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
$this->appendDebug('parameters=' . $this->varDump($parameters));
-
+
if ($direction != 'input' && $direction != 'output') {
$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
return false;
- }
+ }
if (!$opData = $this->getOperationData($operation, $bindingType)) {
$this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
$this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
@@ -5756,7 +5756,7 @@ function serializeRPCParameters($operation, $direction, $parameters, $bindingTyp
$this->debug("serializing part $name of type $type");
// Track encoding style
if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
- $encodingStyle = $opData[$direction]['encodingStyle'];
+ $encodingStyle = $opData[$direction]['encodingStyle'];
$enc_style = $encodingStyle;
} else {
$enc_style = false;
@@ -5782,15 +5782,15 @@ function serializeRPCParameters($operation, $direction, $parameters, $bindingTyp
}
$this->debug("serializeRPCParameters returning: $xml");
return $xml;
- }
-
+ }
+
/**
* serialize a PHP value according to a WSDL message definition
- *
+ *
* TODO
* - multi-ref serialization
* - validate PHP values against type definitions, return errors if invalid
- *
+ *
* @param string $operation operation name
* @param string $direction (input|output)
* @param mixed $parameters parameter value(s)
@@ -5800,14 +5800,14 @@ function serializeRPCParameters($operation, $direction, $parameters, $bindingTyp
*/
function serializeParameters($operation, $direction, $parameters)
{
- $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
+ $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
$this->appendDebug('parameters=' . $this->varDump($parameters));
-
+
if ($direction != 'input' && $direction != 'output') {
$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
$this->setError('The value of the \$direction argument needs to be either "input" or "output"');
return false;
- }
+ }
if (!$opData = $this->getOperationData($operation)) {
$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
@@ -5815,18 +5815,18 @@ function serializeParameters($operation, $direction, $parameters)
}
$this->debug('opData:');
$this->appendDebug($this->varDump($opData));
-
+
// Get encoding style for output and set to current
$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
$encodingStyle = $opData['output']['encodingStyle'];
$enc_style = $encodingStyle;
}
-
+
// set input params
$xml = '';
if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
-
+
$use = $opData[$direction]['use'];
$this->debug("use=$use");
$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
@@ -5837,7 +5837,7 @@ function serializeParameters($operation, $direction, $parameters)
$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
// Track encoding style
if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
- $encodingStyle = $opData[$direction]['encodingStyle'];
+ $encodingStyle = $opData[$direction]['encodingStyle'];
$enc_style = $encodingStyle;
} else {
$enc_style = false;
@@ -5863,11 +5863,11 @@ function serializeParameters($operation, $direction, $parameters)
}
$this->debug("serializeParameters returning: $xml");
return $xml;
- }
-
+ }
+
/**
* serializes a PHP value according a given type definition
- *
+ *
* @param string $name name of value (part or element)
* @param string $type XML schema type of value (type or element)
* @param mixed $value a native PHP value (parameter value)
@@ -5953,7 +5953,7 @@ function serializeType($name, $type, $value, $use='encoded', $encodingStyle=fals
} else {
$value = 'true';
}
- }
+ }
if ($uqType == 'string' && gettype($value) == 'string') {
$value = $this->expandEntities($value);
}
@@ -6034,7 +6034,7 @@ function serializeType($name, $type, $value, $use='encoded', $encodingStyle=fals
return false;
}
$phpType = $typeDef['phpType'];
- $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
+ $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
// if php type == struct, map value to the element names
if ($phpType == 'struct') {
if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
@@ -6126,11 +6126,11 @@ function serializeType($name, $type, $value, $use='encoded', $encodingStyle=fals
foreach($value as $v) {
$cols = ',' . sizeof($v);
$nv = array_merge($nv, $v);
- }
+ }
$value = $nv;
} else {
$cols = '';
- }
+ }
if (is_array($value) && sizeof($value) >= 1) {
$rows = sizeof($value);
$contents = '';
@@ -6141,7 +6141,7 @@ function serializeType($name, $type, $value, $use='encoded', $encodingStyle=fals
$contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
} else {
$contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
- }
+ }
}
} else {
$rows = 0;
@@ -6185,7 +6185,7 @@ function serializeType($name, $type, $value, $use='encoded', $encodingStyle=fals
$this->debug("in serializeType: returning: $xml");
return $xml;
}
-
+
/**
* serializes the attributes for a complexType
*
@@ -6240,7 +6240,7 @@ function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) {
if ($xname) {
$xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
}
- }
+ }
} else {
$this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
}
@@ -6298,7 +6298,7 @@ function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='enco
}
// if user took advantage of a minOccurs=0, then only serialize named parameters
if (isset($optionals)
- && (!isset($xvalue[$eName]))
+ && (!isset($xvalue[$eName]))
&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
){
if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
@@ -6346,7 +6346,7 @@ function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='enco
}
}
}
- }
+ }
} else {
$this->debug("no elements to serialize for XML Schema type $ns:$uqType");
}
@@ -6382,7 +6382,7 @@ function addComplexType($name,$typeClass='complexType',$phpType='array',$composi
}
$elements = $eElements;
}
-
+
if (count($attrs) > 0) {
foreach($attrs as $n => $a){
// expand each attribute
@@ -6435,7 +6435,7 @@ function addElement($attrs) {
/**
* register an operation with the server
- *
+ *
* @param string $name operation (method) name
* @param array $in assoc array of input values: key = param name, value = param type
* @param array $out assoc array of output values: key = param name, value = param type
@@ -6445,7 +6445,7 @@ function addElement($attrs) {
* @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now)
* @param string $documentation optional The description to include in the WSDL
* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
- * @access public
+ * @access public
*/
function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
if ($use == 'encoded' && $encodingStyle == '') {
@@ -6492,7 +6492,7 @@ function addOperation($name, $in = false, $out = false, $namespace = false, $soa
'parts' => $out),
'namespace' => $namespace,
'transport' => 'http://schemas.xmlsoap.org/soap/http',
- 'documentation' => $documentation);
+ 'documentation' => $documentation);
// add portTypes
// add messages
if($in)
@@ -6520,7 +6520,7 @@ function addOperation($name, $in = false, $out = false, $namespace = false, $soa
$this->messages[$name.'Response']= '0';
}
return true;
- }
+ }
}
?>xml = $xml;
$this->xml_encoding = $encoding;
$this->method = $method;
@@ -6840,7 +6840,7 @@ function end_element($parser, $name) {
// get unqualified name
$name = substr(strstr($name,':'),1);
}
-
+
// build to native type
if(isset($this->body_position) && $pos > $this->body_position){
// deal w/ multirefs
@@ -6902,7 +6902,7 @@ function end_element($parser, $name) {
*/
}
}
-
+
// for doclit
if($this->status == 'header'){
if ($this->root_header != $pos) {
@@ -7258,8 +7258,8 @@ class nusoap_client extends nusoap_base {
* @param string $portName optional portName in WSDL document
* @access public
*/
- function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
- parent::nusoap_base();
+ function __construct($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
+ parent::__construct();
$this->endpoint = $endpoint;
$this->proxyhost = $proxyhost;
$this->proxyport = $proxyport;
@@ -7327,7 +7327,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->faultstring = '';
$this->faultcode = '';
$this->opData = array();
-
+
$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
$this->appendDebug('params=' . $this->varDump($params));
$this->appendDebug('headers=' . $this->varDump($headers));
@@ -7398,7 +7398,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
// no WSDL
//$this->namespaces['ns1'] = $namespace;
$nsPrefix = 'ns' . rand(1000, 9999);
- // serialize
+ // serialize
$payload = '';
if ($use = 'literal wrapped') {
// 'literal wrapped' is only sensible (and defined) for 'document'.
@@ -7479,7 +7479,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->return = $return;
$this->debug('sent message successfully and got a(n) '.gettype($return));
$this->appendDebug('return=' . $this->varDump($return));
-
+
// fault?
if(is_array($return) && isset($return['faultcode'])){
$this->debug('got fault');
@@ -7487,10 +7487,7 @@ function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAc
$this->fault = true;
foreach($return as $k => $v){
$this->$k = $v;
- if(is_scalar($v))
- $this->debug("$k = $v
");
- else
- $this->debug("$k = ".print_r($v, true)."
");
+ $this->debug("$k = $v
");
}
return $return;
} elseif ($style == 'document') {
@@ -7651,7 +7648,7 @@ function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
$this->persistentConnection = $http;
}
}
-
+
if($err = $http->getError()){
$this->setError('HTTP Error: '.$err);
return false;
@@ -7815,7 +7812,7 @@ function setCredentials($username, $password, $authtype = 'basic', $certRequest
$this->authtype = $authtype;
$this->certRequest = $certRequest;
}
-
+
/**
* use HTTP encoding
*
@@ -7826,7 +7823,7 @@ function setHTTPEncoding($enc='gzip, deflate'){
$this->debug("setHTTPEncoding(\"$enc\")");
$this->http_encoding = $enc;
}
-
+
/**
* Set whether to try to use cURL connections if possible
*
@@ -7847,7 +7844,7 @@ function useHTTPPersistentConnection(){
$this->debug("useHTTPPersistentConnection");
$this->persistentConnection = true;
}
-
+
/**
* gets the default RPC parameter setting.
* If true, default is that call params are like RPC even for document style.
@@ -7877,7 +7874,7 @@ function getDefaultRpcParams() {
function setDefaultRpcParams($rpcParams) {
$this->defaultRpcParams = $rpcParams;
}
-
+
/**
* dynamically creates an instance of a proxy class,
* allowing user to directly call methods from wsdl
@@ -8007,7 +8004,7 @@ function getProxyClassCode() {
function getHTTPBody($soapmsg) {
return $soapmsg;
}
-
+
/**
* gets the HTTP content type for the current request.
*
@@ -8019,7 +8016,7 @@ function getHTTPBody($soapmsg) {
function getHTTPContentType() {
return 'text/xml';
}
-
+
/**
* gets the HTTP content type charset for the current request.
* returns false for non-text content types.