I am using below code in M1 to establish the connection using SOAP:-
<?php
class Company_Module_Helper_Webservice extends Company_Module_Helper_Basehelper
{
private function Connect()
{
$WebserviceUrl = Mage::helper('module/systemvalues')->getSysValue('web_service_url');
return new SoapClient($WebserviceUrl, array('cache_wsdl' => WSDL_CACHE_NONE));
}
}
Now I want to establish SOAP connection in M2:-
<?php
namespace Company\Module\Helper;
class Webservice extends \Company\Module\Helper\Basehelper
{
/**
* @var \Company\Module\Helper\Systemvalues
*/
protected $moduleSystemvaluesHelper;
public function __construct(
\Company\Module\Helper\Systemvalues $moduleSystemvaluesHelper
) {
$this->moduleSystemvaluesHelper = $moduleSystemvaluesHelper;
}
public function Connect()
{
$WebserviceUrl = $this->moduleSystemvaluesHelper->getSysValue('web_service_url');
$logger = \Magento\Framework\App\ObjectManager::getInstance()->get('\Psr\Log\LoggerInterface');
$logger->debug($WebserviceUrl);
/** below line work in M1, now I want write code for M2 to estibalsed the soap connection for my module */
return new SoapClient($WebserviceUrl, array('cache_wsdl' => WSDL_CACHE_NONE));
}
}
Any help would be much appreciated.