@@ -23,39 +23,39 @@ discard block |
||
23 | 23 | * @version $Id: class.soapclient.php,v 1.69 2010/04/26 20:15:08 snichol Exp $ |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class nusoap_client extends nusoap_base { |
|
27 | - |
|
28 | - var $username = ''; // Username for HTTP authentication |
|
29 | - var $password = ''; // Password for HTTP authentication |
|
30 | - var $authtype = ''; // Type of HTTP authentication |
|
31 | - var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
32 | - var $requestHeaders = false; // SOAP headers in request (text) |
|
33 | - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) |
|
34 | - var $responseHeader = NULL; // SOAP Header from response (parsed) |
|
35 | - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) |
|
26 | +class nusoap_client extends nusoap_base { |
|
27 | + |
|
28 | + var $username = ''; // Username for HTTP authentication |
|
29 | + var $password = ''; // Password for HTTP authentication |
|
30 | + var $authtype = ''; // Type of HTTP authentication |
|
31 | + var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
32 | + var $requestHeaders = false; // SOAP headers in request (text) |
|
33 | + var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) |
|
34 | + var $responseHeader = NULL; // SOAP Header from response (parsed) |
|
35 | + var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) |
|
36 | 36 | var $endpoint; |
37 | - var $forceEndpoint = ''; // overrides WSDL endpoint |
|
37 | + var $forceEndpoint = ''; // overrides WSDL endpoint |
|
38 | 38 | var $proxyhost = ''; |
39 | 39 | var $proxyport = ''; |
40 | 40 | var $proxyusername = ''; |
41 | 41 | var $proxypassword = ''; |
42 | - var $portName = ''; // port name to use in WSDL |
|
43 | - var $xml_encoding = ''; // character set encoding of incoming (response) messages |
|
42 | + var $portName = ''; // port name to use in WSDL |
|
43 | + var $xml_encoding = ''; // character set encoding of incoming (response) messages |
|
44 | 44 | var $http_encoding = false; |
45 | - var $timeout = 0; // HTTP connection timeout |
|
46 | - var $response_timeout = 30; // HTTP response timeout |
|
47 | - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error |
|
45 | + var $timeout = 0; // HTTP connection timeout |
|
46 | + var $response_timeout = 30; // HTTP response timeout |
|
47 | + var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error |
|
48 | 48 | var $persistentConnection = false; |
49 | - var $defaultRpcParams = false; // This is no longer used |
|
50 | - var $request = ''; // HTTP request |
|
51 | - var $response = ''; // HTTP response |
|
52 | - var $responseData = ''; // SOAP payload of response |
|
53 | - var $cookies = array(); // Cookies from response or for request |
|
54 | - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() |
|
55 | - var $operations = array(); // WSDL operations, empty for WSDL initialization error |
|
56 | - var $curl_options = array(); // User-specified cURL options |
|
57 | - var $bindingType = ''; // WSDL operation binding type |
|
58 | - var $use_curl = false; // whether to always try to use cURL |
|
49 | + var $defaultRpcParams = false; // This is no longer used |
|
50 | + var $request = ''; // HTTP request |
|
51 | + var $response = ''; // HTTP response |
|
52 | + var $responseData = ''; // SOAP payload of response |
|
53 | + var $cookies = array(); // Cookies from response or for request |
|
54 | + var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() |
|
55 | + var $operations = array(); // WSDL operations, empty for WSDL initialization error |
|
56 | + var $curl_options = array(); // User-specified cURL options |
|
57 | + var $bindingType = ''; // WSDL operation binding type |
|
58 | + var $use_curl = false; // whether to always try to use cURL |
|
59 | 59 | |
60 | 60 | /* |
61 | 61 | * fault related variables |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $portName optional portName in WSDL document |
96 | 96 | * @access public |
97 | 97 | */ |
98 | - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ |
|
98 | + function nusoap_client($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = '') { |
|
99 | 99 | parent::nusoap_base(); |
100 | 100 | $this->endpoint = $endpoint; |
101 | 101 | $this->proxyhost = $proxyhost; |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | $this->portName = $portName; |
108 | 108 | |
109 | 109 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
110 | - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); |
|
110 | + $this->appendDebug('endpoint='.$this->varDump($endpoint)); |
|
111 | 111 | |
112 | 112 | // make values |
113 | - if($wsdl){ |
|
113 | + if ($wsdl) { |
|
114 | 114 | if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { |
115 | 115 | $this->wsdl = $endpoint; |
116 | 116 | $this->endpoint = $this->wsdl->wsdl; |
117 | 117 | $this->wsdlFile = $this->endpoint; |
118 | - $this->debug('existing wsdl instance created from ' . $this->endpoint); |
|
118 | + $this->debug('existing wsdl instance created from '.$this->endpoint); |
|
119 | 119 | $this->checkWSDL(); |
120 | 120 | } else { |
121 | 121 | $this->wsdlFile = $this->endpoint; |
122 | 122 | $this->wsdl = null; |
123 | - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); |
|
123 | + $this->debug('will use lazy evaluation of wsdl from '.$this->endpoint); |
|
124 | 124 | } |
125 | 125 | $this->endpointType = 'wsdl'; |
126 | 126 | } else { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors |
155 | 155 | * @access public |
156 | 156 | */ |
157 | - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ |
|
157 | + function call($operation, $params = array(), $namespace = 'http://tempuri.org', $soapAction = '', $headers = false, $rpcParams = null, $style = 'rpc', $use = 'encoded') { |
|
158 | 158 | $this->operation = $operation; |
159 | 159 | $this->fault = false; |
160 | 160 | $this->setError(''); |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $this->opData = array(); |
167 | 167 | |
168 | 168 | $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); |
169 | - $this->appendDebug('params=' . $this->varDump($params)); |
|
170 | - $this->appendDebug('headers=' . $this->varDump($headers)); |
|
169 | + $this->appendDebug('params='.$this->varDump($params)); |
|
170 | + $this->appendDebug('headers='.$this->varDump($headers)); |
|
171 | 171 | if ($headers) { |
172 | 172 | $this->requestHeaders = $headers; |
173 | 173 | } |
@@ -177,25 +177,25 @@ discard block |
||
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | // serialize parameters |
180 | - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ |
|
180 | + if ($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)) { |
|
181 | 181 | // use WSDL for operation |
182 | 182 | $this->opData = $opData; |
183 | 183 | $this->debug("found operation"); |
184 | - $this->appendDebug('opData=' . $this->varDump($opData)); |
|
184 | + $this->appendDebug('opData='.$this->varDump($opData)); |
|
185 | 185 | if (isset($opData['soapAction'])) { |
186 | 186 | $soapAction = $opData['soapAction']; |
187 | 187 | } |
188 | - if (! $this->forceEndpoint) { |
|
188 | + if (!$this->forceEndpoint) { |
|
189 | 189 | $this->endpoint = $opData['endpoint']; |
190 | 190 | } else { |
191 | 191 | $this->endpoint = $this->forceEndpoint; |
192 | 192 | } |
193 | - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; |
|
193 | + $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; |
|
194 | 194 | $style = $opData['style']; |
195 | 195 | $use = $opData['input']['use']; |
196 | 196 | // add ns to ns array |
197 | - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ |
|
198 | - $nsPrefix = 'ns' . rand(1000, 9999); |
|
197 | + if ($namespace != '' && !isset($this->wsdl->namespaces[$namespace])) { |
|
198 | + $nsPrefix = 'ns'.rand(1000, 9999); |
|
199 | 199 | $this->wsdl->namespaces[$nsPrefix] = $namespace; |
200 | 200 | } |
201 | 201 | $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $payload = $params; |
206 | 206 | } elseif (is_array($params)) { |
207 | 207 | $this->debug("serializing param array for WSDL operation $operation"); |
208 | - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); |
|
208 | + $payload = $this->wsdl->serializeRPCParameters($operation, 'input', $params, $this->bindingType); |
|
209 | 209 | } else { |
210 | 210 | $this->debug('params must be array or string'); |
211 | 211 | $this->setError('params must be array or string'); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $this->setError('wsdl error: '.$errstr); |
225 | 225 | return false; |
226 | 226 | } |
227 | - } elseif($this->endpointType == 'wsdl') { |
|
227 | + } elseif ($this->endpointType == 'wsdl') { |
|
228 | 228 | // operation not in WSDL |
229 | 229 | $this->appendDebug($this->wsdl->getDebug()); |
230 | 230 | $this->wsdl->clearDebug(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } else { |
235 | 235 | // no WSDL |
236 | 236 | //$this->namespaces['ns1'] = $namespace; |
237 | - $nsPrefix = 'ns' . rand(1000, 9999); |
|
237 | + $nsPrefix = 'ns'.rand(1000, 9999); |
|
238 | 238 | // serialize |
239 | 239 | $payload = ''; |
240 | 240 | if (is_string($params)) { |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | $payload = $params; |
243 | 243 | } elseif (is_array($params)) { |
244 | 244 | $this->debug("serializing param array for operation $operation"); |
245 | - foreach($params as $k => $v){ |
|
246 | - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); |
|
245 | + foreach ($params as $k => $v) { |
|
246 | + $payload .= $this->serialize_val($v, $k, false, false, false, false, $use); |
|
247 | 247 | } |
248 | 248 | } else { |
249 | 249 | $this->debug('params must be array or string'); |
@@ -263,45 +263,45 @@ discard block |
||
263 | 263 | $this->debug("wrapping RPC request with literal method element"); |
264 | 264 | if ($namespace) { |
265 | 265 | // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace |
266 | - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . |
|
267 | - $payload . |
|
266 | + $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">". |
|
267 | + $payload. |
|
268 | 268 | "</$nsPrefix:$operation>"; |
269 | 269 | } else { |
270 | - $payload = "<$operation>" . $payload . "</$operation>"; |
|
270 | + $payload = "<$operation>".$payload."</$operation>"; |
|
271 | 271 | } |
272 | 272 | } else { |
273 | 273 | $this->debug("wrapping RPC request with encoded method element"); |
274 | 274 | if ($namespace) { |
275 | - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . |
|
276 | - $payload . |
|
275 | + $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">". |
|
276 | + $payload. |
|
277 | 277 | "</$nsPrefix:$operation>"; |
278 | 278 | } else { |
279 | - $payload = "<$operation>" . |
|
280 | - $payload . |
|
279 | + $payload = "<$operation>". |
|
280 | + $payload. |
|
281 | 281 | "</$operation>"; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | } |
285 | 285 | // serialize envelope |
286 | - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); |
|
286 | + $soapmsg = $this->serializeEnvelope($payload, $this->requestHeaders, $usedNamespaces, $style, $use, $encodingStyle); |
|
287 | 287 | $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); |
288 | - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); |
|
288 | + $this->debug('SOAP message length='.strlen($soapmsg).' contents (max 1000 bytes)='.substr($soapmsg, 0, 1000)); |
|
289 | 289 | // send |
290 | - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); |
|
291 | - if($errstr = $this->getError()){ |
|
290 | + $return = $this->send($this->getHTTPBody($soapmsg), $soapAction, $this->timeout, $this->response_timeout); |
|
291 | + if ($errstr = $this->getError()) { |
|
292 | 292 | $this->debug('Error: '.$errstr); |
293 | 293 | return false; |
294 | 294 | } else { |
295 | 295 | $this->return = $return; |
296 | 296 | $this->debug('sent message successfully and got a(n) '.gettype($return)); |
297 | - $this->appendDebug('return=' . $this->varDump($return)); |
|
297 | + $this->appendDebug('return='.$this->varDump($return)); |
|
298 | 298 | |
299 | 299 | // fault? |
300 | - if(is_array($return) && isset($return['faultcode'])){ |
|
300 | + if (is_array($return) && isset($return['faultcode'])) { |
|
301 | 301 | $this->debug('got fault'); |
302 | 302 | $this->setError($return['faultcode'].': '.$return['faultstring']); |
303 | 303 | $this->fault = true; |
304 | - foreach($return as $k => $v){ |
|
304 | + foreach ($return as $k => $v) { |
|
305 | 305 | $this->$k = $v; |
306 | 306 | $this->debug("$k = $v<br>"); |
307 | 307 | } |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | return $return; |
313 | 313 | } else { |
314 | 314 | // array of return values |
315 | - if(is_array($return)){ |
|
315 | + if (is_array($return)) { |
|
316 | 316 | // multiple 'out' parameters, which we return wrapped up |
317 | 317 | // in the array |
318 | - if(sizeof($return) > 1){ |
|
318 | + if (sizeof($return) > 1) { |
|
319 | 319 | return $return; |
320 | 320 | } |
321 | 321 | // single 'out' parameter (normally the return value) |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | function loadWSDL() { |
374 | 374 | $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); |
375 | - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); |
|
375 | + $this->wsdl = new wsdl('', $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout, $this->curl_options, $this->use_curl); |
|
376 | 376 | $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); |
377 | 377 | $this->wsdl->fetchWSDL($this->wsdlFile); |
378 | 378 | $this->checkWSDL(); |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | * @return array array of data pertaining to the operation |
386 | 386 | * @access public |
387 | 387 | */ |
388 | - function getOperationData($operation){ |
|
388 | + function getOperationData($operation) { |
|
389 | 389 | if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { |
390 | 390 | $this->loadWSDL(); |
391 | 391 | if ($this->getError()) |
392 | 392 | return false; |
393 | 393 | } |
394 | - if(isset($this->operations[$operation])){ |
|
394 | + if (isset($this->operations[$operation])) { |
|
395 | 395 | return $this->operations[$operation]; |
396 | 396 | } |
397 | 397 | $this->debug("No data for operation: $operation"); |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | * @return mixed native PHP types. |
412 | 412 | * @access private |
413 | 413 | */ |
414 | - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { |
|
414 | + function send($msg, $soapaction = '', $timeout = 0, $response_timeout = 30) { |
|
415 | 415 | $this->checkCookies(); |
416 | 416 | // detect transport |
417 | - switch(true){ |
|
417 | + switch (true) { |
|
418 | 418 | // http(s) |
419 | - case preg_match('/^http/',$this->endpoint): |
|
419 | + case preg_match('/^http/', $this->endpoint): |
|
420 | 420 | $this->debug('transporting via HTTP'); |
421 | - if($this->persistentConnection == true && is_object($this->persistentConnection)){ |
|
422 | - $http =& $this->persistentConnection; |
|
421 | + if ($this->persistentConnection == true && is_object($this->persistentConnection)) { |
|
422 | + $http = & $this->persistentConnection; |
|
423 | 423 | } else { |
424 | 424 | $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); |
425 | 425 | if ($this->persistentConnection) { |
@@ -428,27 +428,27 @@ discard block |
||
428 | 428 | } |
429 | 429 | $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); |
430 | 430 | $http->setSOAPAction($soapaction); |
431 | - if($this->proxyhost && $this->proxyport){ |
|
432 | - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
431 | + if ($this->proxyhost && $this->proxyport) { |
|
432 | + $http->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword); |
|
433 | 433 | } |
434 | - if($this->authtype != '') { |
|
434 | + if ($this->authtype != '') { |
|
435 | 435 | $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
436 | 436 | } |
437 | - if($this->http_encoding != ''){ |
|
437 | + if ($this->http_encoding != '') { |
|
438 | 438 | $http->setEncoding($this->http_encoding); |
439 | 439 | } |
440 | 440 | $this->debug('sending message, length='.strlen($msg)); |
441 | - if(preg_match('/^http:/',$this->endpoint)){ |
|
441 | + if (preg_match('/^http:/', $this->endpoint)) { |
|
442 | 442 | //if(strpos($this->endpoint,'http:')){ |
443 | - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); |
|
444 | - } elseif(preg_match('/^https/',$this->endpoint)){ |
|
443 | + $this->responseData = $http->send($msg, $timeout, $response_timeout, $this->cookies); |
|
444 | + } elseif (preg_match('/^https/', $this->endpoint)) { |
|
445 | 445 | //} elseif(strpos($this->endpoint,'https:')){ |
446 | 446 | //if(phpversion() == '4.3.0-dev'){ |
447 | 447 | //$response = $http->send($msg,$timeout,$response_timeout); |
448 | 448 | //$this->request = $http->outgoing_payload; |
449 | 449 | //$this->response = $http->incoming_payload; |
450 | 450 | //} else |
451 | - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); |
|
451 | + $this->responseData = $http->sendHTTPS($msg, $timeout, $response_timeout, $this->cookies); |
|
452 | 452 | } else { |
453 | 453 | $this->setError('no http/s in endpoint url'); |
454 | 454 | } |
@@ -465,13 +465,13 @@ discard block |
||
465 | 465 | } |
466 | 466 | } |
467 | 467 | |
468 | - if($err = $http->getError()){ |
|
468 | + if ($err = $http->getError()) { |
|
469 | 469 | $this->setError('HTTP Error: '.$err); |
470 | 470 | return false; |
471 | - } elseif($this->getError()){ |
|
471 | + } elseif ($this->getError()) { |
|
472 | 472 | return false; |
473 | 473 | } else { |
474 | - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); |
|
474 | + $this->debug('got response, length='.strlen($this->responseData).' type='.$http->incoming_headers['content-type']); |
|
475 | 475 | return $this->parseResponse($http->incoming_headers, $this->responseData); |
476 | 476 | } |
477 | 477 | break; |
@@ -491,20 +491,20 @@ discard block |
||
491 | 491 | * @access private |
492 | 492 | */ |
493 | 493 | function parseResponse($headers, $data) { |
494 | - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); |
|
494 | + $this->debug('Entering parseResponse() for data of length '.strlen($data).' headers:'); |
|
495 | 495 | $this->appendDebug($this->varDump($headers)); |
496 | 496 | if (!isset($headers['content-type'])) { |
497 | 497 | $this->setError('Response not of type text/xml (no content-type header)'); |
498 | 498 | return false; |
499 | 499 | } |
500 | 500 | if (!strstr($headers['content-type'], 'text/xml')) { |
501 | - $this->setError('Response not of type text/xml: ' . $headers['content-type']); |
|
501 | + $this->setError('Response not of type text/xml: '.$headers['content-type']); |
|
502 | 502 | return false; |
503 | 503 | } |
504 | 504 | if (strpos($headers['content-type'], '=')) { |
505 | 505 | $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); |
506 | - $this->debug('Got response encoding: ' . $enc); |
|
507 | - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ |
|
506 | + $this->debug('Got response encoding: '.$enc); |
|
507 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
508 | 508 | $this->xml_encoding = strtoupper($enc); |
509 | 509 | } else { |
510 | 510 | $this->xml_encoding = 'US-ASCII'; |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 |
514 | 514 | $this->xml_encoding = 'ISO-8859-1'; |
515 | 515 | } |
516 | - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); |
|
517 | - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); |
|
516 | + $this->debug('Use encoding: '.$this->xml_encoding.' when creating nusoap_parser'); |
|
517 | + $parser = new nusoap_parser($data, $this->xml_encoding, $this->operation, $this->decode_utf8); |
|
518 | 518 | // add parser debug data to our debug |
519 | 519 | $this->appendDebug($parser->getDebug()); |
520 | 520 | // if parse errors |
521 | - if($errstr = $parser->getError()){ |
|
522 | - $this->setError( $errstr); |
|
521 | + if ($errstr = $parser->getError()) { |
|
522 | + $this->setError($errstr); |
|
523 | 523 | // destroy the parser object |
524 | 524 | unset($parser); |
525 | 525 | return false; |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers |
570 | 570 | * @access public |
571 | 571 | */ |
572 | - function setHeaders($headers){ |
|
572 | + function setHeaders($headers) { |
|
573 | 573 | $this->debug("setHeaders headers="); |
574 | 574 | $this->appendDebug($this->varDump($headers)); |
575 | 575 | $this->requestHeaders = $headers; |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @return string |
582 | 582 | * @access public |
583 | 583 | */ |
584 | - function getHeaders(){ |
|
584 | + function getHeaders() { |
|
585 | 585 | return $this->responseHeaders; |
586 | 586 | } |
587 | 587 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return mixed |
592 | 592 | * @access public |
593 | 593 | */ |
594 | - function getHeader(){ |
|
594 | + function getHeader() { |
|
595 | 595 | return $this->responseHeader; |
596 | 596 | } |
597 | 597 | |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @param string $enc HTTP encoding |
636 | 636 | * @access public |
637 | 637 | */ |
638 | - function setHTTPEncoding($enc='gzip, deflate'){ |
|
638 | + function setHTTPEncoding($enc = 'gzip, deflate') { |
|
639 | 639 | $this->debug("setHTTPEncoding(\"$enc\")"); |
640 | 640 | $this->http_encoding = $enc; |
641 | 641 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @access public |
658 | 658 | */ |
659 | - function useHTTPPersistentConnection(){ |
|
659 | + function useHTTPPersistentConnection() { |
|
660 | 660 | $this->debug("useHTTPPersistentConnection"); |
661 | 661 | $this->persistentConnection = true; |
662 | 662 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | */ |
749 | 749 | function _getProxyClassCode($r) { |
750 | 750 | $this->debug("in getProxy endpointType=$this->endpointType"); |
751 | - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); |
|
751 | + $this->appendDebug("wsdl=".$this->varDump($this->wsdl)); |
|
752 | 752 | if ($this->endpointType != 'wsdl') { |
753 | 753 | $evalStr = 'A proxy can only be created for a WSDL client'; |
754 | 754 | $this->setError($evalStr); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { |
759 | 759 | $this->loadWSDL(); |
760 | 760 | if ($this->getError()) { |
761 | - return "echo \"" . $this->getError() . "\";"; |
|
761 | + return "echo \"".$this->getError()."\";"; |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 | $evalStr = ''; |
@@ -774,9 +774,9 @@ discard block |
||
774 | 774 | $paramArrayStr .= "'$name' => \$$name, "; |
775 | 775 | $paramCommentStr .= "$type \$$name, "; |
776 | 776 | } |
777 | - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); |
|
778 | - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); |
|
779 | - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); |
|
777 | + $paramStr = substr($paramStr, 0, strlen($paramStr) - 2); |
|
778 | + $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2); |
|
779 | + $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2); |
|
780 | 780 | } else { |
781 | 781 | $paramStr = ''; |
782 | 782 | $paramArrayStr = ''; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | } |
785 | 785 | $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; |
786 | 786 | $evalStr .= "// $paramCommentStr |
787 | - function " . str_replace('.', '__', $operation) . "($paramStr) { |
|
787 | + function ".str_replace('.', '__', $operation)."($paramStr) { |
|
788 | 788 | \$params = array($paramArrayStr); |
789 | 789 | return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); |
790 | 790 | } |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @return always returns true |
853 | 853 | * @access public |
854 | 854 | */ |
855 | - function decodeUTF8($bool){ |
|
855 | + function decodeUTF8($bool) { |
|
856 | 856 | $this->decode_utf8 = $bool; |
857 | 857 | return true; |
858 | 858 | } |
@@ -893,19 +893,19 @@ discard block |
||
893 | 893 | if (sizeof($this->cookies) == 0) { |
894 | 894 | return true; |
895 | 895 | } |
896 | - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); |
|
896 | + $this->debug('checkCookie: check '.sizeof($this->cookies).' cookies'); |
|
897 | 897 | $curr_cookies = $this->cookies; |
898 | 898 | $this->cookies = array(); |
899 | 899 | foreach ($curr_cookies as $cookie) { |
900 | - if (! is_array($cookie)) { |
|
900 | + if (!is_array($cookie)) { |
|
901 | 901 | $this->debug('Remove cookie that is not an array'); |
902 | 902 | continue; |
903 | 903 | } |
904 | - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { |
|
904 | + if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) { |
|
905 | 905 | if (strtotime($cookie['expires']) > time()) { |
906 | 906 | $this->cookies[] = $cookie; |
907 | 907 | } else { |
908 | - $this->debug('Remove expired cookie ' . $cookie['name']); |
|
908 | + $this->debug('Remove expired cookie '.$cookie['name']); |
|
909 | 909 | } |
910 | 910 | } else { |
911 | 911 | $this->cookies[] = $cookie; |
@@ -969,11 +969,11 @@ discard block |
||
969 | 969 | } |
970 | 970 | $this->cookies[$i] = $newCookie; |
971 | 971 | $found = true; |
972 | - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); |
|
972 | + $this->debug('Update cookie '.$newName.'='.$newCookie['value']); |
|
973 | 973 | break; |
974 | 974 | } |
975 | - if (! $found) { |
|
976 | - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); |
|
975 | + if (!$found) { |
|
976 | + $this->debug('Add cookie '.$newName.'='.$newCookie['value']); |
|
977 | 977 | $this->cookies[] = $newCookie; |
978 | 978 | } |
979 | 979 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param mixed $wsdl file path or URL (string), or wsdl instance (object) |
171 | 171 | * @access public |
172 | 172 | */ |
173 | - function nusoap_server($wsdl=false){ |
|
173 | + function nusoap_server($wsdl = false) { |
|
174 | 174 | parent::nusoap_base(); |
175 | 175 | // turn on debugging? |
176 | 176 | global $debug; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $qs = explode('&', $_SERVER['QUERY_STRING']); |
194 | 194 | foreach ($qs as $v) { |
195 | 195 | if (substr($v, 0, 6) == 'debug=') { |
196 | - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); |
|
196 | + $this->debug("In nusoap_server, set debug_flag=".substr($v, 6)." based on query string #1"); |
|
197 | 197 | $this->debug_flag = substr($v, 6); |
198 | 198 | } |
199 | 199 | } |
@@ -201,27 +201,27 @@ discard block |
||
201 | 201 | $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); |
202 | 202 | foreach ($qs as $v) { |
203 | 203 | if (substr($v, 0, 6) == 'debug=') { |
204 | - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); |
|
204 | + $this->debug("In nusoap_server, set debug_flag=".substr($v, 6)." based on query string #2"); |
|
205 | 205 | $this->debug_flag = substr($v, 6); |
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | 210 | // wsdl |
211 | - if($wsdl){ |
|
211 | + if ($wsdl) { |
|
212 | 212 | $this->debug("In nusoap_server, WSDL is specified"); |
213 | 213 | if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { |
214 | 214 | $this->wsdl = $wsdl; |
215 | 215 | $this->externalWSDLURL = $this->wsdl->wsdl; |
216 | - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); |
|
216 | + $this->debug('Use existing wsdl instance from '.$this->externalWSDLURL); |
|
217 | 217 | } else { |
218 | - $this->debug('Create wsdl from ' . $wsdl); |
|
218 | + $this->debug('Create wsdl from '.$wsdl); |
|
219 | 219 | $this->wsdl = new wsdl($wsdl); |
220 | 220 | $this->externalWSDLURL = $wsdl; |
221 | 221 | } |
222 | 222 | $this->appendDebug($this->wsdl->getDebug()); |
223 | 223 | $this->wsdl->clearDebug(); |
224 | - if($err = $this->wsdl->getError()){ |
|
224 | + if ($err = $this->wsdl->getError()) { |
|
225 | 225 | die('WSDL ERROR: '.$err); |
226 | 226 | } |
227 | 227 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param string $data usually is the value of $HTTP_RAW_POST_DATA |
234 | 234 | * @access public |
235 | 235 | */ |
236 | - function service($data){ |
|
236 | + function service($data) { |
|
237 | 237 | global $HTTP_SERVER_VARS; |
238 | 238 | |
239 | 239 | if (isset($_SERVER['REQUEST_METHOD'])) { |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | } else { |
252 | 252 | $qs = ''; |
253 | 253 | } |
254 | - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); |
|
254 | + $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=".strlen($data)); |
|
255 | 255 | |
256 | 256 | if ($rm == 'POST') { |
257 | 257 | $this->debug("In service, invoke the request"); |
258 | 258 | $this->parse_request($data); |
259 | - if (! $this->fault) { |
|
259 | + if (!$this->fault) { |
|
260 | 260 | $this->invoke_method(); |
261 | 261 | } |
262 | - if (! $this->fault) { |
|
262 | + if (!$this->fault) { |
|
263 | 263 | $this->serialize_return(); |
264 | 264 | } |
265 | 265 | $this->send_response(); |
266 | - } elseif (preg_match('/wsdl/', $qs) ){ |
|
266 | + } elseif (preg_match('/wsdl/', $qs)) { |
|
267 | 267 | $this->debug("In service, this is a request for WSDL"); |
268 | - if ($this->externalWSDLURL){ |
|
268 | + if ($this->externalWSDLURL) { |
|
269 | 269 | if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL |
270 | 270 | $this->debug("In service, re-direct for WSDL"); |
271 | 271 | header('Location: '.$this->externalWSDLURL); |
@@ -322,23 +322,23 @@ discard block |
||
322 | 322 | |
323 | 323 | $this->request = ''; |
324 | 324 | $this->SOAPAction = ''; |
325 | - if(function_exists('getallheaders')){ |
|
325 | + if (function_exists('getallheaders')) { |
|
326 | 326 | $this->debug("In parse_http_headers, use getallheaders"); |
327 | 327 | $headers = getallheaders(); |
328 | - foreach($headers as $k=>$v){ |
|
328 | + foreach ($headers as $k=>$v) { |
|
329 | 329 | $k = strtolower($k); |
330 | 330 | $this->headers[$k] = $v; |
331 | 331 | $this->request .= "$k: $v\r\n"; |
332 | 332 | $this->debug("$k: $v"); |
333 | 333 | } |
334 | 334 | // get SOAPAction header |
335 | - if(isset($this->headers['soapaction'])){ |
|
336 | - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); |
|
335 | + if (isset($this->headers['soapaction'])) { |
|
336 | + $this->SOAPAction = str_replace('"', '', $this->headers['soapaction']); |
|
337 | 337 | } |
338 | 338 | // get the character encoding of the incoming request |
339 | - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ |
|
340 | - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); |
|
341 | - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ |
|
339 | + if (isset($this->headers['content-type']) && strpos($this->headers['content-type'], '=')) { |
|
340 | + $enc = str_replace('"', '', substr(strstr($this->headers["content-type"], '='), 1)); |
|
341 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
342 | 342 | $this->xml_encoding = strtoupper($enc); |
343 | 343 | } else { |
344 | 344 | $this->xml_encoding = 'US-ASCII'; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 |
348 | 348 | $this->xml_encoding = 'ISO-8859-1'; |
349 | 349 | } |
350 | - } elseif(isset($_SERVER) && is_array($_SERVER)){ |
|
350 | + } elseif (isset($_SERVER) && is_array($_SERVER)) { |
|
351 | 351 | $this->debug("In parse_http_headers, use _SERVER"); |
352 | 352 | foreach ($_SERVER as $k => $v) { |
353 | 353 | if (substr($k, 0, 5) == 'HTTP_') { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $enc = substr(strstr($v, '='), 1); |
368 | 368 | $enc = str_replace('"', '', $enc); |
369 | 369 | $enc = str_replace('\\', '', $enc); |
370 | - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { |
|
370 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
371 | 371 | $this->xml_encoding = strtoupper($enc); |
372 | 372 | } else { |
373 | 373 | $this->xml_encoding = 'US-ASCII'; |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); |
386 | 386 | foreach ($HTTP_SERVER_VARS as $k => $v) { |
387 | 387 | if (substr($k, 0, 5) == 'HTTP_') { |
388 | - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); |
|
388 | + $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); |
|
389 | 389 | } else { |
390 | - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); |
|
390 | + $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); |
|
391 | 391 | } |
392 | 392 | if ($k == 'soapaction') { |
393 | 393 | // get SOAPAction header |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $enc = substr(strstr($v, '='), 1); |
402 | 402 | $enc = str_replace('"', '', $enc); |
403 | 403 | $enc = str_replace('\\', '', $enc); |
404 | - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { |
|
404 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
405 | 405 | $this->xml_encoding = strtoupper($enc); |
406 | 406 | } else { |
407 | 407 | $this->xml_encoding = 'US-ASCII'; |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | * @param string $data XML string |
444 | 444 | * @access private |
445 | 445 | */ |
446 | - function parse_request($data='') { |
|
446 | + function parse_request($data = '') { |
|
447 | 447 | $this->debug('entering parse_request()'); |
448 | 448 | $this->parse_http_headers(); |
449 | 449 | $this->debug('got character encoding: '.$this->xml_encoding); |
450 | 450 | // uncompress if necessary |
451 | 451 | if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { |
452 | - $this->debug('got content encoding: ' . $this->headers['content-encoding']); |
|
452 | + $this->debug('got content encoding: '.$this->headers['content-encoding']); |
|
453 | 453 | if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { |
454 | 454 | // if decoding works, use it. else assume data wasn't gzencoded |
455 | 455 | if (function_exists('gzuncompress')) { |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @access private |
492 | 492 | */ |
493 | 493 | function invoke_method() { |
494 | - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); |
|
494 | + $this->debug('in invoke_method, methodname='.$this->methodname.' methodURI='.$this->methodURI.' SOAPAction='.$this->SOAPAction); |
|
495 | 495 | |
496 | 496 | // |
497 | 497 | // if you are debugging in this area of the code, your service uses a class to implement methods, |
@@ -506,16 +506,16 @@ discard block |
||
506 | 506 | $orig_methodname = $this->methodname; |
507 | 507 | if ($this->wsdl) { |
508 | 508 | if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { |
509 | - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); |
|
510 | - $this->appendDebug('opData=' . $this->varDump($this->opData)); |
|
509 | + $this->debug('in invoke_method, found WSDL operation='.$this->methodname); |
|
510 | + $this->appendDebug('opData='.$this->varDump($this->opData)); |
|
511 | 511 | } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { |
512 | 512 | // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element |
513 | - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); |
|
514 | - $this->appendDebug('opData=' . $this->varDump($this->opData)); |
|
513 | + $this->debug('in invoke_method, found WSDL soapAction='.$this->SOAPAction.' for operation='.$this->opData['name']); |
|
514 | + $this->appendDebug('opData='.$this->varDump($this->opData)); |
|
515 | 515 | $this->methodname = $this->opData['name']; |
516 | 516 | } else { |
517 | - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); |
|
518 | - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); |
|
517 | + $this->debug('in invoke_method, no WSDL for operation='.$this->methodname); |
|
518 | + $this->fault('SOAP-ENV:Client', "Operation '".$this->methodname."' is not defined in the WSDL for this service"); |
|
519 | 519 | return; |
520 | 520 | } |
521 | 521 | } else { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (!function_exists($this->methodname)) { |
557 | 557 | $this->debug("in invoke_method, function '$this->methodname' not found!"); |
558 | 558 | $this->result = 'fault: method not found'; |
559 | - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); |
|
559 | + $this->fault('SOAP-ENV:Client', "method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); |
|
560 | 560 | return; |
561 | 561 | } |
562 | 562 | } else { |
@@ -564,19 +564,19 @@ discard block |
||
564 | 564 | if (!in_array($method_to_compare, get_class_methods($class))) { |
565 | 565 | $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); |
566 | 566 | $this->result = 'fault: method not found'; |
567 | - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); |
|
567 | + $this->fault('SOAP-ENV:Client', "method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); |
|
568 | 568 | return; |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | 572 | // evaluate message, getting back parameters |
573 | 573 | // verify that request parameters match the method's signature |
574 | - if(! $this->verify_method($this->methodname,$this->methodparams)){ |
|
574 | + if (!$this->verify_method($this->methodname, $this->methodparams)) { |
|
575 | 575 | // debug |
576 | 576 | $this->debug('ERROR: request not verified against method signature'); |
577 | 577 | $this->result = 'fault: request failed validation against method signature'; |
578 | 578 | // return fault |
579 | - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); |
|
579 | + $this->fault('SOAP-ENV:Client', "Operation '$this->methodname' not defined in service."); |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
@@ -616,13 +616,13 @@ discard block |
||
616 | 616 | } else { |
617 | 617 | if ($class == '') { |
618 | 618 | $this->debug('in invoke_method, calling function using call_user_func_array()'); |
619 | - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() |
|
619 | + $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() |
|
620 | 620 | } elseif ($delim == '..') { |
621 | 621 | $this->debug('in invoke_method, calling class method using call_user_func_array()'); |
622 | - $call_arg = array ($class, $method); |
|
622 | + $call_arg = array($class, $method); |
|
623 | 623 | } else { |
624 | 624 | $this->debug('in invoke_method, calling instance method using call_user_func_array()'); |
625 | - $instance = new $class (); |
|
625 | + $instance = new $class(); |
|
626 | 626 | $call_arg = array(&$instance, $method); |
627 | 627 | } |
628 | 628 | if (is_array($this->methodparams)) { |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * @access private |
649 | 649 | */ |
650 | 650 | function serialize_return() { |
651 | - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); |
|
651 | + $this->debug('Entering serialize_return methodname: '.$this->methodname.' methodURI: '.$this->methodURI); |
|
652 | 652 | // if fault |
653 | 653 | if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { |
654 | 654 | $this->debug('got a fault object from method'); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } else { |
661 | 661 | $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); |
662 | 662 | $this->debug('serializing return value'); |
663 | - if($this->wsdl){ |
|
663 | + if ($this->wsdl) { |
|
664 | 664 | $opParams = ""; |
665 | 665 | if (sizeof($this->opData['output']['parts']) > 1) { |
666 | 666 | $this->debug('more than one output part, so use the method return unchanged'); |
@@ -673,10 +673,10 @@ discard block |
||
673 | 673 | //} |
674 | 674 | $opParams = array($this->methodreturn); |
675 | 675 | } |
676 | - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); |
|
676 | + $return_val = $this->wsdl->serializeRPCParameters($this->methodname, 'output', $opParams); |
|
677 | 677 | $this->appendDebug($this->wsdl->getDebug()); |
678 | 678 | $this->wsdl->clearDebug(); |
679 | - if($errstr = $this->wsdl->getError()){ |
|
679 | + if ($errstr = $this->wsdl->getError()) { |
|
680 | 680 | $this->debug('got wsdl error: '.$errstr); |
681 | 681 | $this->fault('SOAP-ENV:Server', 'unable to serialize result'); |
682 | 682 | return; |
@@ -695,9 +695,9 @@ discard block |
||
695 | 695 | |
696 | 696 | $this->debug('serializing response'); |
697 | 697 | if ($this->wsdl) { |
698 | - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); |
|
698 | + $this->debug('have WSDL for serialization: style is '.$this->opData['style']); |
|
699 | 699 | if ($this->opData['style'] == 'rpc') { |
700 | - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); |
|
700 | + $this->debug('style is rpc for serialization: use is '.$this->opData['output']['use']); |
|
701 | 701 | if ($this->opData['output']['use'] == 'literal') { |
702 | 702 | // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace |
703 | 703 | if ($this->methodURI) { |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>"; |
722 | 722 | } |
723 | 723 | $this->result = 'successful'; |
724 | - if($this->wsdl){ |
|
724 | + if ($this->wsdl) { |
|
725 | 725 | //if($this->debug_flag){ |
726 | 726 | $this->appendDebug($this->wsdl->getDebug()); |
727 | 727 | // } |
@@ -731,9 +731,9 @@ discard block |
||
731 | 731 | $encodingStyle = ''; |
732 | 732 | } |
733 | 733 | // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. |
734 | - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); |
|
734 | + $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders, $this->wsdl->usedNamespaces, $this->opData['style'], $this->opData['output']['use'], $encodingStyle); |
|
735 | 735 | } else { |
736 | - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); |
|
736 | + $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders); |
|
737 | 737 | } |
738 | 738 | $this->debug("Leaving serialize_return"); |
739 | 739 | } |
@@ -763,18 +763,18 @@ discard block |
||
763 | 763 | // $this->outgoing_headers[] = "Status: 200 OK"; |
764 | 764 | } |
765 | 765 | // add debug data if in debug mode |
766 | - if(isset($this->debug_flag) && $this->debug_flag){ |
|
766 | + if (isset($this->debug_flag) && $this->debug_flag) { |
|
767 | 767 | $payload .= $this->getDebugAsXMLComment(); |
768 | 768 | } |
769 | 769 | $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; |
770 | - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); |
|
770 | + preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev); |
|
771 | 771 | $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; |
772 | 772 | // Let the Web server decide about this |
773 | 773 | //$this->outgoing_headers[] = "Connection: Close\r\n"; |
774 | 774 | $payload = $this->getHTTPBody($payload); |
775 | 775 | $type = $this->getHTTPContentType(); |
776 | 776 | $charset = $this->getHTTPContentTypeCharset(); |
777 | - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); |
|
777 | + $this->outgoing_headers[] = "Content-Type: $type".($charset ? '; charset='.$charset : ''); |
|
778 | 778 | //begin code to compress payload - by John |
779 | 779 | // NOTE: there is no way to know whether the Web server will also compress |
780 | 780 | // this data. |
@@ -811,11 +811,11 @@ discard block |
||
811 | 811 | //end code |
812 | 812 | $this->outgoing_headers[] = "Content-Length: ".strlen($payload); |
813 | 813 | reset($this->outgoing_headers); |
814 | - foreach($this->outgoing_headers as $hdr){ |
|
814 | + foreach ($this->outgoing_headers as $hdr) { |
|
815 | 815 | header($hdr, false); |
816 | 816 | } |
817 | 817 | print $payload; |
818 | - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; |
|
818 | + $this->response = join("\r\n", $this->outgoing_headers)."\r\n\r\n".$payload; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | /** |
@@ -827,12 +827,12 @@ discard block |
||
827 | 827 | * @return boolean Whether the operation was found |
828 | 828 | * @access private |
829 | 829 | */ |
830 | - function verify_method($operation,$request){ |
|
831 | - if(isset($this->wsdl) && is_object($this->wsdl)){ |
|
832 | - if($this->wsdl->getOperationData($operation)){ |
|
830 | + function verify_method($operation, $request) { |
|
831 | + if (isset($this->wsdl) && is_object($this->wsdl)) { |
|
832 | + if ($this->wsdl->getOperationData($operation)) { |
|
833 | 833 | return true; |
834 | 834 | } |
835 | - } elseif(isset($this->operations[$operation])){ |
|
835 | + } elseif (isset($this->operations[$operation])) { |
|
836 | 836 | return true; |
837 | 837 | } |
838 | 838 | return false; |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * @access private |
848 | 848 | */ |
849 | 849 | function parseRequest($headers, $data) { |
850 | - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); |
|
850 | + $this->debug('Entering parseRequest() for data of length '.strlen($data).' headers:'); |
|
851 | 851 | $this->appendDebug($this->varDump($headers)); |
852 | 852 | if (!isset($headers['content-type'])) { |
853 | 853 | $this->setError('Request not of type text/xml (no content-type header)'); |
@@ -859,8 +859,8 @@ discard block |
||
859 | 859 | } |
860 | 860 | if (strpos($headers['content-type'], '=')) { |
861 | 861 | $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); |
862 | - $this->debug('Got response encoding: ' . $enc); |
|
863 | - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ |
|
862 | + $this->debug('Got response encoding: '.$enc); |
|
863 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
864 | 864 | $this->xml_encoding = strtoupper($enc); |
865 | 865 | } else { |
866 | 866 | $this->xml_encoding = 'US-ASCII'; |
@@ -869,16 +869,16 @@ discard block |
||
869 | 869 | // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 |
870 | 870 | $this->xml_encoding = 'ISO-8859-1'; |
871 | 871 | } |
872 | - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); |
|
872 | + $this->debug('Use encoding: '.$this->xml_encoding.' when creating nusoap_parser'); |
|
873 | 873 | // parse response, get soap parser obj |
874 | - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); |
|
874 | + $parser = new nusoap_parser($data, $this->xml_encoding, '', $this->decode_utf8); |
|
875 | 875 | |
876 | 876 | // parser debug |
877 | 877 | $this->debug("parser debug: \n".$parser->getDebug()); |
878 | 878 | // if fault occurred during message parsing |
879 | - if($err = $parser->getError()){ |
|
879 | + if ($err = $parser->getError()) { |
|
880 | 880 | $this->result = 'fault: error in msg parsing: '.$err; |
881 | - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); |
|
881 | + $this->fault('SOAP-ENV:Client', "error in msg parsing:\n".$err); |
|
882 | 882 | // else successfully parsed request into soapval object |
883 | 883 | } else { |
884 | 884 | // get/set methodname |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | * @access public |
942 | 942 | * @deprecated |
943 | 943 | */ |
944 | - function add_to_map($methodname,$in,$out){ |
|
945 | - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); |
|
944 | + function add_to_map($methodname, $in, $out) { |
|
945 | + $this->operations[$methodname] = array('name' => $methodname, 'in' => $in, 'out' => $out); |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | /** |
@@ -959,13 +959,13 @@ discard block |
||
959 | 959 | * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
960 | 960 | * @access public |
961 | 961 | */ |
962 | - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ |
|
962 | + function register($name, $in = array(), $out = array(), $namespace = false, $soapaction = false, $style = false, $use = false, $documentation = '', $encodingStyle = '') { |
|
963 | 963 | global $HTTP_SERVER_VARS; |
964 | 964 | |
965 | - if($this->externalWSDLURL){ |
|
965 | + if ($this->externalWSDLURL) { |
|
966 | 966 | die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); |
967 | 967 | } |
968 | - if (! $name) { |
|
968 | + if (!$name) { |
|
969 | 969 | die('You must specify a name when you register an operation'); |
970 | 970 | } |
971 | 971 | if (!is_array($in)) { |
@@ -974,9 +974,9 @@ discard block |
||
974 | 974 | if (!is_array($out)) { |
975 | 975 | die('You must provide an array for operation outputs'); |
976 | 976 | } |
977 | - if(false == $namespace) { |
|
977 | + if (false == $namespace) { |
|
978 | 978 | } |
979 | - if(false == $soapaction) { |
|
979 | + if (false == $soapaction) { |
|
980 | 980 | if (isset($_SERVER)) { |
981 | 981 | $SERVER_NAME = $_SERVER['SERVER_NAME']; |
982 | 982 | $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; |
@@ -995,10 +995,10 @@ discard block |
||
995 | 995 | } |
996 | 996 | $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; |
997 | 997 | } |
998 | - if(false == $style) { |
|
998 | + if (false == $style) { |
|
999 | 999 | $style = "rpc"; |
1000 | 1000 | } |
1001 | - if(false == $use) { |
|
1001 | + if (false == $use) { |
|
1002 | 1002 | $use = "encoded"; |
1003 | 1003 | } |
1004 | 1004 | if ($use == 'encoded' && $encodingStyle == '') { |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | 'namespace' => $namespace, |
1013 | 1013 | 'soapaction' => $soapaction, |
1014 | 1014 | 'style' => $style); |
1015 | - if($this->wsdl){ |
|
1016 | - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); |
|
1015 | + if ($this->wsdl) { |
|
1016 | + $this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle); |
|
1017 | 1017 | } |
1018 | 1018 | return true; |
1019 | 1019 | } |
@@ -1028,11 +1028,11 @@ discard block |
||
1028 | 1028 | * @param string $faultdetail |
1029 | 1029 | * @access public |
1030 | 1030 | */ |
1031 | - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ |
|
1031 | + function fault($faultcode, $faultstring, $faultactor = '', $faultdetail = '') { |
|
1032 | 1032 | if ($faultdetail == '' && $this->debug_flag) { |
1033 | 1033 | $faultdetail = $this->getDebug(); |
1034 | 1034 | } |
1035 | - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); |
|
1035 | + $this->fault = new nusoap_fault($faultcode, $faultactor, $faultstring, $faultdetail); |
|
1036 | 1036 | $this->fault->soap_defencoding = $this->soap_defencoding; |
1037 | 1037 | } |
1038 | 1038 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | * @param string $transport optional SOAP transport |
1048 | 1048 | * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false |
1049 | 1049 | */ |
1050 | - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) |
|
1050 | + function configureWSDL($serviceName, $namespace = false, $endpoint = false, $style = 'rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) |
|
1051 | 1051 | { |
1052 | 1052 | global $HTTP_SERVER_VARS; |
1053 | 1053 | |
@@ -1065,20 +1065,20 @@ discard block |
||
1065 | 1065 | $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); |
1066 | 1066 | } |
1067 | 1067 | // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) |
1068 | - $colon = strpos($SERVER_NAME,":"); |
|
1068 | + $colon = strpos($SERVER_NAME, ":"); |
|
1069 | 1069 | if ($colon) { |
1070 | 1070 | $SERVER_NAME = substr($SERVER_NAME, 0, $colon); |
1071 | 1071 | } |
1072 | 1072 | if ($SERVER_PORT == 80) { |
1073 | 1073 | $SERVER_PORT = ''; |
1074 | 1074 | } else { |
1075 | - $SERVER_PORT = ':' . $SERVER_PORT; |
|
1075 | + $SERVER_PORT = ':'.$SERVER_PORT; |
|
1076 | 1076 | } |
1077 | - if(false == $namespace) { |
|
1077 | + if (false == $namespace) { |
|
1078 | 1078 | $namespace = "http://$SERVER_NAME/soap/$serviceName"; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - if(false == $endpoint) { |
|
1081 | + if (false == $endpoint) { |
|
1082 | 1082 | if ($HTTPS == '1' || $HTTPS == 'on') { |
1083 | 1083 | $SCHEME = 'https'; |
1084 | 1084 | } else { |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; |
1088 | 1088 | } |
1089 | 1089 | |
1090 | - if(false == $schemaTargetNamespace) { |
|
1090 | + if (false == $schemaTargetNamespace) { |
|
1091 | 1091 | $schemaTargetNamespace = $namespace; |
1092 | 1092 | } |
1093 | 1093 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $faultstring human readable error message |
46 | 46 | * @param mixed $faultdetail detail, typically a string or array of string |
47 | 47 | */ |
48 | - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ |
|
48 | + function nusoap_fault($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '') { |
|
49 | 49 | parent::nusoap_base(); |
50 | 50 | $this->faultcode = $faultcode; |
51 | 51 | $this->faultactor = $faultactor; |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @return string The serialization of the fault instance. |
60 | 60 | * @access public |
61 | 61 | */ |
62 | - function serialize(){ |
|
62 | + function serialize() { |
|
63 | 63 | $ns_string = ''; |
64 | - foreach($this->namespaces as $k => $v){ |
|
64 | + foreach ($this->namespaces as $k => $v) { |
|
65 | 65 | $ns_string .= "\n xmlns:$k=\"$v\""; |
66 | 66 | } |
67 | 67 | $return_msg = |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | var $root_struct_name = ''; |
19 | 19 | var $root_struct_namespace = ''; |
20 | 20 | var $root_header = ''; |
21 | - var $document = ''; // incoming SOAP body (text) |
|
21 | + var $document = ''; // incoming SOAP body (text) |
|
22 | 22 | // determines where in the message we are (envelope,header,body,method) |
23 | 23 | var $status = ''; |
24 | 24 | var $position = 0; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | var $fault_detail = ''; |
34 | 34 | var $depth_array = array(); |
35 | 35 | var $debug_flag = true; |
36 | - var $soapresponse = NULL; // parsed SOAP Body |
|
37 | - var $soapheader = NULL; // parsed SOAP Header |
|
38 | - var $responseHeaders = ''; // incoming SOAP headers (text) |
|
36 | + var $soapresponse = NULL; // parsed SOAP Body |
|
37 | + var $soapheader = NULL; // parsed SOAP Header |
|
38 | + var $responseHeaders = ''; // incoming SOAP headers (text) |
|
39 | 39 | var $body_position = 0; |
40 | 40 | // for multiref parsing: |
41 | 41 | // array of id => pos |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 |
55 | 55 | * @access public |
56 | 56 | */ |
57 | - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ |
|
57 | + function nusoap_parser($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true) { |
|
58 | 58 | parent::nusoap_base(); |
59 | 59 | $this->xml = $xml; |
60 | 60 | $this->xml_encoding = $encoding; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->decode_utf8 = $decode_utf8; |
63 | 63 | |
64 | 64 | // Check whether content has been read. |
65 | - if(!empty($this->xml)){ |
|
65 | + if (!empty($this->xml)) { |
|
66 | 66 | // Check XML encoding |
67 | 67 | $pos_xml = strpos($xml, '<?xml'); |
68 | 68 | if ($pos_xml !== FALSE) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { |
71 | 71 | $xml_encoding = $res[1]; |
72 | 72 | if (strtoupper($xml_encoding) != $encoding) { |
73 | - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; |
|
73 | + $err = "Charset from HTTP Content-Type '".$encoding."' does not match encoding from XML declaration '".$xml_encoding."'"; |
|
74 | 74 | $this->debug($err); |
75 | 75 | if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { |
76 | 76 | $this->setError($err); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | // Set the object for the parser. |
97 | 97 | xml_set_object($this->parser, $this); |
98 | 98 | // Set the element handlers for the parser. |
99 | - xml_set_element_handler($this->parser, 'start_element','end_element'); |
|
100 | - xml_set_character_data_handler($this->parser,'character_data'); |
|
99 | + xml_set_element_handler($this->parser, 'start_element', 'end_element'); |
|
100 | + xml_set_character_data_handler($this->parser, 'character_data'); |
|
101 | 101 | |
102 | 102 | xml_parse($this->parser, $this->xml); |
103 | 103 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | xml_get_current_line_number($this->parser), |
110 | 110 | xml_error_string(xml_get_error_code($this->parser))); |
111 | 111 | $this->debug($err); |
112 | - $this->debug("XML payload:\n" . $xml); |
|
112 | + $this->debug("XML payload:\n".$xml); |
|
113 | 113 | $this->setError($err); |
114 | 114 | } else { |
115 | 115 | $this->debug('in nusoap_parser ctor, message:'); |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | // get final value |
119 | 119 | $this->soapresponse = $this->message[$this->root_struct]['result']; |
120 | 120 | // get header value |
121 | - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ |
|
121 | + if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) { |
|
122 | 122 | $this->soapheader = $this->message[$this->root_header]['result']; |
123 | 123 | } |
124 | 124 | // resolve hrefs/ids |
125 | - if(sizeof($this->multirefs) > 0){ |
|
126 | - foreach($this->multirefs as $id => $hrefs){ |
|
125 | + if (sizeof($this->multirefs) > 0) { |
|
126 | + foreach ($this->multirefs as $id => $hrefs) { |
|
127 | 127 | $this->debug('resolving multirefs for id: '.$id); |
128 | 128 | $idVal = $this->buildVal($this->ids[$id]); |
129 | 129 | if (is_array($idVal) && isset($idVal['!id'])) { |
130 | 130 | unset($idVal['!id']); |
131 | 131 | } |
132 | - foreach($hrefs as $refPos => $ref){ |
|
132 | + foreach ($hrefs as $refPos => $ref) { |
|
133 | 133 | $this->debug('resolving href at pos '.$refPos); |
134 | 134 | $this->multirefs[$id][$refPos] = $idVal; |
135 | 135 | } |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | // update class level pos |
158 | 158 | $pos = $this->position++; |
159 | 159 | // and set mine |
160 | - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); |
|
160 | + $this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>''); |
|
161 | 161 | // depth = how many levels removed from root? |
162 | 162 | // set mine as current global depth and increment global depth value |
163 | 163 | $this->message[$pos]['depth'] = $this->depth++; |
164 | 164 | |
165 | 165 | // else add self as child to whoever the current parent is |
166 | - if($pos != 0){ |
|
166 | + if ($pos != 0) { |
|
167 | 167 | $this->message[$this->parent]['children'] .= '|'.$pos; |
168 | 168 | } |
169 | 169 | // set my parent |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | // set self as current value for this depth |
174 | 174 | $this->depth_array[$this->depth] = $pos; |
175 | 175 | // get element prefix |
176 | - if(strpos($name,':')){ |
|
176 | + if (strpos($name, ':')) { |
|
177 | 177 | // get ns prefix |
178 | - $prefix = substr($name,0,strpos($name,':')); |
|
178 | + $prefix = substr($name, 0, strpos($name, ':')); |
|
179 | 179 | // get unqualified name |
180 | - $name = substr(strstr($name,':'),1); |
|
180 | + $name = substr(strstr($name, ':'), 1); |
|
181 | 181 | } |
182 | 182 | // set status |
183 | 183 | if ($name == 'Envelope' && $this->status == '') { |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | } elseif ($name == 'Header' && $this->status == 'envelope') { |
186 | 186 | $this->root_header = $pos; |
187 | 187 | $this->status = 'header'; |
188 | - } elseif ($name == 'Body' && $this->status == 'envelope'){ |
|
188 | + } elseif ($name == 'Body' && $this->status == 'envelope') { |
|
189 | 189 | $this->status = 'body'; |
190 | 190 | $this->body_position = $pos; |
191 | 191 | // set method |
192 | - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { |
|
192 | + } elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) { |
|
193 | 193 | $this->status = 'method'; |
194 | 194 | $this->root_struct_name = $name; |
195 | 195 | $this->root_struct = $pos; |
@@ -205,23 +205,23 @@ discard block |
||
205 | 205 | |
206 | 206 | // loop through atts, logging ns and type declarations |
207 | 207 | $attstr = ''; |
208 | - foreach($attrs as $key => $value){ |
|
208 | + foreach ($attrs as $key => $value) { |
|
209 | 209 | $key_prefix = $this->getPrefix($key); |
210 | 210 | $key_localpart = $this->getLocalPart($key); |
211 | 211 | // if ns declarations, add to class level array of valid namespaces |
212 | - if($key_prefix == 'xmlns'){ |
|
213 | - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ |
|
212 | + if ($key_prefix == 'xmlns') { |
|
213 | + if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) { |
|
214 | 214 | $this->XMLSchemaVersion = $value; |
215 | 215 | $this->namespaces['xsd'] = $this->XMLSchemaVersion; |
216 | 216 | $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; |
217 | 217 | } |
218 | 218 | $this->namespaces[$key_localpart] = $value; |
219 | 219 | // set method namespace |
220 | - if($name == $this->root_struct_name){ |
|
220 | + if ($name == $this->root_struct_name) { |
|
221 | 221 | $this->methodNamespace = $value; |
222 | 222 | } |
223 | 223 | // if it's a type declaration, set type |
224 | - } elseif($key_localpart == 'type'){ |
|
224 | + } elseif ($key_localpart == 'type') { |
|
225 | 225 | if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { |
226 | 226 | // do nothing: already processed arrayType |
227 | 227 | } else { |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | $value_localpart = $this->getLocalPart($value); |
230 | 230 | $this->message[$pos]['type'] = $value_localpart; |
231 | 231 | $this->message[$pos]['typePrefix'] = $value_prefix; |
232 | - if(isset($this->namespaces[$value_prefix])){ |
|
232 | + if (isset($this->namespaces[$value_prefix])) { |
|
233 | 233 | $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; |
234 | - } else if(isset($attrs['xmlns:'.$value_prefix])) { |
|
234 | + } else if (isset($attrs['xmlns:'.$value_prefix])) { |
|
235 | 235 | $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; |
236 | 236 | } |
237 | 237 | // should do something here with the namespace of specified type? |
238 | 238 | } |
239 | - } elseif($key_localpart == 'arrayType'){ |
|
239 | + } elseif ($key_localpart == 'arrayType') { |
|
240 | 240 | $this->message[$pos]['type'] = 'array'; |
241 | 241 | /* do arrayType ereg here |
242 | 242 | [1] arrayTypeValue ::= atype asize |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | [6] nextDimension ::= Digit+ ',' |
248 | 248 | */ |
249 | 249 | $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; |
250 | - if(preg_match($expr,$value,$regs)){ |
|
250 | + if (preg_match($expr, $value, $regs)) { |
|
251 | 251 | $this->message[$pos]['typePrefix'] = $regs[1]; |
252 | 252 | $this->message[$pos]['arrayTypePrefix'] = $regs[1]; |
253 | 253 | if (isset($this->namespaces[$regs[1]])) { |
@@ -260,22 +260,22 @@ discard block |
||
260 | 260 | $this->message[$pos]['arrayCols'] = $regs[4]; |
261 | 261 | } |
262 | 262 | // specifies nil value (or not) |
263 | - } elseif ($key_localpart == 'nil'){ |
|
263 | + } elseif ($key_localpart == 'nil') { |
|
264 | 264 | $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); |
265 | 265 | // some other attribute |
266 | 266 | } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { |
267 | - $this->message[$pos]['xattrs']['!' . $key] = $value; |
|
267 | + $this->message[$pos]['xattrs']['!'.$key] = $value; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | if ($key == 'xmlns') { |
271 | 271 | $this->default_namespace = $value; |
272 | 272 | } |
273 | 273 | // log id |
274 | - if($key == 'id'){ |
|
274 | + if ($key == 'id') { |
|
275 | 275 | $this->ids[$value] = $pos; |
276 | 276 | } |
277 | 277 | // root |
278 | - if($key_localpart == 'root' && $value == 1){ |
|
278 | + if ($key_localpart == 'root' && $value == 1) { |
|
279 | 279 | $this->status = 'method'; |
280 | 280 | $this->root_struct_name = $name; |
281 | 281 | $this->root_struct = $pos; |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | $attstr .= " $key=\"$value\""; |
286 | 286 | } |
287 | 287 | // get namespace - must be done after namespace atts are processed |
288 | - if(isset($prefix)){ |
|
288 | + if (isset($prefix)) { |
|
289 | 289 | $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; |
290 | 290 | $this->default_namespace = $this->namespaces[$prefix]; |
291 | 291 | } else { |
292 | 292 | $this->message[$pos]['namespace'] = $this->default_namespace; |
293 | 293 | } |
294 | - if($this->status == 'header'){ |
|
294 | + if ($this->status == 'header') { |
|
295 | 295 | if ($this->root_header != $pos) { |
296 | - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; |
|
296 | + $this->responseHeaders .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>"; |
|
297 | 297 | } |
298 | - } elseif($this->root_struct_name != ''){ |
|
299 | - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; |
|
298 | + } elseif ($this->root_struct_name != '') { |
|
299 | + $this->document .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>"; |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
@@ -312,27 +312,27 @@ discard block |
||
312 | 312 | $pos = $this->depth_array[$this->depth--]; |
313 | 313 | |
314 | 314 | // get element prefix |
315 | - if(strpos($name,':')){ |
|
315 | + if (strpos($name, ':')) { |
|
316 | 316 | // get ns prefix |
317 | - $prefix = substr($name,0,strpos($name,':')); |
|
317 | + $prefix = substr($name, 0, strpos($name, ':')); |
|
318 | 318 | // get unqualified name |
319 | - $name = substr(strstr($name,':'),1); |
|
319 | + $name = substr(strstr($name, ':'), 1); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | // build to native type |
323 | - if(isset($this->body_position) && $pos > $this->body_position){ |
|
323 | + if (isset($this->body_position) && $pos > $this->body_position) { |
|
324 | 324 | // deal w/ multirefs |
325 | - if(isset($this->message[$pos]['attrs']['href'])){ |
|
325 | + if (isset($this->message[$pos]['attrs']['href'])) { |
|
326 | 326 | // get id |
327 | - $id = substr($this->message[$pos]['attrs']['href'],1); |
|
327 | + $id = substr($this->message[$pos]['attrs']['href'], 1); |
|
328 | 328 | // add placeholder to href array |
329 | 329 | $this->multirefs[$id][$pos] = 'placeholder'; |
330 | 330 | // add set a reference to it as the result value |
331 | - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; |
|
331 | + $this->message[$pos]['result'] = & $this->multirefs[$id][$pos]; |
|
332 | 332 | // build complexType values |
333 | - } elseif($this->message[$pos]['children'] != ''){ |
|
333 | + } elseif ($this->message[$pos]['children'] != '') { |
|
334 | 334 | // if result has already been generated (struct/array) |
335 | - if(!isset($this->message[$pos]['result'])){ |
|
335 | + if (!isset($this->message[$pos]['result'])) { |
|
336 | 336 | $this->message[$pos]['result'] = $this->buildVal($pos); |
337 | 337 | } |
338 | 338 | // build complexType values of attributes and possibly simpleContent |
@@ -382,15 +382,15 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | // for doclit |
385 | - if($this->status == 'header'){ |
|
385 | + if ($this->status == 'header') { |
|
386 | 386 | if ($this->root_header != $pos) { |
387 | - $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>"; |
|
387 | + $this->responseHeaders .= "</".(isset($prefix) ? $prefix.':' : '')."$name>"; |
|
388 | 388 | } |
389 | - } elseif($pos >= $this->root_struct){ |
|
390 | - $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>"; |
|
389 | + } elseif ($pos >= $this->root_struct) { |
|
390 | + $this->document .= "</".(isset($prefix) ? $prefix.':' : '')."$name>"; |
|
391 | 391 | } |
392 | 392 | // switch status |
393 | - if ($pos == $this->root_struct){ |
|
393 | + if ($pos == $this->root_struct) { |
|
394 | 394 | $this->status = 'body'; |
395 | 395 | $this->root_struct_namespace = $this->message[$pos]['namespace']; |
396 | 396 | } elseif ($pos == $this->root_header) { |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | function character_data($parser, $data) |
417 | 417 | { |
418 | 418 | $pos = $this->depth_array[$this->depth]; |
419 | - if ($this->xml_encoding == 'UTF-8'){ |
|
419 | + if ($this->xml_encoding == 'UTF-8') { |
|
420 | 420 | // TODO: add an option to disable this for folks who want |
421 | 421 | // raw UTF-8 that, e.g., might not map to iso-8859-1 |
422 | 422 | // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); |
423 | - if($this->decode_utf8){ |
|
423 | + if ($this->decode_utf8) { |
|
424 | 424 | $data = utf8_decode($data); |
425 | 425 | } |
426 | 426 | } |
427 | 427 | $this->message[$pos]['cdata'] .= $data; |
428 | 428 | // for doclit |
429 | - if($this->status == 'header'){ |
|
429 | + if ($this->status == 'header') { |
|
430 | 430 | $this->responseHeaders .= $data; |
431 | 431 | } else { |
432 | 432 | $this->document .= $data; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @access public |
441 | 441 | * @deprecated use get_soapbody instead |
442 | 442 | */ |
443 | - function get_response(){ |
|
443 | + function get_response() { |
|
444 | 444 | return $this->soapresponse; |
445 | 445 | } |
446 | 446 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @return mixed |
451 | 451 | * @access public |
452 | 452 | */ |
453 | - function get_soapbody(){ |
|
453 | + function get_soapbody() { |
|
454 | 454 | return $this->soapresponse; |
455 | 455 | } |
456 | 456 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return mixed |
461 | 461 | * @access public |
462 | 462 | */ |
463 | - function get_soapheader(){ |
|
463 | + function get_soapheader() { |
|
464 | 464 | return $this->soapheader; |
465 | 465 | } |
466 | 466 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | * @return string XML or empty if no Header |
471 | 471 | * @access public |
472 | 472 | */ |
473 | - function getHeaders(){ |
|
473 | + function getHeaders() { |
|
474 | 474 | return $this->responseHeaders; |
475 | 475 | } |
476 | 476 | |
@@ -527,40 +527,40 @@ discard block |
||
527 | 527 | * @return mixed PHP value |
528 | 528 | * @access private |
529 | 529 | */ |
530 | - function buildVal($pos){ |
|
531 | - if(!isset($this->message[$pos]['type'])){ |
|
530 | + function buildVal($pos) { |
|
531 | + if (!isset($this->message[$pos]['type'])) { |
|
532 | 532 | $this->message[$pos]['type'] = ''; |
533 | 533 | } |
534 | 534 | $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); |
535 | 535 | // if there are children... |
536 | - if($this->message[$pos]['children'] != ''){ |
|
536 | + if ($this->message[$pos]['children'] != '') { |
|
537 | 537 | $this->debug('in buildVal, there are children'); |
538 | - $children = explode('|',$this->message[$pos]['children']); |
|
538 | + $children = explode('|', $this->message[$pos]['children']); |
|
539 | 539 | array_shift($children); // knock off empty |
540 | 540 | // md array |
541 | - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ |
|
542 | - $r=0; // rowcount |
|
543 | - $c=0; // colcount |
|
544 | - foreach($children as $child_pos){ |
|
541 | + if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') { |
|
542 | + $r = 0; // rowcount |
|
543 | + $c = 0; // colcount |
|
544 | + foreach ($children as $child_pos) { |
|
545 | 545 | $this->debug("in buildVal, got an MD array element: $r, $c"); |
546 | 546 | $params[$r][] = $this->message[$child_pos]['result']; |
547 | 547 | $c++; |
548 | - if($c == $this->message[$pos]['arrayCols']){ |
|
548 | + if ($c == $this->message[$pos]['arrayCols']) { |
|
549 | 549 | $c = 0; |
550 | 550 | $r++; |
551 | 551 | } |
552 | 552 | } |
553 | 553 | // array |
554 | - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ |
|
554 | + } elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') { |
|
555 | 555 | $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); |
556 | - foreach($children as $child_pos){ |
|
556 | + foreach ($children as $child_pos) { |
|
557 | 557 | $params[] = &$this->message[$child_pos]['result']; |
558 | 558 | } |
559 | 559 | // apache Map type: java hashtable |
560 | - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ |
|
560 | + } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { |
|
561 | 561 | $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); |
562 | - foreach($children as $child_pos){ |
|
563 | - $kv = explode("|",$this->message[$child_pos]['children']); |
|
562 | + foreach ($children as $child_pos) { |
|
563 | + $kv = explode("|", $this->message[$child_pos]['children']); |
|
564 | 564 | $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; |
565 | 565 | } |
566 | 566 | // generic compound type |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | $notstruct = 0; |
575 | 575 | } |
576 | 576 | // |
577 | - foreach($children as $child_pos){ |
|
578 | - if($notstruct){ |
|
577 | + foreach ($children as $child_pos) { |
|
578 | + if ($notstruct) { |
|
579 | 579 | $params[] = &$this->message[$child_pos]['result']; |
580 | 580 | } else { |
581 | 581 | if (isset($params[$this->message[$child_pos]['name']])) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited |
45 | 45 | * @access public |
46 | 46 | */ |
47 | - function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) { |
|
47 | + function nusoap_wsdlcache($cache_dir = '.', $cache_lifetime = 0) { |
|
48 | 48 | $this->fplock = array(); |
49 | 49 | $this->cache_dir = $cache_dir != '' ? $cache_dir : '.'; |
50 | 50 | $this->cache_lifetime = $cache_lifetime; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @access private |
59 | 59 | */ |
60 | 60 | function createFilename($wsdl) { |
61 | - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); |
|
61 | + return $this->cache_dir.'/wsdlcache-'.md5($wsdl); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param string $string debug data |
68 | 68 | * @access private |
69 | 69 | */ |
70 | - function debug($string){ |
|
70 | + function debug($string) { |
|
71 | 71 | $this->debug_str .= get_class($this).": $string\n"; |
72 | 72 | } |
73 | 73 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $s = serialize($wsdl_instance); |
147 | 147 | if ($this->obtainMutex($filename, "w")) { |
148 | 148 | $fp = fopen($filename, "w"); |
149 | - if (! $fp) { |
|
149 | + if (!$fp) { |
|
150 | 150 | $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache"); |
151 | 151 | $this->releaseMutex($filename); |
152 | 152 | return false; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $ret = flock($this->fplock[md5($filename)], LOCK_UN); |
174 | 174 | fclose($this->fplock[md5($filename)]); |
175 | 175 | unset($this->fplock[md5($filename)]); |
176 | - if (! $ret) { |
|
176 | + if (!$ret) { |
|
177 | 177 | $this->debug("Not able to release lock for $filename"); |
178 | 178 | } |
179 | 179 | return $ret; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param mixed $attributes associative array of attributes to add to element serialization |
70 | 70 | * @access public |
71 | 71 | */ |
72 | - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { |
|
72 | + function soapval($name = 'soapval', $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false) { |
|
73 | 73 | parent::nusoap_base(); |
74 | 74 | $this->name = $name; |
75 | 75 | $this->type = $type; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return string XML data |
87 | 87 | * @access public |
88 | 88 | */ |
89 | - function serialize($use='encoded') { |
|
89 | + function serialize($use = 'encoded') { |
|
90 | 90 | return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return mixed |
97 | 97 | * @access public |
98 | 98 | */ |
99 | - function decode(){ |
|
99 | + function decode() { |
|
100 | 100 | return $this->value; |
101 | 101 | } |
102 | 102 | } |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | var $incoming_cookies = array(); |
30 | 30 | var $outgoing_payload = ''; |
31 | 31 | var $incoming_payload = ''; |
32 | - var $response_status_line; // HTTP response status line |
|
32 | + var $response_status_line; // HTTP response status line |
|
33 | 33 | var $useSOAPAction = true; |
34 | 34 | var $persistentConnection = false; |
35 | - var $ch = false; // cURL handle |
|
36 | - var $ch_options = array(); // cURL custom options |
|
37 | - var $use_curl = false; // force cURL use |
|
38 | - var $proxy = null; // proxy information (associative array) |
|
35 | + var $ch = false; // cURL handle |
|
36 | + var $ch_options = array(); // cURL custom options |
|
37 | + var $use_curl = false; // force cURL use |
|
38 | + var $proxy = null; // proxy information (associative array) |
|
39 | 39 | var $username = ''; |
40 | 40 | var $password = ''; |
41 | 41 | var $authtype = ''; |
42 | 42 | var $digestRequest = array(); |
43 | - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) |
|
43 | + var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) |
|
44 | 44 | // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' |
45 | 45 | // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' |
46 | 46 | // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param boolean $use_curl Whether to try to force cURL use |
58 | 58 | * @access public |
59 | 59 | */ |
60 | - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ |
|
60 | + function soap_transport_http($url, $curl_options = NULL, $use_curl = false) { |
|
61 | 61 | parent::nusoap_base(); |
62 | 62 | $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); |
63 | 63 | $this->appendDebug($this->varDump($curl_options)); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->ch_options = $curl_options; |
67 | 67 | } |
68 | 68 | $this->use_curl = $use_curl; |
69 | - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); |
|
69 | + preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev); |
|
70 | 70 | $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); |
71 | 71 | } |
72 | 72 | |
@@ -118,19 +118,19 @@ discard block |
||
118 | 118 | $this->url = $url; |
119 | 119 | |
120 | 120 | $u = parse_url($url); |
121 | - foreach($u as $k => $v){ |
|
121 | + foreach ($u as $k => $v) { |
|
122 | 122 | $this->debug("parsed URL $k = $v"); |
123 | 123 | $this->$k = $v; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // add any GET params to path |
127 | - if(isset($u['query']) && $u['query'] != ''){ |
|
128 | - $this->path .= '?' . $u['query']; |
|
127 | + if (isset($u['query']) && $u['query'] != '') { |
|
128 | + $this->path .= '?'.$u['query']; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // set default port |
132 | - if(!isset($u['port'])){ |
|
133 | - if($u['scheme'] == 'https'){ |
|
132 | + if (!isset($u['port'])) { |
|
133 | + if ($u['scheme'] == 'https') { |
|
134 | 134 | $this->port = 443; |
135 | 135 | } else { |
136 | 136 | $this->port = 80; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return boolean true if connected, false if not |
175 | 175 | * @access private |
176 | 176 | */ |
177 | - function connect($connection_timeout=0,$response_timeout=30){ |
|
177 | + function connect($connection_timeout = 0, $response_timeout = 30) { |
|
178 | 178 | // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like |
179 | 179 | // "regular" socket. |
180 | 180 | // TODO: disabled for now because OpenSSL must be *compiled* in (not just |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | // use persistent connection |
201 | - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ |
|
201 | + if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) { |
|
202 | 202 | if (!feof($this->fp)) { |
203 | 203 | $this->debug('Re-use persistent connection'); |
204 | 204 | return true; |
@@ -209,20 +209,20 @@ discard block |
||
209 | 209 | |
210 | 210 | // munge host if using OpenSSL |
211 | 211 | if ($this->scheme == 'ssl') { |
212 | - $host = 'ssl://' . $host; |
|
212 | + $host = 'ssl://'.$host; |
|
213 | 213 | } |
214 | - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); |
|
214 | + $this->debug('calling fsockopen with host '.$host.' connection_timeout '.$connection_timeout); |
|
215 | 215 | |
216 | 216 | // open socket |
217 | - if($connection_timeout > 0){ |
|
218 | - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); |
|
217 | + if ($connection_timeout > 0) { |
|
218 | + $this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout); |
|
219 | 219 | } else { |
220 | - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); |
|
220 | + $this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // test pointer |
224 | - if(!$this->fp) { |
|
225 | - $msg = 'Couldn\'t open socket connection to server ' . $this->url; |
|
224 | + if (!$this->fp) { |
|
225 | + $msg = 'Couldn\'t open socket connection to server '.$this->url; |
|
226 | 226 | if ($this->errno) { |
227 | 227 | $msg .= ', Error ('.$this->errno.'): '.$this->error_str; |
228 | 228 | } else { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | // set response timeout |
237 | - $this->debug('set response timeout to ' . $response_timeout); |
|
238 | - socket_set_timeout( $this->fp, $response_timeout); |
|
237 | + $this->debug('set response timeout to '.$response_timeout); |
|
238 | + socket_set_timeout($this->fp, $response_timeout); |
|
239 | 239 | |
240 | 240 | $this->debug('socket connected'); |
241 | 241 | return true; |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | $this->debug('cURL connection set up'); |
395 | 395 | return true; |
396 | 396 | } else { |
397 | - $this->setError('Unknown scheme ' . $this->scheme); |
|
398 | - $this->debug('Unknown scheme ' . $this->scheme); |
|
397 | + $this->setError('Unknown scheme '.$this->scheme); |
|
398 | + $this->debug('Unknown scheme '.$this->scheme); |
|
399 | 399 | return false; |
400 | 400 | } |
401 | 401 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @return string data |
411 | 411 | * @access public |
412 | 412 | */ |
413 | - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { |
|
413 | + function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) { |
|
414 | 414 | |
415 | 415 | $this->debug('entered send() with data of length: '.strlen($data)); |
416 | 416 | |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | $this->tryagain = false; |
421 | 421 | if ($tries++ < 2) { |
422 | 422 | // make connnection |
423 | - if (!$this->connect($timeout, $response_timeout)){ |
|
423 | + if (!$this->connect($timeout, $response_timeout)) { |
|
424 | 424 | return false; |
425 | 425 | } |
426 | 426 | |
427 | 427 | // send request |
428 | - if (!$this->sendRequest($data, $cookies)){ |
|
428 | + if (!$this->sendRequest($data, $cookies)) { |
|
429 | 429 | return false; |
430 | 430 | } |
431 | 431 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @access public |
452 | 452 | * @deprecated |
453 | 453 | */ |
454 | - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { |
|
454 | + function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) { |
|
455 | 455 | return $this->send($data, $timeout, $response_timeout, $cookies); |
456 | 456 | } |
457 | 457 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $this->appendDebug($this->varDump($certRequest)); |
473 | 473 | // cf. RFC 2617 |
474 | 474 | if ($authtype == 'basic') { |
475 | - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); |
|
475 | + $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':', '', $username).':'.$password)); |
|
476 | 476 | } elseif ($authtype == 'digest') { |
477 | 477 | if (isset($digestRequest['nonce'])) { |
478 | 478 | $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; |
@@ -480,16 +480,16 @@ discard block |
||
480 | 480 | // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) |
481 | 481 | |
482 | 482 | // A1 = unq(username-value) ":" unq(realm-value) ":" passwd |
483 | - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; |
|
483 | + $A1 = $username.':'.(isset($digestRequest['realm']) ? $digestRequest['realm'] : '').':'.$password; |
|
484 | 484 | |
485 | 485 | // H(A1) = MD5(A1) |
486 | 486 | $HA1 = md5($A1); |
487 | 487 | |
488 | 488 | // A2 = Method ":" digest-uri-value |
489 | - $A2 = $this->request_method . ':' . $this->digest_uri; |
|
489 | + $A2 = $this->request_method.':'.$this->digest_uri; |
|
490 | 490 | |
491 | 491 | // H(A2) |
492 | - $HA2 = md5($A2); |
|
492 | + $HA2 = md5($A2); |
|
493 | 493 | |
494 | 494 | // KD(secret, data) = H(concat(secret, ":", data)) |
495 | 495 | // if qop == auth: |
@@ -506,19 +506,19 @@ discard block |
||
506 | 506 | $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; |
507 | 507 | $cnonce = $nonce; |
508 | 508 | if ($digestRequest['qop'] != '') { |
509 | - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; |
|
509 | + $unhashedDigest = $HA1.':'.$nonce.':'.sprintf("%08d", $digestRequest['nc']).':'.$cnonce.':'.$digestRequest['qop'].':'.$HA2; |
|
510 | 510 | } else { |
511 | - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; |
|
511 | + $unhashedDigest = $HA1.':'.$nonce.':'.$HA2; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | $hashedDigest = md5($unhashedDigest); |
515 | 515 | |
516 | 516 | $opaque = ''; |
517 | 517 | if (isset($digestRequest['opaque'])) { |
518 | - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; |
|
518 | + $opaque = ', opaque="'.$digestRequest['opaque'].'"'; |
|
519 | 519 | } |
520 | 520 | |
521 | - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); |
|
521 | + $this->setHeader('Authorization', 'Digest username="'.$username.'", realm="'.$digestRequest['realm'].'", nonce="'.$nonce.'", uri="'.$this->digest_uri.$opaque.'", cnonce="'.$cnonce.'", nc='.sprintf("%08x", $digestRequest['nc']).', qop="'.$digestRequest['qop'].'", response="'.$hashedDigest.'"'); |
|
522 | 522 | } |
523 | 523 | } elseif ($authtype == 'certificate') { |
524 | 524 | $this->certRequest = $certRequest; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @access public |
541 | 541 | */ |
542 | 542 | function setSOAPAction($soapaction) { |
543 | - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); |
|
543 | + $this->setHeader('SOAPAction', '"'.$soapaction.'"'); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * @param string $enc encoding style. supported values: gzip, deflate, or both |
550 | 550 | * @access public |
551 | 551 | */ |
552 | - function setEncoding($enc='gzip, deflate') { |
|
552 | + function setEncoding($enc = 'gzip, deflate') { |
|
553 | 553 | if (function_exists('gzdeflate')) { |
554 | 554 | $this->protocol_version = '1.1'; |
555 | 555 | $this->setHeader('Accept-Encoding', $enc); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @access private |
603 | 603 | */ |
604 | 604 | function isSkippableCurlHeader(&$data) { |
605 | - $skipHeaders = array( 'HTTP/1.1 100', |
|
605 | + $skipHeaders = array('HTTP/1.1 100', |
|
606 | 606 | 'HTTP/1.0 301', |
607 | 607 | 'HTTP/1.1 301', |
608 | 608 | 'HTTP/1.0 302', |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * @access public |
629 | 629 | * @deprecated |
630 | 630 | */ |
631 | - function decodeChunked($buffer, $lb){ |
|
631 | + function decodeChunked($buffer, $lb) { |
|
632 | 632 | // length := 0 |
633 | 633 | $length = 0; |
634 | 634 | $new = ''; |
@@ -640,17 +640,17 @@ discard block |
||
640 | 640 | $this->debug('no linebreak found in decodeChunked'); |
641 | 641 | return $new; |
642 | 642 | } |
643 | - $temp = substr($buffer,0,$chunkend); |
|
644 | - $chunk_size = hexdec( trim($temp) ); |
|
643 | + $temp = substr($buffer, 0, $chunkend); |
|
644 | + $chunk_size = hexdec(trim($temp)); |
|
645 | 645 | $chunkstart = $chunkend + strlen($lb); |
646 | 646 | // while (chunk-size > 0) { |
647 | 647 | while ($chunk_size > 0) { |
648 | 648 | $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); |
649 | - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); |
|
649 | + $chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size); |
|
650 | 650 | |
651 | 651 | // Just in case we got a broken connection |
652 | 652 | if ($chunkend == FALSE) { |
653 | - $chunk = substr($buffer,$chunkstart); |
|
653 | + $chunk = substr($buffer, $chunkstart); |
|
654 | 654 | // append chunk-data to entity-body |
655 | 655 | $new .= $chunk; |
656 | 656 | $length += strlen($chunk); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | } |
659 | 659 | |
660 | 660 | // read chunk-data and CRLF |
661 | - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); |
|
661 | + $chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart); |
|
662 | 662 | // append chunk-data to entity-body |
663 | 663 | $new .= $chunk; |
664 | 664 | // length := length + chunk-size |
@@ -670,8 +670,8 @@ discard block |
||
670 | 670 | if ($chunkend == FALSE) { |
671 | 671 | break; //Just in case we got a broken connection |
672 | 672 | } |
673 | - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); |
|
674 | - $chunk_size = hexdec( trim($temp) ); |
|
673 | + $temp = substr($buffer, $chunkstart, $chunkend - $chunkstart); |
|
674 | + $chunk_size = hexdec(trim($temp)); |
|
675 | 675 | $chunkstart = $chunkend; |
676 | 676 | } |
677 | 677 | return $new; |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | $this->outgoing_payload = "$req\r\n"; |
707 | 707 | |
708 | 708 | // loop thru headers, serializing |
709 | - foreach($this->outgoing_headers as $k => $v){ |
|
709 | + foreach ($this->outgoing_headers as $k => $v) { |
|
710 | 710 | $hdr = $k.': '.$v; |
711 | 711 | $this->debug("HTTP header: $hdr"); |
712 | 712 | $this->outgoing_payload .= "$hdr\r\n"; |
@@ -743,12 +743,12 @@ discard block |
||
743 | 743 | |
744 | 744 | if ($this->io_method() == 'socket') { |
745 | 745 | // send payload |
746 | - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { |
|
746 | + if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { |
|
747 | 747 | $this->setError('couldn\'t write message data to socket'); |
748 | 748 | $this->debug('couldn\'t write message data to socket'); |
749 | 749 | return false; |
750 | 750 | } |
751 | - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); |
|
751 | + $this->debug('wrote data to socket, length = '.strlen($this->outgoing_payload)); |
|
752 | 752 | return true; |
753 | 753 | } else if ($this->io_method() == 'curl') { |
754 | 754 | // set payload |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | // some servers refuse to work with (so we no longer use this method!) |
758 | 758 | //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); |
759 | 759 | $curl_headers = array(); |
760 | - foreach($this->outgoing_headers as $k => $v){ |
|
760 | + foreach ($this->outgoing_headers as $k => $v) { |
|
761 | 761 | if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { |
762 | 762 | $this->debug("Skip cURL header $k: $v"); |
763 | 763 | } else { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | } |
766 | 766 | } |
767 | 767 | if ($cookie_str != '') { |
768 | - $curl_headers[] = 'Cookie: ' . $cookie_str; |
|
768 | + $curl_headers[] = 'Cookie: '.$cookie_str; |
|
769 | 769 | } |
770 | 770 | $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); |
771 | 771 | $this->debug('set cURL HTTP headers'); |
@@ -791,62 +791,62 @@ discard block |
||
791 | 791 | * @return string the response (also sets member variables like incoming_payload) |
792 | 792 | * @access private |
793 | 793 | */ |
794 | - function getResponse(){ |
|
794 | + function getResponse() { |
|
795 | 795 | $this->incoming_payload = ''; |
796 | 796 | |
797 | 797 | if ($this->io_method() == 'socket') { |
798 | 798 | // loop until headers have been retrieved |
799 | 799 | $data = ''; |
800 | - while (!isset($lb)){ |
|
800 | + while (!isset($lb)) { |
|
801 | 801 | |
802 | 802 | // We might EOF during header read. |
803 | - if(feof($this->fp)) { |
|
803 | + if (feof($this->fp)) { |
|
804 | 804 | $this->incoming_payload = $data; |
805 | - $this->debug('found no headers before EOF after length ' . strlen($data)); |
|
806 | - $this->debug("received before EOF:\n" . $data); |
|
805 | + $this->debug('found no headers before EOF after length '.strlen($data)); |
|
806 | + $this->debug("received before EOF:\n".$data); |
|
807 | 807 | $this->setError('server failed to send headers'); |
808 | 808 | return false; |
809 | 809 | } |
810 | 810 | |
811 | 811 | $tmp = fgets($this->fp, 256); |
812 | 812 | $tmplen = strlen($tmp); |
813 | - $this->debug("read line of $tmplen bytes: " . trim($tmp)); |
|
813 | + $this->debug("read line of $tmplen bytes: ".trim($tmp)); |
|
814 | 814 | |
815 | 815 | if ($tmplen == 0) { |
816 | 816 | $this->incoming_payload = $data; |
817 | - $this->debug('socket read of headers timed out after length ' . strlen($data)); |
|
818 | - $this->debug("read before timeout: " . $data); |
|
817 | + $this->debug('socket read of headers timed out after length '.strlen($data)); |
|
818 | + $this->debug("read before timeout: ".$data); |
|
819 | 819 | $this->setError('socket read of headers timed out'); |
820 | 820 | return false; |
821 | 821 | } |
822 | 822 | |
823 | 823 | $data .= $tmp; |
824 | - $pos = strpos($data,"\r\n\r\n"); |
|
825 | - if($pos > 1){ |
|
824 | + $pos = strpos($data, "\r\n\r\n"); |
|
825 | + if ($pos > 1) { |
|
826 | 826 | $lb = "\r\n"; |
827 | 827 | } else { |
828 | - $pos = strpos($data,"\n\n"); |
|
829 | - if($pos > 1){ |
|
828 | + $pos = strpos($data, "\n\n"); |
|
829 | + if ($pos > 1) { |
|
830 | 830 | $lb = "\n"; |
831 | 831 | } |
832 | 832 | } |
833 | 833 | // remove 100 headers |
834 | - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { |
|
834 | + if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) { |
|
835 | 835 | unset($lb); |
836 | 836 | $data = ''; |
837 | 837 | }// |
838 | 838 | } |
839 | 839 | // store header data |
840 | 840 | $this->incoming_payload .= $data; |
841 | - $this->debug('found end of headers after length ' . strlen($data)); |
|
841 | + $this->debug('found end of headers after length '.strlen($data)); |
|
842 | 842 | // process headers |
843 | - $header_data = trim(substr($data,0,$pos)); |
|
844 | - $header_array = explode($lb,$header_data); |
|
843 | + $header_data = trim(substr($data, 0, $pos)); |
|
844 | + $header_array = explode($lb, $header_data); |
|
845 | 845 | $this->incoming_headers = array(); |
846 | 846 | $this->incoming_cookies = array(); |
847 | - foreach($header_array as $header_line){ |
|
848 | - $arr = explode(':',$header_line, 2); |
|
849 | - if(count($arr) > 1){ |
|
847 | + foreach ($header_array as $header_line) { |
|
848 | + $arr = explode(':', $header_line, 2); |
|
849 | + if (count($arr) > 1) { |
|
850 | 850 | $header_name = strtolower(trim($arr[0])); |
851 | 851 | $this->incoming_headers[$header_name] = trim($arr[1]); |
852 | 852 | if ($header_name == 'set-cookie') { |
@@ -854,20 +854,20 @@ discard block |
||
854 | 854 | $cookie = $this->parseCookie(trim($arr[1])); |
855 | 855 | if ($cookie) { |
856 | 856 | $this->incoming_cookies[] = $cookie; |
857 | - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); |
|
857 | + $this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']); |
|
858 | 858 | } else { |
859 | - $this->debug('did not find cookie in ' . trim($arr[1])); |
|
859 | + $this->debug('did not find cookie in '.trim($arr[1])); |
|
860 | 860 | } |
861 | 861 | } |
862 | 862 | } else if (isset($header_name)) { |
863 | 863 | // append continuation line to previous header |
864 | - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; |
|
864 | + $this->incoming_headers[$header_name] .= $lb.' '.$header_line; |
|
865 | 865 | } |
866 | 866 | } |
867 | 867 | |
868 | 868 | // loop until msg has been received |
869 | 869 | if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { |
870 | - $content_length = 2147483647; // ignore any content-length header |
|
870 | + $content_length = 2147483647; // ignore any content-length header |
|
871 | 871 | $chunked = true; |
872 | 872 | $this->debug("want to read chunked content"); |
873 | 873 | } elseif (isset($this->incoming_headers['content-length'])) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | $chunked = false; |
876 | 876 | $this->debug("want to read content of length $content_length"); |
877 | 877 | } else { |
878 | - $content_length = 2147483647; |
|
878 | + $content_length = 2147483647; |
|
879 | 879 | $chunked = false; |
880 | 880 | $this->debug("want to read content to EOF"); |
881 | 881 | } |
@@ -887,8 +887,8 @@ discard block |
||
887 | 887 | $this->debug("read chunk line of $tmplen bytes"); |
888 | 888 | if ($tmplen == 0) { |
889 | 889 | $this->incoming_payload = $data; |
890 | - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); |
|
891 | - $this->debug("read before timeout:\n" . $data); |
|
890 | + $this->debug('socket read of chunk length timed out after length '.strlen($data)); |
|
891 | + $this->debug("read before timeout:\n".$data); |
|
892 | 892 | $this->setError('socket read of chunk length timed out'); |
893 | 893 | return false; |
894 | 894 | } |
@@ -903,8 +903,8 @@ discard block |
||
903 | 903 | $this->debug("read buffer of $tmplen bytes"); |
904 | 904 | if (($tmplen == 0) && (!feof($this->fp))) { |
905 | 905 | $this->incoming_payload = $data; |
906 | - $this->debug('socket read of body timed out after length ' . strlen($data)); |
|
907 | - $this->debug("read before timeout:\n" . $data); |
|
906 | + $this->debug('socket read of body timed out after length '.strlen($data)); |
|
907 | + $this->debug("read before timeout:\n".$data); |
|
908 | 908 | $this->setError('socket read of body timed out'); |
909 | 909 | return false; |
910 | 910 | } |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | $this->debug("read chunk terminator of $tmplen bytes"); |
918 | 918 | if ($tmplen == 0) { |
919 | 919 | $this->incoming_payload = $data; |
920 | - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); |
|
921 | - $this->debug("read before timeout:\n" . $data); |
|
920 | + $this->debug('socket read of chunk terminator timed out after length '.strlen($data)); |
|
921 | + $this->debug("read before timeout:\n".$data); |
|
922 | 922 | $this->setError('socket read of chunk terminator timed out'); |
923 | 923 | return false; |
924 | 924 | } |
@@ -927,21 +927,21 @@ discard block |
||
927 | 927 | if (feof($this->fp)) { |
928 | 928 | $this->debug('read to EOF'); |
929 | 929 | } |
930 | - $this->debug('read body of length ' . strlen($data)); |
|
930 | + $this->debug('read body of length '.strlen($data)); |
|
931 | 931 | $this->incoming_payload .= $data; |
932 | 932 | $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); |
933 | 933 | |
934 | 934 | // close filepointer |
935 | - if( |
|
935 | + if ( |
|
936 | 936 | (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || |
937 | - (! $this->persistentConnection) || feof($this->fp)){ |
|
937 | + (!$this->persistentConnection) || feof($this->fp)) { |
|
938 | 938 | fclose($this->fp); |
939 | 939 | $this->fp = false; |
940 | 940 | $this->debug('closed socket'); |
941 | 941 | } |
942 | 942 | |
943 | 943 | // connection was closed unexpectedly |
944 | - if($this->incoming_payload == ''){ |
|
944 | + if ($this->incoming_payload == '') { |
|
945 | 945 | $this->setError('no response from server'); |
946 | 946 | return false; |
947 | 947 | } |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | if ($cErr != '') { |
968 | 968 | $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>'; |
969 | 969 | // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE |
970 | - foreach(curl_getinfo($this->ch) as $k => $v){ |
|
970 | + foreach (curl_getinfo($this->ch) as $k => $v) { |
|
971 | 971 | $err .= "$k: $v<br>"; |
972 | 972 | } |
973 | 973 | $this->debug($err); |
@@ -987,44 +987,44 @@ discard block |
||
987 | 987 | $savedata = $data; |
988 | 988 | while ($this->isSkippableCurlHeader($data)) { |
989 | 989 | $this->debug("Found HTTP header to skip"); |
990 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
991 | - $data = ltrim(substr($data,$pos)); |
|
992 | - } elseif($pos = strpos($data,"\n\n") ) { |
|
993 | - $data = ltrim(substr($data,$pos)); |
|
990 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
991 | + $data = ltrim(substr($data, $pos)); |
|
992 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
993 | + $data = ltrim(substr($data, $pos)); |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | |
997 | 997 | if ($data == '') { |
998 | 998 | // have nothing left; just remove 100 header(s) |
999 | 999 | $data = $savedata; |
1000 | - while (preg_match('/^HTTP\/1.1 100/',$data)) { |
|
1001 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
1002 | - $data = ltrim(substr($data,$pos)); |
|
1003 | - } elseif($pos = strpos($data,"\n\n") ) { |
|
1004 | - $data = ltrim(substr($data,$pos)); |
|
1000 | + while (preg_match('/^HTTP\/1.1 100/', $data)) { |
|
1001 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
1002 | + $data = ltrim(substr($data, $pos)); |
|
1003 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
1004 | + $data = ltrim(substr($data, $pos)); |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | // separate content from HTTP headers |
1010 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
1010 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
1011 | 1011 | $lb = "\r\n"; |
1012 | - } elseif( $pos = strpos($data,"\n\n")) { |
|
1012 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
1013 | 1013 | $lb = "\n"; |
1014 | 1014 | } else { |
1015 | 1015 | $this->debug('no proper separation of headers and document'); |
1016 | 1016 | $this->setError('no proper separation of headers and document'); |
1017 | 1017 | return false; |
1018 | 1018 | } |
1019 | - $header_data = trim(substr($data,0,$pos)); |
|
1020 | - $header_array = explode($lb,$header_data); |
|
1021 | - $data = ltrim(substr($data,$pos)); |
|
1019 | + $header_data = trim(substr($data, 0, $pos)); |
|
1020 | + $header_array = explode($lb, $header_data); |
|
1021 | + $data = ltrim(substr($data, $pos)); |
|
1022 | 1022 | $this->debug('found proper separation of headers and document'); |
1023 | 1023 | $this->debug('cleaned data, stringlen: '.strlen($data)); |
1024 | 1024 | // clean headers |
1025 | 1025 | foreach ($header_array as $header_line) { |
1026 | - $arr = explode(':',$header_line,2); |
|
1027 | - if(count($arr) > 1){ |
|
1026 | + $arr = explode(':', $header_line, 2); |
|
1027 | + if (count($arr) > 1) { |
|
1028 | 1028 | $header_name = strtolower(trim($arr[0])); |
1029 | 1029 | $this->incoming_headers[$header_name] = trim($arr[1]); |
1030 | 1030 | if ($header_name == 'set-cookie') { |
@@ -1032,14 +1032,14 @@ discard block |
||
1032 | 1032 | $cookie = $this->parseCookie(trim($arr[1])); |
1033 | 1033 | if ($cookie) { |
1034 | 1034 | $this->incoming_cookies[] = $cookie; |
1035 | - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); |
|
1035 | + $this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']); |
|
1036 | 1036 | } else { |
1037 | - $this->debug('did not find cookie in ' . trim($arr[1])); |
|
1037 | + $this->debug('did not find cookie in '.trim($arr[1])); |
|
1038 | 1038 | } |
1039 | 1039 | } |
1040 | 1040 | } else if (isset($header_name)) { |
1041 | 1041 | // append continuation line to previous header |
1042 | - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; |
|
1042 | + $this->incoming_headers[$header_name] .= $lb.' '.$header_line; |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | // see if we need to resend the request with http digest authentication |
1054 | 1054 | if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { |
1055 | - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); |
|
1055 | + $this->debug("Got $http_status $http_reason with Location: ".$this->incoming_headers['location']); |
|
1056 | 1056 | $this->setURL($this->incoming_headers['location']); |
1057 | 1057 | $this->tryagain = true; |
1058 | 1058 | return false; |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | // see if we need to resend the request with http digest authentication |
1062 | 1062 | if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { |
1063 | - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); |
|
1063 | + $this->debug("Got 401 $http_reason with WWW-Authenticate: ".$this->incoming_headers['www-authenticate']); |
|
1064 | 1064 | if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { |
1065 | 1065 | $this->debug('Server wants digest authentication'); |
1066 | 1066 | // remove "Digest " from our elements |
@@ -1095,10 +1095,10 @@ discard block |
||
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | // decode content-encoding |
1098 | - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ |
|
1099 | - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ |
|
1098 | + if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') { |
|
1099 | + if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') { |
|
1100 | 1100 | // if decoding works, use it. else assume data wasn't gzencoded |
1101 | - if(function_exists('gzinflate')){ |
|
1101 | + if (function_exists('gzinflate')) { |
|
1102 | 1102 | //$timer->setMarker('starting decoding of gzip/deflated content'); |
1103 | 1103 | // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) |
1104 | 1104 | // this means there are no Zlib headers, although there should be |
@@ -1107,13 +1107,13 @@ discard block |
||
1107 | 1107 | if ($this->incoming_headers['content-encoding'] == 'deflate') { |
1108 | 1108 | if ($degzdata = @gzinflate($data)) { |
1109 | 1109 | $data = $degzdata; |
1110 | - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); |
|
1110 | + $this->debug('The payload has been inflated to '.strlen($data).' bytes'); |
|
1111 | 1111 | if (strlen($data) < $datalen) { |
1112 | 1112 | // test for the case that the payload has been compressed twice |
1113 | 1113 | $this->debug('The inflated payload is smaller than the gzipped one; try again'); |
1114 | 1114 | if ($degzdata = @gzinflate($data)) { |
1115 | 1115 | $data = $degzdata; |
1116 | - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); |
|
1116 | + $this->debug('The payload has been inflated again to '.strlen($data).' bytes'); |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | } else { |
@@ -1123,13 +1123,13 @@ discard block |
||
1123 | 1123 | } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { |
1124 | 1124 | if ($degzdata = @gzinflate(substr($data, 10))) { // do our best |
1125 | 1125 | $data = $degzdata; |
1126 | - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); |
|
1126 | + $this->debug('The payload has been un-gzipped to '.strlen($data).' bytes'); |
|
1127 | 1127 | if (strlen($data) < $datalen) { |
1128 | 1128 | // test for the case that the payload has been compressed twice |
1129 | 1129 | $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); |
1130 | 1130 | if ($degzdata = @gzinflate(substr($data, 10))) { |
1131 | 1131 | $data = $degzdata; |
1132 | - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); |
|
1132 | + $this->debug('The payload has been un-gzipped again to '.strlen($data).' bytes'); |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | } else { |
@@ -1146,14 +1146,14 @@ discard block |
||
1146 | 1146 | $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); |
1147 | 1147 | } |
1148 | 1148 | } else { |
1149 | - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); |
|
1150 | - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); |
|
1149 | + $this->debug('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']); |
|
1150 | + $this->setError('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']); |
|
1151 | 1151 | } |
1152 | 1152 | } else { |
1153 | 1153 | $this->debug('No Content-Encoding header'); |
1154 | 1154 | } |
1155 | 1155 | |
1156 | - if(strlen($data) == 0){ |
|
1156 | + if (strlen($data) == 0) { |
|
1157 | 1157 | $this->debug('no data after headers!'); |
1158 | 1158 | $this->setError('no data present after HTTP headers'); |
1159 | 1159 | return false; |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | * @access public |
1171 | 1171 | */ |
1172 | 1172 | function setContentType($type, $charset = false) { |
1173 | - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); |
|
1173 | + $this->setHeader('Content-Type', $type.($charset ? '; charset='.$charset : '')); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | /** |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | * @return boolean whether the request was honored by this method. |
1180 | 1180 | * @access public |
1181 | 1181 | */ |
1182 | - function usePersistentConnection(){ |
|
1182 | + function usePersistentConnection() { |
|
1183 | 1183 | if (isset($this->outgoing_headers['Accept-Encoding'])) { |
1184 | 1184 | return false; |
1185 | 1185 | } |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | * TODO: allow a Set-Cookie string to be parsed into multiple cookies |
1201 | 1201 | */ |
1202 | 1202 | function parseCookie($cookie_str) { |
1203 | - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; |
|
1203 | + $cookie_str = str_replace('; ', ';', $cookie_str).';'; |
|
1204 | 1204 | $data = preg_split('/;/', $cookie_str); |
1205 | 1205 | $value_str = $data[0]; |
1206 | 1206 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | |
1225 | 1225 | $cookie_param = 'path='; |
1226 | 1226 | $start = strpos($cookie_str, $cookie_param); |
1227 | - if ( $start > 0 ) { |
|
1227 | + if ($start > 0) { |
|
1228 | 1228 | $path = substr($cookie_str, $start + strlen($cookie_param)); |
1229 | 1229 | $path = substr($path, 0, strpos($path, ';')); |
1230 | 1230 | } else { |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | if ($sep_pos) { |
1244 | 1244 | $name = substr($value_str, 0, $sep_pos); |
1245 | 1245 | $value = substr($value_str, $sep_pos + 1); |
1246 | - $cookie= array( 'name' => $name, |
|
1246 | + $cookie = array('name' => $name, |
|
1247 | 1247 | 'value' => $value, |
1248 | 1248 | 'domain' => $domain, |
1249 | 1249 | 'path' => $path, |
@@ -1263,40 +1263,40 @@ discard block |
||
1263 | 1263 | * @return string for Cookie-HTTP-Header |
1264 | 1264 | * @access private |
1265 | 1265 | */ |
1266 | - function getCookiesForRequest($cookies, $secure=false) { |
|
1266 | + function getCookiesForRequest($cookies, $secure = false) { |
|
1267 | 1267 | $cookie_str = ''; |
1268 | - if ((! is_null($cookies)) && (is_array($cookies))) { |
|
1268 | + if ((!is_null($cookies)) && (is_array($cookies))) { |
|
1269 | 1269 | foreach ($cookies as $cookie) { |
1270 | - if (! is_array($cookie)) { |
|
1270 | + if (!is_array($cookie)) { |
|
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); |
1274 | - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { |
|
1274 | + if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) { |
|
1275 | 1275 | if (strtotime($cookie['expires']) <= time()) { |
1276 | 1276 | $this->debug('cookie has expired'); |
1277 | 1277 | continue; |
1278 | 1278 | } |
1279 | 1279 | } |
1280 | - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { |
|
1280 | + if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) { |
|
1281 | 1281 | $domain = preg_quote($cookie['domain']); |
1282 | - if (! preg_match("'.*$domain$'i", $this->host)) { |
|
1282 | + if (!preg_match("'.*$domain$'i", $this->host)) { |
|
1283 | 1283 | $this->debug('cookie has different domain'); |
1284 | 1284 | continue; |
1285 | 1285 | } |
1286 | 1286 | } |
1287 | - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { |
|
1287 | + if ((isset($cookie['path'])) && (!empty($cookie['path']))) { |
|
1288 | 1288 | $path = preg_quote($cookie['path']); |
1289 | - if (! preg_match("'^$path.*'i", $this->path)) { |
|
1289 | + if (!preg_match("'^$path.*'i", $this->path)) { |
|
1290 | 1290 | $this->debug('cookie is for a different path'); |
1291 | 1291 | continue; |
1292 | 1292 | } |
1293 | 1293 | } |
1294 | - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { |
|
1294 | + if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { |
|
1295 | 1295 | $this->debug('cookie is secure, transport is not'); |
1296 | 1296 | continue; |
1297 | 1297 | } |
1298 | - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; |
|
1299 | - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); |
|
1298 | + $cookie_str .= $cookie['name'].'='.$cookie['value'].'; '; |
|
1299 | + $this->debug('add cookie to Cookie-String: '.$cookie['name'].'='.$cookie['value']); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | return $cookie_str; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @access public |
87 | 87 | */ |
88 | 88 | function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { |
89 | - if (! $cid) { |
|
89 | + if (!$cid) { |
|
90 | 90 | $cid = md5(uniqid(time())); |
91 | 91 | } |
92 | 92 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @access private |
222 | 222 | */ |
223 | 223 | function parseResponse($headers, $data) { |
224 | - $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); |
|
224 | + $this->debug('Entering parseResponse() for payload of length '.strlen($data).' and type of '.$headers['content-type']); |
|
225 | 225 | $this->responseAttachments = array(); |
226 | 226 | if (strstr($headers['content-type'], 'multipart/related')) { |
227 | 227 | $this->debug('Decode multipart/related'); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | foreach ($headers as $k => $v) { |
230 | 230 | $input .= "$k: $v\r\n"; |
231 | 231 | } |
232 | - $params['input'] = $input . "\r\n" . $data; |
|
232 | + $params['input'] = $input."\r\n".$data; |
|
233 | 233 | $params['include_bodies'] = true; |
234 | 234 | $params['decode_bodies'] = true; |
235 | 235 | $params['decode_headers'] = true; |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | |
239 | 239 | foreach ($structure->parts as $part) { |
240 | 240 | if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { |
241 | - $this->debug('Have root part of type ' . $part->headers['content-type']); |
|
241 | + $this->debug('Have root part of type '.$part->headers['content-type']); |
|
242 | 242 | $root = $part->body; |
243 | 243 | $return = parent::parseResponse($part->headers, $part->body); |
244 | 244 | } else { |
245 | - $this->debug('Have an attachment of type ' . $part->headers['content-type']); |
|
245 | + $this->debug('Have an attachment of type '.$part->headers['content-type']); |
|
246 | 246 | $info['data'] = $part->body; |
247 | 247 | $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; |
248 | 248 | $info['contenttype'] = $part->headers['content-type']; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @access public |
317 | 317 | */ |
318 | 318 | function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { |
319 | - if (! $cid) { |
|
319 | + if (!$cid) { |
|
320 | 320 | $cid = md5(uniqid(time())); |
321 | 321 | } |
322 | 322 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @access private |
452 | 452 | */ |
453 | 453 | function parseRequest($headers, $data) { |
454 | - $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); |
|
454 | + $this->debug('Entering parseRequest() for payload of length '.strlen($data).' and type of '.$headers['content-type']); |
|
455 | 455 | $this->requestAttachments = array(); |
456 | 456 | if (strstr($headers['content-type'], 'multipart/related')) { |
457 | 457 | $this->debug('Decode multipart/related'); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | foreach ($headers as $k => $v) { |
460 | 460 | $input .= "$k: $v\r\n"; |
461 | 461 | } |
462 | - $params['input'] = $input . "\r\n" . $data; |
|
462 | + $params['input'] = $input."\r\n".$data; |
|
463 | 463 | $params['include_bodies'] = true; |
464 | 464 | $params['decode_bodies'] = true; |
465 | 465 | $params['decode_headers'] = true; |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | |
469 | 469 | foreach ($structure->parts as $part) { |
470 | 470 | if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { |
471 | - $this->debug('Have root part of type ' . $part->headers['content-type']); |
|
471 | + $this->debug('Have root part of type '.$part->headers['content-type']); |
|
472 | 472 | $return = parent::parseRequest($part->headers, $part->body); |
473 | 473 | } else { |
474 | - $this->debug('Have an attachment of type ' . $part->headers['content-type']); |
|
474 | + $this->debug('Have an attachment of type '.$part->headers['content-type']); |
|
475 | 475 | $info['data'] = $part->body; |
476 | 476 | $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; |
477 | 477 | $info['contenttype'] = $part->headers['content-type']; |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | var $proxypassword = ''; |
48 | 48 | var $timeout = 0; |
49 | 49 | var $response_timeout = 30; |
50 | - var $curl_options = array(); // User-specified cURL options |
|
51 | - var $use_curl = false; // whether to always try to use cURL |
|
50 | + var $curl_options = array(); // User-specified cURL options |
|
51 | + var $use_curl = false; // whether to always try to use cURL |
|
52 | 52 | // for HTTP authentication |
53 | - var $username = ''; // Username for HTTP authentication |
|
54 | - var $password = ''; // Password for HTTP authentication |
|
55 | - var $authtype = ''; // Type of HTTP authentication |
|
56 | - var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
53 | + var $username = ''; // Username for HTTP authentication |
|
54 | + var $password = ''; // Password for HTTP authentication |
|
55 | + var $authtype = ''; // Type of HTTP authentication |
|
56 | + var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * constructor |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param boolean $use_curl try to use cURL |
70 | 70 | * @access public |
71 | 71 | */ |
72 | - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
|
72 | + function wsdl($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false) { |
|
73 | 73 | parent::nusoap_base(); |
74 | 74 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
75 | 75 | $this->proxyhost = $proxyhost; |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | // Schema imports |
106 | 106 | foreach ($this->schemas as $ns => $list) { |
107 | 107 | foreach ($list as $xs) { |
108 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
108 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
109 | 109 | foreach ($xs->imports as $ns2 => $list2) { |
110 | 110 | for ($ii = 0; $ii < count($list2); $ii++) { |
111 | - if (! $list2[$ii]['loaded']) { |
|
111 | + if (!$list2[$ii]['loaded']) { |
|
112 | 112 | $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; |
113 | 113 | $url = $list2[$ii]['location']; |
114 | 114 | if ($url != '') { |
115 | 115 | $urlparts = parse_url($url); |
116 | 116 | if (!isset($urlparts['host'])) { |
117 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . |
|
118 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
117 | + $url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : ''). |
|
118 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path']; |
|
119 | 119 | } |
120 | - if (! in_array($url, $imported_urls)) { |
|
120 | + if (!in_array($url, $imported_urls)) { |
|
121 | 121 | $this->parseWSDL($url); |
122 | 122 | $imported++; |
123 | 123 | $imported_urls[] = $url; |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | } |
132 | 132 | } |
133 | 133 | // WSDL imports |
134 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
134 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
135 | 135 | foreach ($this->import as $ns => $list) { |
136 | 136 | for ($ii = 0; $ii < count($list); $ii++) { |
137 | - if (! $list[$ii]['loaded']) { |
|
137 | + if (!$list[$ii]['loaded']) { |
|
138 | 138 | $this->import[$ns][$ii]['loaded'] = true; |
139 | 139 | $url = $list[$ii]['location']; |
140 | 140 | if ($url != '') { |
141 | 141 | $urlparts = parse_url($url); |
142 | 142 | if (!isset($urlparts['host'])) { |
143 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
|
144 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
143 | + $url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : ''). |
|
144 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path']; |
|
145 | 145 | } |
146 | - if (! in_array($url, $imported_urls)) { |
|
146 | + if (!in_array($url, $imported_urls)) { |
|
147 | 147 | $this->parseWSDL($url); |
148 | 148 | $imported++; |
149 | 149 | $imported_urls[] = $url; |
@@ -156,30 +156,28 @@ discard block |
||
156 | 156 | } |
157 | 157 | } |
158 | 158 | // add new data to operation data |
159 | - foreach($this->bindings as $binding => $bindingData) { |
|
159 | + foreach ($this->bindings as $binding => $bindingData) { |
|
160 | 160 | if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
161 | - foreach($bindingData['operations'] as $operation => $data) { |
|
162 | - $this->debug('post-parse data gathering for ' . $operation); |
|
161 | + foreach ($bindingData['operations'] as $operation => $data) { |
|
162 | + $this->debug('post-parse data gathering for '.$operation); |
|
163 | 163 | $this->bindings[$binding]['operations'][$operation]['input'] = |
164 | 164 | isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
165 | - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
|
166 | - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
|
165 | + array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input']; |
|
167 | 166 | $this->bindings[$binding]['operations'][$operation]['output'] = |
168 | 167 | isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
169 | - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
|
170 | - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
|
171 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
|
172 | - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
|
168 | + array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output']; |
|
169 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) { |
|
170 | + $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']]; |
|
173 | 171 | } |
174 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
|
175 | - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
172 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) { |
|
173 | + $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']]; |
|
176 | 174 | } |
177 | 175 | // Set operation style if necessary, but do not override one already provided |
178 | 176 | if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
179 | 177 | $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
180 | 178 | } |
181 | 179 | $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
182 | - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; |
|
180 | + $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : ''; |
|
183 | 181 | $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; |
184 | 182 | } |
185 | 183 | } |
@@ -205,13 +203,13 @@ discard block |
||
205 | 203 | $wsdl_props = parse_url($wsdl); |
206 | 204 | |
207 | 205 | if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { |
208 | - $this->debug('getting WSDL http(s) URL ' . $wsdl); |
|
206 | + $this->debug('getting WSDL http(s) URL '.$wsdl); |
|
209 | 207 | // get wsdl |
210 | 208 | $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
211 | 209 | $tr->request_method = 'GET'; |
212 | 210 | $tr->useSOAPAction = false; |
213 | - if($this->proxyhost && $this->proxyport){ |
|
214 | - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
211 | + if ($this->proxyhost && $this->proxyport) { |
|
212 | + $tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword); |
|
215 | 213 | } |
216 | 214 | if ($this->authtype != '') { |
217 | 215 | $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
@@ -222,8 +220,8 @@ discard block |
||
222 | 220 | //$this->debug("WSDL response\n" . $tr->incoming_payload); |
223 | 221 | $this->appendDebug($tr->getDebug()); |
224 | 222 | // catch errors |
225 | - if($err = $tr->getError() ){ |
|
226 | - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
|
223 | + if ($err = $tr->getError()) { |
|
224 | + $errstr = 'Getting '.$wsdl.' - HTTP ERROR: '.$err; |
|
227 | 225 | $this->debug($errstr); |
228 | 226 | $this->setError($errstr); |
229 | 227 | unset($tr); |
@@ -234,11 +232,11 @@ discard block |
||
234 | 232 | } else { |
235 | 233 | // $wsdl is not http(s), so treat it as a file URL or plain file path |
236 | 234 | if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
237 | - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
235 | + $path = isset($wsdl_props['host']) ? ($wsdl_props['host'].':'.$wsdl_props['path']) : $wsdl_props['path']; |
|
238 | 236 | } else { |
239 | 237 | $path = $wsdl; |
240 | 238 | } |
241 | - $this->debug('getting WSDL file ' . $path); |
|
239 | + $this->debug('getting WSDL file '.$path); |
|
242 | 240 | if ($fp = @fopen($path, 'r')) { |
243 | 241 | $wsdl_string = ''; |
244 | 242 | while ($data = fread($fp, 32768)) { |
@@ -274,7 +272,7 @@ discard block |
||
274 | 272 | xml_error_string(xml_get_error_code($this->parser)) |
275 | 273 | ); |
276 | 274 | $this->debug($errstr); |
277 | - $this->debug("XML payload:\n" . $wsdl_string); |
|
275 | + $this->debug("XML payload:\n".$wsdl_string); |
|
278 | 276 | $this->setError($errstr); |
279 | 277 | return false; |
280 | 278 | } |
@@ -282,7 +280,7 @@ discard block |
||
282 | 280 | xml_parser_free($this->parser); |
283 | 281 | $this->debug('Parsing WSDL done'); |
284 | 282 | // catch wsdl parse errors |
285 | - if($this->getError()){ |
|
283 | + if ($this->getError()) { |
|
286 | 284 | return false; |
287 | 285 | } |
288 | 286 | return true; |
@@ -320,21 +318,21 @@ discard block |
||
320 | 318 | // process attributes |
321 | 319 | if (count($attrs) > 0) { |
322 | 320 | // register namespace declarations |
323 | - foreach($attrs as $k => $v) { |
|
324 | - if (preg_match('/^xmlns/',$k)) { |
|
321 | + foreach ($attrs as $k => $v) { |
|
322 | + if (preg_match('/^xmlns/', $k)) { |
|
325 | 323 | if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
326 | 324 | $this->namespaces[$ns_prefix] = $v; |
327 | 325 | } else { |
328 | - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; |
|
326 | + $this->namespaces['ns'.(count($this->namespaces) + 1)] = $v; |
|
329 | 327 | } |
330 | 328 | if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { |
331 | 329 | $this->XMLSchemaVersion = $v; |
332 | - $this->namespaces['xsi'] = $v . '-instance'; |
|
330 | + $this->namespaces['xsi'] = $v.'-instance'; |
|
333 | 331 | } |
334 | 332 | } |
335 | 333 | } |
336 | 334 | // expand each attribute prefix to its namespace |
337 | - foreach($attrs as $k => $v) { |
|
335 | + foreach ($attrs as $k => $v) { |
|
338 | 336 | $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
339 | 337 | if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { |
340 | 338 | $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
@@ -360,12 +358,12 @@ discard block |
||
360 | 358 | case 'message': |
361 | 359 | if ($name == 'part') { |
362 | 360 | if (isset($attrs['type'])) { |
363 | - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
361 | + $this->debug("msg ".$this->currentMessage.": found part (with type) $attrs[name]: ".implode(',', $attrs)); |
|
364 | 362 | $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
365 | 363 | } |
366 | 364 | if (isset($attrs['element'])) { |
367 | - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
368 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
365 | + $this->debug("msg ".$this->currentMessage.": found part (with element) $attrs[name]: ".implode(',', $attrs)); |
|
366 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'].'^'; |
|
369 | 367 | } |
370 | 368 | } |
371 | 369 | break; |
@@ -434,15 +432,15 @@ discard block |
||
434 | 432 | switch ($name) { |
435 | 433 | case 'port': |
436 | 434 | $this->currentPort = $attrs['name']; |
437 | - $this->debug('current port: ' . $this->currentPort); |
|
435 | + $this->debug('current port: '.$this->currentPort); |
|
438 | 436 | $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
439 | 437 | |
440 | 438 | break; |
441 | 439 | case 'address': |
442 | 440 | $this->ports[$this->currentPort]['location'] = $attrs['location']; |
443 | 441 | $this->ports[$this->currentPort]['bindingType'] = $namespace; |
444 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
445 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
442 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['bindingType'] = $namespace; |
|
443 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['endpoint'] = $attrs['location']; |
|
446 | 444 | break; |
447 | 445 | } |
448 | 446 | break; |
@@ -452,13 +450,13 @@ discard block |
||
452 | 450 | case 'import': |
453 | 451 | if (isset($attrs['location'])) { |
454 | 452 | $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
455 | - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
|
453 | + $this->debug('parsing import '.$attrs['namespace'].' - '.$attrs['location'].' ('.count($this->import[$attrs['namespace']]).')'); |
|
456 | 454 | } else { |
457 | 455 | $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
458 | - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
|
459 | - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
|
456 | + if (!$this->getPrefixFromNamespace($attrs['namespace'])) { |
|
457 | + $this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace']; |
|
460 | 458 | } |
461 | - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
|
459 | + $this->debug('parsing import '.$attrs['namespace'].' - [no location] ('.count($this->import[$attrs['namespace']]).')'); |
|
462 | 460 | } |
463 | 461 | break; |
464 | 462 | //wait for schema |
@@ -485,13 +483,13 @@ discard block |
||
485 | 483 | } |
486 | 484 | $this->status = 'binding'; |
487 | 485 | $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); |
488 | - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); |
|
486 | + $this->debug("current binding: $this->currentBinding of portType: ".$attrs['type']); |
|
489 | 487 | } |
490 | 488 | break; |
491 | 489 | case 'service': |
492 | 490 | $this->serviceName = $attrs['name']; |
493 | 491 | $this->status = 'service'; |
494 | - $this->debug('current service: ' . $this->serviceName); |
|
492 | + $this->debug('current service: '.$this->serviceName); |
|
495 | 493 | break; |
496 | 494 | case 'definitions': |
497 | 495 | foreach ($attrs as $name => $value) { |
@@ -509,7 +507,7 @@ discard block |
||
509 | 507 | * @param string $name element name |
510 | 508 | * @access private |
511 | 509 | */ |
512 | - function end_element($parser, $name){ |
|
510 | + function end_element($parser, $name) { |
|
513 | 511 | // unset schema status |
514 | 512 | if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
515 | 513 | $this->status = ""; |
@@ -594,8 +592,8 @@ discard block |
||
594 | 592 | } |
595 | 593 | $this->debug("getOperations for port '$portName' bindingType $bindingType"); |
596 | 594 | // loop thru ports |
597 | - foreach($this->ports as $port => $portData) { |
|
598 | - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); |
|
595 | + foreach ($this->ports as $port => $portData) { |
|
596 | + $this->debug("getOperations checking port $port bindingType ".$portData['bindingType']); |
|
599 | 597 | if ($portName == '' || $port == $portName) { |
600 | 598 | // binding type of port matches parameter |
601 | 599 | if ($portData['bindingType'] == $bindingType) { |
@@ -603,8 +601,8 @@ discard block |
||
603 | 601 | //$this->debug("port data: " . $this->varDump($portData)); |
604 | 602 | //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); |
605 | 603 | // merge bindings |
606 | - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { |
|
607 | - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); |
|
604 | + if (isset($this->bindings[$portData['binding']]['operations'])) { |
|
605 | + $ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']); |
|
608 | 606 | } |
609 | 607 | } |
610 | 608 | } |
@@ -631,15 +629,15 @@ discard block |
||
631 | 629 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
632 | 630 | } |
633 | 631 | // loop thru ports |
634 | - foreach($this->ports as $port => $portData) { |
|
632 | + foreach ($this->ports as $port => $portData) { |
|
635 | 633 | // binding type of port matches parameter |
636 | 634 | if ($portData['bindingType'] == $bindingType) { |
637 | 635 | // get binding |
638 | 636 | //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
639 | - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { |
|
637 | + foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) { |
|
640 | 638 | // note that we could/should also check the namespace here |
641 | 639 | if ($operation == $bOperation) { |
642 | - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
|
640 | + $opData = $this->bindings[$portData['binding']]['operations'][$operation]; |
|
643 | 641 | return $opData; |
644 | 642 | } |
645 | 643 | } |
@@ -662,11 +660,11 @@ discard block |
||
662 | 660 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
663 | 661 | } |
664 | 662 | // loop thru ports |
665 | - foreach($this->ports as $port => $portData) { |
|
663 | + foreach ($this->ports as $port => $portData) { |
|
666 | 664 | // binding type of port matches parameter |
667 | 665 | if ($portData['bindingType'] == $bindingType) { |
668 | 666 | // loop through operations for the binding |
669 | - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
667 | + foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) { |
|
670 | 668 | if ($opData['soapAction'] == $soapAction) { |
671 | 669 | return $opData; |
672 | 670 | } |
@@ -695,7 +693,7 @@ discard block |
||
695 | 693 | */ |
696 | 694 | function getTypeDef($type, $ns) { |
697 | 695 | $this->debug("in getTypeDef: type=$type, ns=$ns"); |
698 | - if ((! $ns) && isset($this->namespaces['tns'])) { |
|
696 | + if ((!$ns) && isset($this->namespaces['tns'])) { |
|
699 | 697 | $ns = $this->namespaces['tns']; |
700 | 698 | $this->debug("in getTypeDef: type namespace forced to $ns"); |
701 | 699 | } |
@@ -753,7 +751,7 @@ discard block |
||
753 | 751 | * |
754 | 752 | * @access private |
755 | 753 | */ |
756 | - function webDescription(){ |
|
754 | + function webDescription() { |
|
757 | 755 | global $HTTP_SERVER_VARS; |
758 | 756 | |
759 | 757 | if (isset($_SERVER)) { |
@@ -847,19 +845,19 @@ discard block |
||
847 | 845 | <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service. |
848 | 846 | Click on an operation name to view it's details.</p> |
849 | 847 | <ul>'; |
850 | - foreach($this->getOperations() as $op => $data){ |
|
848 | + foreach ($this->getOperations() as $op => $data) { |
|
851 | 849 | $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
852 | 850 | // create hidden div |
853 | 851 | $b .= "<div id='$op' class='hidden'> |
854 | 852 | <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>"; |
855 | - foreach($data as $donnie => $marie){ // loop through opdata |
|
856 | - if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
|
853 | + foreach ($data as $donnie => $marie) { // loop through opdata |
|
854 | + if ($donnie == 'input' || $donnie == 'output') { // show input/output data |
|
857 | 855 | $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
858 | - foreach($marie as $captain => $tenille){ // loop through data |
|
859 | - if($captain == 'parts'){ // loop thru parts |
|
856 | + foreach ($marie as $captain => $tenille) { // loop through data |
|
857 | + if ($captain == 'parts') { // loop thru parts |
|
860 | 858 | $b .= " $captain:<br>"; |
861 | 859 | //if(is_array($tenille)){ |
862 | - foreach($tenille as $joanie => $chachi){ |
|
860 | + foreach ($tenille as $joanie => $chachi) { |
|
863 | 861 | $b .= " $joanie: $chachi<br>"; |
864 | 862 | } |
865 | 863 | //} |
@@ -891,31 +889,31 @@ discard block |
||
891 | 889 | { |
892 | 890 | $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
893 | 891 | $xml .= "\n<definitions"; |
894 | - foreach($this->namespaces as $k => $v) { |
|
892 | + foreach ($this->namespaces as $k => $v) { |
|
895 | 893 | $xml .= " xmlns:$k=\"$v\""; |
896 | 894 | } |
897 | 895 | // 10.9.02 - add poulter fix for wsdl and tns declarations |
898 | 896 | if (isset($this->namespaces['wsdl'])) { |
899 | - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; |
|
897 | + $xml .= " xmlns=\"".$this->namespaces['wsdl']."\""; |
|
900 | 898 | } |
901 | 899 | if (isset($this->namespaces['tns'])) { |
902 | - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; |
|
900 | + $xml .= " targetNamespace=\"".$this->namespaces['tns']."\""; |
|
903 | 901 | } |
904 | 902 | $xml .= '>'; |
905 | 903 | // imports |
906 | 904 | if (sizeof($this->import) > 0) { |
907 | - foreach($this->import as $ns => $list) { |
|
905 | + foreach ($this->import as $ns => $list) { |
|
908 | 906 | foreach ($list as $ii) { |
909 | 907 | if ($ii['location'] != '') { |
910 | - $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />'; |
|
908 | + $xml .= '<import location="'.$ii['location'].'" namespace="'.$ns.'" />'; |
|
911 | 909 | } else { |
912 | - $xml .= '<import namespace="' . $ns . '" />'; |
|
910 | + $xml .= '<import namespace="'.$ns.'" />'; |
|
913 | 911 | } |
914 | 912 | } |
915 | 913 | } |
916 | 914 | } |
917 | 915 | // types |
918 | - if (count($this->schemas)>=1) { |
|
916 | + if (count($this->schemas) >= 1) { |
|
919 | 917 | $xml .= "\n<types>\n"; |
920 | 918 | foreach ($this->schemas as $ns => $list) { |
921 | 919 | foreach ($list as $xs) { |
@@ -926,10 +924,10 @@ discard block |
||
926 | 924 | } |
927 | 925 | // messages |
928 | 926 | if (count($this->messages) >= 1) { |
929 | - foreach($this->messages as $msgName => $msgParts) { |
|
930 | - $xml .= "\n<message name=\"" . $msgName . '">'; |
|
931 | - if(is_array($msgParts)){ |
|
932 | - foreach($msgParts as $partName => $partType) { |
|
927 | + foreach ($this->messages as $msgName => $msgParts) { |
|
928 | + $xml .= "\n<message name=\"".$msgName.'">'; |
|
929 | + if (is_array($msgParts)) { |
|
930 | + foreach ($msgParts as $partName => $partType) { |
|
933 | 931 | // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
934 | 932 | if (strpos($partType, ':')) { |
935 | 933 | $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
@@ -937,7 +935,7 @@ discard block |
||
937 | 935 | // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
938 | 936 | $typePrefix = 'xsd'; |
939 | 937 | } else { |
940 | - foreach($this->typemap as $ns => $types) { |
|
938 | + foreach ($this->typemap as $ns => $types) { |
|
941 | 939 | if (isset($types[$partType])) { |
942 | 940 | $typePrefix = $this->getPrefixFromNamespace($ns); |
943 | 941 | } |
@@ -957,7 +955,7 @@ discard block |
||
957 | 955 | } else { |
958 | 956 | $elementortype = 'type'; |
959 | 957 | } |
960 | - $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />'; |
|
958 | + $xml .= "\n".' <part name="'.$partName.'" '.$elementortype.'="'.$typePrefix.':'.$localPart.'" />'; |
|
961 | 959 | } |
962 | 960 | } |
963 | 961 | $xml .= '</message>'; |
@@ -967,54 +965,54 @@ discard block |
||
967 | 965 | if (count($this->bindings) >= 1) { |
968 | 966 | $binding_xml = ''; |
969 | 967 | $portType_xml = ''; |
970 | - foreach($this->bindings as $bindingName => $attrs) { |
|
971 | - $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">'; |
|
972 | - $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>'; |
|
973 | - $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">'; |
|
974 | - foreach($attrs['operations'] as $opName => $opParts) { |
|
975 | - $binding_xml .= "\n" . ' <operation name="' . $opName . '">'; |
|
976 | - $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>'; |
|
968 | + foreach ($this->bindings as $bindingName => $attrs) { |
|
969 | + $binding_xml .= "\n<binding name=\"".$bindingName.'" type="tns:'.$attrs['portType'].'">'; |
|
970 | + $binding_xml .= "\n".' <soap:binding style="'.$attrs['style'].'" transport="'.$attrs['transport'].'"/>'; |
|
971 | + $portType_xml .= "\n<portType name=\"".$attrs['portType'].'">'; |
|
972 | + foreach ($attrs['operations'] as $opName => $opParts) { |
|
973 | + $binding_xml .= "\n".' <operation name="'.$opName.'">'; |
|
974 | + $binding_xml .= "\n".' <soap:operation soapAction="'.$opParts['soapAction'].'" style="'.$opParts['style'].'"/>'; |
|
977 | 975 | if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { |
978 | - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; |
|
976 | + $enc_style = ' encodingStyle="'.$opParts['input']['encodingStyle'].'"'; |
|
979 | 977 | } else { |
980 | 978 | $enc_style = ''; |
981 | 979 | } |
982 | - $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>'; |
|
980 | + $binding_xml .= "\n".' <input><soap:body use="'.$opParts['input']['use'].'" namespace="'.$opParts['input']['namespace'].'"'.$enc_style.'/></input>'; |
|
983 | 981 | if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { |
984 | - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; |
|
982 | + $enc_style = ' encodingStyle="'.$opParts['output']['encodingStyle'].'"'; |
|
985 | 983 | } else { |
986 | 984 | $enc_style = ''; |
987 | 985 | } |
988 | - $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>'; |
|
989 | - $binding_xml .= "\n" . ' </operation>'; |
|
990 | - $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"'; |
|
986 | + $binding_xml .= "\n".' <output><soap:body use="'.$opParts['output']['use'].'" namespace="'.$opParts['output']['namespace'].'"'.$enc_style.'/></output>'; |
|
987 | + $binding_xml .= "\n".' </operation>'; |
|
988 | + $portType_xml .= "\n".' <operation name="'.$opParts['name'].'"'; |
|
991 | 989 | if (isset($opParts['parameterOrder'])) { |
992 | - $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
990 | + $portType_xml .= ' parameterOrder="'.$opParts['parameterOrder'].'"'; |
|
993 | 991 | } |
994 | 992 | $portType_xml .= '>'; |
995 | - if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
996 | - $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>'; |
|
993 | + if (isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
994 | + $portType_xml .= "\n".' <documentation>'.htmlspecialchars($opParts['documentation']).'</documentation>'; |
|
997 | 995 | } |
998 | - $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>'; |
|
999 | - $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>'; |
|
1000 | - $portType_xml .= "\n" . ' </operation>'; |
|
996 | + $portType_xml .= "\n".' <input message="tns:'.$opParts['input']['message'].'"/>'; |
|
997 | + $portType_xml .= "\n".' <output message="tns:'.$opParts['output']['message'].'"/>'; |
|
998 | + $portType_xml .= "\n".' </operation>'; |
|
1001 | 999 | } |
1002 | - $portType_xml .= "\n" . '</portType>'; |
|
1003 | - $binding_xml .= "\n" . '</binding>'; |
|
1000 | + $portType_xml .= "\n".'</portType>'; |
|
1001 | + $binding_xml .= "\n".'</binding>'; |
|
1004 | 1002 | } |
1005 | - $xml .= $portType_xml . $binding_xml; |
|
1003 | + $xml .= $portType_xml.$binding_xml; |
|
1006 | 1004 | } |
1007 | 1005 | // services |
1008 | - $xml .= "\n<service name=\"" . $this->serviceName . '">'; |
|
1006 | + $xml .= "\n<service name=\"".$this->serviceName.'">'; |
|
1009 | 1007 | if (count($this->ports) >= 1) { |
1010 | - foreach($this->ports as $pName => $attrs) { |
|
1011 | - $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">'; |
|
1012 | - $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>'; |
|
1013 | - $xml .= "\n" . ' </port>'; |
|
1008 | + foreach ($this->ports as $pName => $attrs) { |
|
1009 | + $xml .= "\n".' <port name="'.$pName.'" binding="tns:'.$attrs['binding'].'">'; |
|
1010 | + $xml .= "\n".' <soap:address location="'.$attrs['location'].($debug ? '?debug=1' : '').'"/>'; |
|
1011 | + $xml .= "\n".' </port>'; |
|
1014 | 1012 | } |
1015 | 1013 | } |
1016 | - $xml .= "\n" . '</service>'; |
|
1017 | - return $xml . "\n</definitions>"; |
|
1014 | + $xml .= "\n".'</service>'; |
|
1015 | + return $xml."\n</definitions>"; |
|
1018 | 1016 | } |
1019 | 1017 | |
1020 | 1018 | /** |
@@ -1111,7 +1109,7 @@ discard block |
||
1111 | 1109 | */ |
1112 | 1110 | function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { |
1113 | 1111 | $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); |
1114 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1112 | + $this->appendDebug('parameters='.$this->varDump($parameters)); |
|
1115 | 1113 | |
1116 | 1114 | if ($direction != 'input' && $direction != 'output') { |
1117 | 1115 | $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
@@ -1119,8 +1117,8 @@ discard block |
||
1119 | 1117 | return false; |
1120 | 1118 | } |
1121 | 1119 | if (!$opData = $this->getOperationData($operation, $bindingType)) { |
1122 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1123 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1120 | + $this->debug('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType); |
|
1121 | + $this->setError('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType); |
|
1124 | 1122 | return false; |
1125 | 1123 | } |
1126 | 1124 | $this->debug('in serializeRPCParameters: opData:'); |
@@ -1128,7 +1126,7 @@ discard block |
||
1128 | 1126 | |
1129 | 1127 | // Get encoding style for output and set to current |
1130 | 1128 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1131 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1129 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1132 | 1130 | $encodingStyle = $opData['output']['encodingStyle']; |
1133 | 1131 | $enc_style = $encodingStyle; |
1134 | 1132 | } |
@@ -1213,7 +1211,7 @@ discard block |
||
1213 | 1211 | function serializeParameters($operation, $direction, $parameters) |
1214 | 1212 | { |
1215 | 1213 | $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); |
1216 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1214 | + $this->appendDebug('parameters='.$this->varDump($parameters)); |
|
1217 | 1215 | |
1218 | 1216 | if ($direction != 'input' && $direction != 'output') { |
1219 | 1217 | $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
@@ -1221,8 +1219,8 @@ discard block |
||
1221 | 1219 | return false; |
1222 | 1220 | } |
1223 | 1221 | if (!$opData = $this->getOperationData($operation)) { |
1224 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1225 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1222 | + $this->debug('Unable to retrieve WSDL data for operation: '.$operation); |
|
1223 | + $this->setError('Unable to retrieve WSDL data for operation: '.$operation); |
|
1226 | 1224 | return false; |
1227 | 1225 | } |
1228 | 1226 | $this->debug('opData:'); |
@@ -1230,7 +1228,7 @@ discard block |
||
1230 | 1228 | |
1231 | 1229 | // Get encoding style for output and set to current |
1232 | 1230 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1233 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1231 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1234 | 1232 | $encodingStyle = $opData['output']['encodingStyle']; |
1235 | 1233 | $enc_style = $encodingStyle; |
1236 | 1234 | } |
@@ -1241,14 +1239,14 @@ discard block |
||
1241 | 1239 | |
1242 | 1240 | $use = $opData[$direction]['use']; |
1243 | 1241 | $this->debug("use=$use"); |
1244 | - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); |
|
1242 | + $this->debug('got '.count($opData[$direction]['parts']).' part(s)'); |
|
1245 | 1243 | if (is_array($parameters)) { |
1246 | 1244 | $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
1247 | - $this->debug('have ' . $parametersArrayType . ' parameters'); |
|
1248 | - foreach($opData[$direction]['parts'] as $name => $type) { |
|
1245 | + $this->debug('have '.$parametersArrayType.' parameters'); |
|
1246 | + foreach ($opData[$direction]['parts'] as $name => $type) { |
|
1249 | 1247 | $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); |
1250 | 1248 | // Track encoding style |
1251 | - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1249 | + if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1252 | 1250 | $encodingStyle = $opData[$direction]['encodingStyle']; |
1253 | 1251 | $enc_style = $encodingStyle; |
1254 | 1252 | } else { |
@@ -1289,18 +1287,18 @@ discard block |
||
1289 | 1287 | * @return string value serialized as an XML string |
1290 | 1288 | * @access private |
1291 | 1289 | */ |
1292 | - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) |
|
1290 | + function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false) |
|
1293 | 1291 | { |
1294 | - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); |
|
1295 | - $this->appendDebug("value=" . $this->varDump($value)); |
|
1296 | - if($use == 'encoded' && $encodingStyle) { |
|
1297 | - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; |
|
1292 | + $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=".($unqualified ? "unqualified" : "qualified")); |
|
1293 | + $this->appendDebug("value=".$this->varDump($value)); |
|
1294 | + if ($use == 'encoded' && $encodingStyle) { |
|
1295 | + $encodingStyle = ' SOAP-ENV:encodingStyle="'.$encodingStyle.'"'; |
|
1298 | 1296 | } |
1299 | 1297 | |
1300 | 1298 | // if a soapval has been supplied, let its type override the WSDL |
1301 | 1299 | if (is_object($value) && get_class($value) == 'soapval') { |
1302 | 1300 | if ($value->type_ns) { |
1303 | - $type = $value->type_ns . ':' . $value->type; |
|
1301 | + $type = $value->type_ns.':'.$value->type; |
|
1304 | 1302 | $forceType = true; |
1305 | 1303 | $this->debug("in serializeType: soapval overrides type to $type"); |
1306 | 1304 | } elseif ($value->type) { |
@@ -1319,7 +1317,7 @@ discard block |
||
1319 | 1317 | $value['!'] = $value; |
1320 | 1318 | } |
1321 | 1319 | foreach ($attrs as $n => $v) { |
1322 | - $value['!' . $n] = $v; |
|
1320 | + $value['!'.$n] = $v; |
|
1323 | 1321 | } |
1324 | 1322 | $this->debug("in serializeType: soapval provides attributes"); |
1325 | 1323 | } |
@@ -1337,7 +1335,7 @@ discard block |
||
1337 | 1335 | $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); |
1338 | 1336 | } |
1339 | 1337 | |
1340 | - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ |
|
1338 | + if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') { |
|
1341 | 1339 | $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); |
1342 | 1340 | if ($unqualified && $use == 'literal') { |
1343 | 1341 | $elementNS = " xmlns=\"\""; |
@@ -1350,7 +1348,7 @@ discard block |
||
1350 | 1348 | $xml = "<$name$elementNS/>"; |
1351 | 1349 | } else { |
1352 | 1350 | // TODO: depends on nillable, which should be checked before calling this method |
1353 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1351 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>"; |
|
1354 | 1352 | } |
1355 | 1353 | $this->debug("in serializeType: returning: $xml"); |
1356 | 1354 | return $xml; |
@@ -1360,7 +1358,7 @@ discard block |
||
1360 | 1358 | return $this->serialize_val($value, $name, false, false, false, false, $use); |
1361 | 1359 | } |
1362 | 1360 | if ($uqType == 'boolean') { |
1363 | - if ((is_string($value) && $value == 'false') || (! $value)) { |
|
1361 | + if ((is_string($value) && $value == 'false') || (!$value)) { |
|
1364 | 1362 | $value = 'false'; |
1365 | 1363 | } else { |
1366 | 1364 | $value = 'true'; |
@@ -1378,12 +1376,12 @@ discard block |
||
1378 | 1376 | if (!$this->getTypeDef($uqType, $ns)) { |
1379 | 1377 | if ($use == 'literal') { |
1380 | 1378 | if ($forceType) { |
1381 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1379 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>"; |
|
1382 | 1380 | } else { |
1383 | 1381 | $xml = "<$name$elementNS>$value</$name>"; |
1384 | 1382 | } |
1385 | 1383 | } else { |
1386 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1384 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>"; |
|
1387 | 1385 | } |
1388 | 1386 | $this->debug("in serializeType: returning: $xml"); |
1389 | 1387 | return $xml; |
@@ -1393,29 +1391,29 @@ discard block |
||
1393 | 1391 | $this->debug('in serializeType: appears to be Apache SOAP type'); |
1394 | 1392 | if ($uqType == 'Map') { |
1395 | 1393 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
1396 | - if (! $tt_prefix) { |
|
1394 | + if (!$tt_prefix) { |
|
1397 | 1395 | $this->debug('in serializeType: Add namespace for Apache SOAP type'); |
1398 | - $tt_prefix = 'ns' . rand(1000, 9999); |
|
1396 | + $tt_prefix = 'ns'.rand(1000, 9999); |
|
1399 | 1397 | $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; |
1400 | 1398 | // force this to be added to usedNamespaces |
1401 | 1399 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
1402 | 1400 | } |
1403 | 1401 | $contents = ''; |
1404 | - foreach($value as $k => $v) { |
|
1402 | + foreach ($value as $k => $v) { |
|
1405 | 1403 | $this->debug("serializing map element: key $k, value $v"); |
1406 | 1404 | $contents .= '<item>'; |
1407 | - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); |
|
1408 | - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); |
|
1405 | + $contents .= $this->serialize_val($k, 'key', false, false, false, false, $use); |
|
1406 | + $contents .= $this->serialize_val($v, 'value', false, false, false, false, $use); |
|
1409 | 1407 | $contents .= '</item>'; |
1410 | 1408 | } |
1411 | 1409 | if ($use == 'literal') { |
1412 | 1410 | if ($forceType) { |
1413 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>"; |
|
1411 | + $xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\">$contents</$name>"; |
|
1414 | 1412 | } else { |
1415 | 1413 | $xml = "<$name>$contents</$name>"; |
1416 | 1414 | } |
1417 | 1415 | } else { |
1418 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>"; |
|
1416 | + $xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\"$encodingStyle>$contents</$name>"; |
|
1419 | 1417 | } |
1420 | 1418 | $this->debug("in serializeType: returning: $xml"); |
1421 | 1419 | return $xml; |
@@ -1429,13 +1427,13 @@ discard block |
||
1429 | 1427 | $ns = ''; |
1430 | 1428 | $uqType = $type; |
1431 | 1429 | } |
1432 | - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ |
|
1430 | + if (!$typeDef = $this->getTypeDef($uqType, $ns)) { |
|
1433 | 1431 | $this->setError("$type ($uqType) is not a supported type."); |
1434 | 1432 | $this->debug("in serializeType: $type ($uqType) is not a supported type."); |
1435 | 1433 | return false; |
1436 | 1434 | } else { |
1437 | 1435 | $this->debug("in serializeType: found typeDef"); |
1438 | - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); |
|
1436 | + $this->appendDebug('typeDef='.$this->varDump($typeDef)); |
|
1439 | 1437 | if (substr($uqType, -1) == '^') { |
1440 | 1438 | $uqType = substr($uqType, 0, -1); |
1441 | 1439 | } |
@@ -1446,7 +1444,7 @@ discard block |
||
1446 | 1444 | return false; |
1447 | 1445 | } |
1448 | 1446 | $phpType = $typeDef['phpType']; |
1449 | - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); |
|
1447 | + $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: ".(isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '')); |
|
1450 | 1448 | // if php type == struct, map value to the <all> element names |
1451 | 1449 | if ($phpType == 'struct') { |
1452 | 1450 | if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { |
@@ -1469,7 +1467,7 @@ discard block |
||
1469 | 1467 | // TODO: depends on minOccurs and nillable |
1470 | 1468 | $xml = "<$elementName$elementNS/>"; |
1471 | 1469 | } else { |
1472 | - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1470 | + $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>"; |
|
1473 | 1471 | } |
1474 | 1472 | $this->debug("in serializeType: returning: $xml"); |
1475 | 1473 | return $xml; |
@@ -1481,12 +1479,12 @@ discard block |
||
1481 | 1479 | $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); |
1482 | 1480 | if ($use == 'literal') { |
1483 | 1481 | if ($forceType) { |
1484 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; |
|
1482 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">"; |
|
1485 | 1483 | } else { |
1486 | 1484 | $xml = "<$elementName$elementNS$elementAttrs>"; |
1487 | 1485 | } |
1488 | 1486 | } else { |
1489 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; |
|
1487 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>"; |
|
1490 | 1488 | } |
1491 | 1489 | |
1492 | 1490 | if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { |
@@ -1521,13 +1519,13 @@ discard block |
||
1521 | 1519 | // TODO: depends on minOccurs |
1522 | 1520 | $xml = "<$name$elementNS/>"; |
1523 | 1521 | } else { |
1524 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . |
|
1525 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1526 | - ":Array\" " . |
|
1527 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1528 | - ':arrayType="' . |
|
1529 | - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . |
|
1530 | - ':' . |
|
1522 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"". |
|
1523 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/'). |
|
1524 | + ":Array\" ". |
|
1525 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/'). |
|
1526 | + ':arrayType="'. |
|
1527 | + $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])). |
|
1528 | + ':'. |
|
1531 | 1529 | $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; |
1532 | 1530 | } |
1533 | 1531 | $this->debug("in serializeType: returning: $xml"); |
@@ -1535,8 +1533,8 @@ discard block |
||
1535 | 1533 | } |
1536 | 1534 | if (isset($typeDef['multidimensional'])) { |
1537 | 1535 | $nv = array(); |
1538 | - foreach($value as $v) { |
|
1539 | - $cols = ',' . sizeof($v); |
|
1536 | + foreach ($value as $v) { |
|
1537 | + $cols = ','.sizeof($v); |
|
1540 | 1538 | $nv = array_merge($nv, $v); |
1541 | 1539 | } |
1542 | 1540 | $value = $nv; |
@@ -1546,10 +1544,10 @@ discard block |
||
1546 | 1544 | if (is_array($value) && sizeof($value) >= 1) { |
1547 | 1545 | $rows = sizeof($value); |
1548 | 1546 | $contents = ''; |
1549 | - foreach($value as $k => $v) { |
|
1547 | + foreach ($value as $k => $v) { |
|
1550 | 1548 | //$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
1551 | 1549 | //if (strpos($typeDef['arrayType'], ':') ) { |
1552 | - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1550 | + if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1553 | 1551 | $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
1554 | 1552 | } else { |
1555 | 1553 | $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
@@ -1586,12 +1584,12 @@ discard block |
||
1586 | 1584 | } |
1587 | 1585 | if ($use == 'literal') { |
1588 | 1586 | if ($forceType) { |
1589 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1587 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>"; |
|
1590 | 1588 | } else { |
1591 | 1589 | $xml = "<$name$elementNS>$value</$name>"; |
1592 | 1590 | } |
1593 | 1591 | } else { |
1594 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1592 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>"; |
|
1595 | 1593 | } |
1596 | 1594 | } |
1597 | 1595 | $this->debug("in serializeType: returning: $xml"); |
@@ -1635,22 +1633,22 @@ discard block |
||
1635 | 1633 | $xvalue = array(); |
1636 | 1634 | } |
1637 | 1635 | foreach ($typeDef['attrs'] as $aName => $attrs) { |
1638 | - if (isset($xvalue['!' . $aName])) { |
|
1639 | - $xname = '!' . $aName; |
|
1636 | + if (isset($xvalue['!'.$aName])) { |
|
1637 | + $xname = '!'.$aName; |
|
1640 | 1638 | $this->debug("value provided for attribute $aName with key $xname"); |
1641 | 1639 | } elseif (isset($xvalue[$aName])) { |
1642 | 1640 | $xname = $aName; |
1643 | 1641 | $this->debug("value provided for attribute $aName with key $xname"); |
1644 | 1642 | } elseif (isset($attrs['default'])) { |
1645 | - $xname = '!' . $aName; |
|
1643 | + $xname = '!'.$aName; |
|
1646 | 1644 | $xvalue[$xname] = $attrs['default']; |
1647 | - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); |
|
1645 | + $this->debug('use default value of '.$xvalue[$aName].' for attribute '.$aName); |
|
1648 | 1646 | } else { |
1649 | 1647 | $xname = ''; |
1650 | 1648 | $this->debug("no value provided for attribute $aName"); |
1651 | 1649 | } |
1652 | 1650 | if ($xname) { |
1653 | - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
1651 | + $xml .= " $aName=\"".$this->expandEntities($xvalue[$xname])."\""; |
|
1654 | 1652 | } |
1655 | 1653 | } |
1656 | 1654 | } else { |
@@ -1671,7 +1669,7 @@ discard block |
||
1671 | 1669 | * @return string value serialized as an XML string |
1672 | 1670 | * @access private |
1673 | 1671 | */ |
1674 | - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { |
|
1672 | + function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) { |
|
1675 | 1673 | $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); |
1676 | 1674 | $xml = ''; |
1677 | 1675 | if (isset($typeDef['extensionBase'])) { |
@@ -1698,23 +1696,23 @@ discard block |
||
1698 | 1696 | $xvalue = array(); |
1699 | 1697 | } |
1700 | 1698 | // toggle whether all elements are present - ideally should validate against schema |
1701 | - if (count($typeDef['elements']) != count($xvalue)){ |
|
1699 | + if (count($typeDef['elements']) != count($xvalue)) { |
|
1702 | 1700 | $optionals = true; |
1703 | 1701 | } |
1704 | 1702 | foreach ($typeDef['elements'] as $eName => $attrs) { |
1705 | 1703 | if (!isset($xvalue[$eName])) { |
1706 | 1704 | if (isset($attrs['default'])) { |
1707 | 1705 | $xvalue[$eName] = $attrs['default']; |
1708 | - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); |
|
1706 | + $this->debug('use default value of '.$xvalue[$eName].' for element '.$eName); |
|
1709 | 1707 | } |
1710 | 1708 | } |
1711 | 1709 | // if user took advantage of a minOccurs=0, then only serialize named parameters |
1712 | 1710 | if (isset($optionals) |
1713 | 1711 | && (!isset($xvalue[$eName])) |
1714 | - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1715 | - ){ |
|
1712 | + && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1713 | + ) { |
|
1716 | 1714 | if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
1717 | - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); |
|
1715 | + $this->debug("apparent error: no value provided for element $eName with minOccurs=".$attrs['minOccurs']); |
|
1718 | 1716 | } |
1719 | 1717 | // do nothing |
1720 | 1718 | $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); |
@@ -1779,15 +1777,15 @@ discard block |
||
1779 | 1777 | * @see nusoap_xmlschema |
1780 | 1778 | * @access public |
1781 | 1779 | */ |
1782 | - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
|
1780 | + function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') { |
|
1783 | 1781 | if (count($elements) > 0) { |
1784 | 1782 | $eElements = array(); |
1785 | - foreach($elements as $n => $e){ |
|
1783 | + foreach ($elements as $n => $e) { |
|
1786 | 1784 | // expand each element |
1787 | 1785 | $ee = array(); |
1788 | 1786 | foreach ($e as $k => $v) { |
1789 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1790 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1787 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
1788 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
1791 | 1789 | $ee[$k] = $v; |
1792 | 1790 | } |
1793 | 1791 | $eElements[$n] = $ee; |
@@ -1796,11 +1794,11 @@ discard block |
||
1796 | 1794 | } |
1797 | 1795 | |
1798 | 1796 | if (count($attrs) > 0) { |
1799 | - foreach($attrs as $n => $a){ |
|
1797 | + foreach ($attrs as $n => $a) { |
|
1800 | 1798 | // expand each attribute |
1801 | 1799 | foreach ($a as $k => $v) { |
1802 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1803 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1800 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
1801 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
1804 | 1802 | $aa[$k] = $v; |
1805 | 1803 | } |
1806 | 1804 | $eAttrs[$n] = $aa; |
@@ -1808,11 +1806,11 @@ discard block |
||
1808 | 1806 | $attrs = $eAttrs; |
1809 | 1807 | } |
1810 | 1808 | |
1811 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1812 | - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; |
|
1809 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1810 | + $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType; |
|
1813 | 1811 | |
1814 | 1812 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
1815 | - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); |
|
1813 | + $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType); |
|
1816 | 1814 | } |
1817 | 1815 | |
1818 | 1816 | /** |
@@ -1826,8 +1824,8 @@ discard block |
||
1826 | 1824 | * @see nusoap_xmlschema |
1827 | 1825 | * @access public |
1828 | 1826 | */ |
1829 | - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
|
1830 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1827 | + function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) { |
|
1828 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1831 | 1829 | |
1832 | 1830 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
1833 | 1831 | $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); |
@@ -1859,7 +1857,7 @@ discard block |
||
1859 | 1857 | * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
1860 | 1858 | * @access public |
1861 | 1859 | */ |
1862 | - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
|
1860 | + function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') { |
|
1863 | 1861 | if ($use == 'encoded' && $encodingStyle == '') { |
1864 | 1862 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1865 | 1863 | } |
@@ -1869,24 +1867,24 @@ discard block |
||
1869 | 1867 | foreach ($in as $n => $t) { |
1870 | 1868 | $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
1871 | 1869 | } |
1872 | - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1873 | - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); |
|
1874 | - $in = array('parameters' => 'tns:' . $name . '^'); |
|
1870 | + $this->addComplexType($name.'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1871 | + $this->addElement(array('name' => $name, 'type' => $name.'RequestType')); |
|
1872 | + $in = array('parameters' => 'tns:'.$name.'^'); |
|
1875 | 1873 | |
1876 | 1874 | $elements = array(); |
1877 | 1875 | foreach ($out as $n => $t) { |
1878 | 1876 | $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
1879 | 1877 | } |
1880 | - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1881 | - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); |
|
1882 | - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); |
|
1878 | + $this->addComplexType($name.'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1879 | + $this->addElement(array('name' => $name.'Response', 'type' => $name.'ResponseType', 'form' => 'qualified')); |
|
1880 | + $out = array('parameters' => 'tns:'.$name.'Response'.'^'); |
|
1883 | 1881 | } |
1884 | 1882 | |
1885 | 1883 | // get binding |
1886 | - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = |
|
1884 | + $this->bindings[$this->serviceName.'Binding']['operations'][$name] = |
|
1887 | 1885 | array( |
1888 | 1886 | 'name' => $name, |
1889 | - 'binding' => $this->serviceName . 'Binding', |
|
1887 | + 'binding' => $this->serviceName.'Binding', |
|
1890 | 1888 | 'endpoint' => $this->endpoint, |
1891 | 1889 | 'soapAction' => $soapaction, |
1892 | 1890 | 'style' => $style, |
@@ -1894,42 +1892,42 @@ discard block |
||
1894 | 1892 | 'use' => $use, |
1895 | 1893 | 'namespace' => $namespace, |
1896 | 1894 | 'encodingStyle' => $encodingStyle, |
1897 | - 'message' => $name . 'Request', |
|
1895 | + 'message' => $name.'Request', |
|
1898 | 1896 | 'parts' => $in), |
1899 | 1897 | 'output' => array( |
1900 | 1898 | 'use' => $use, |
1901 | 1899 | 'namespace' => $namespace, |
1902 | 1900 | 'encodingStyle' => $encodingStyle, |
1903 | - 'message' => $name . 'Response', |
|
1901 | + 'message' => $name.'Response', |
|
1904 | 1902 | 'parts' => $out), |
1905 | 1903 | 'namespace' => $namespace, |
1906 | 1904 | 'transport' => 'http://schemas.xmlsoap.org/soap/http', |
1907 | 1905 | 'documentation' => $documentation); |
1908 | 1906 | // add portTypes |
1909 | 1907 | // add messages |
1910 | - if($in) |
|
1908 | + if ($in) |
|
1911 | 1909 | { |
1912 | - foreach($in as $pName => $pType) |
|
1910 | + foreach ($in as $pName => $pType) |
|
1913 | 1911 | { |
1914 | - if(strpos($pType,':')) { |
|
1912 | + if (strpos($pType, ':')) { |
|
1915 | 1913 | $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
1916 | 1914 | } |
1917 | 1915 | $this->messages[$name.'Request'][$pName] = $pType; |
1918 | 1916 | } |
1919 | 1917 | } else { |
1920 | - $this->messages[$name.'Request']= '0'; |
|
1918 | + $this->messages[$name.'Request'] = '0'; |
|
1921 | 1919 | } |
1922 | - if($out) |
|
1920 | + if ($out) |
|
1923 | 1921 | { |
1924 | - foreach($out as $pName => $pType) |
|
1922 | + foreach ($out as $pName => $pType) |
|
1925 | 1923 | { |
1926 | - if(strpos($pType,':')) { |
|
1924 | + if (strpos($pType, ':')) { |
|
1927 | 1925 | $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
1928 | 1926 | } |
1929 | 1927 | $this->messages[$name.'Response'][$pName] = $pType; |
1930 | 1928 | } |
1931 | 1929 | } else { |
1932 | - $this->messages[$name.'Response']= '0'; |
|
1930 | + $this->messages[$name.'Response'] = '0'; |
|
1933 | 1931 | } |
1934 | 1932 | return true; |
1935 | 1933 | } |