PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / Mbe / MbeSoapClient.php

MbeSoapClient.php in MBE eShip trunk, at lib/Mbe/MbeSoapClient.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class MbeSoapClient extends SoapClient {
4
5 public $isOnlinembe = false;
6 private $helper;
7
8 public function __construct( $wsdl, array $options = null, $username = null, $password = null, $wsdlcache = true)
9 {
10 $this->helper = new Mbe_Shipping_Helper_Data();
11 if ($this->helper->isOnlineMBE()) {
12 $options['cache_wsdl'] = WSDL_CACHE_NONE;
13 parent::__construct( $wsdl, $options );
14 }
15 else
16 {
17 $opts = array(
18 'ssl' => array(
19 'verify_peer' => false,
20 'verify_peer_name' => false,
21 'allow_self_signed' => true
22 ),
23 'http' => array(
24 'protocol_version' => 1.0
25 )
26 );
27 $context = stream_context_create($opts);
28
29 $soapClientOptions = array(
30 'trace' => 1,
31 'stream_context' => $context,
32 'login' => $username,
33 'password' => $password,
34 'location' => preg_replace('/(\/e-link\.wsdl)$/i', '', $wsdl),
35 // Removed as requested in the "Performance optimization through smart caching" document, so cache is always used
36 // 'cache_wsdl' => $wsdlcache?WSDL_CACHE_MEMORY: WSDL_CACHE_NONE,
37 );
38
39 parent::__construct( $wsdl, $soapClientOptions );
40 }
41 }
42 #[\ReturnTypeWillChange]
43 public function __soapCall($function_name, $arguments, $options = null, $input_headers = null, &$output_headers = null) {
44 if (!$this->helper->isOnlineMBE()) {
45 $arguments[0]->RequestContainer->Credentials->Username = '';
46 $arguments[0]->RequestContainer->Credentials->Passphrase = '';
47 }
48 return parent::__soapCall( $function_name, $arguments, $options, $input_headers, $output_headers );
49 }
50
51
52 }