0
Good afternoon, I did a php upgrade on my server and one of my scripts stopped working. Error shown is this:
thrown in /home/brewhead/public_html/catalog/model/shipping/jadlog5.php on line 65
[07-Dec-2016 21:13:08 America/Sao_Paulo] PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://jadlog.com.br/JadlogEdiWs/services/ValorFreteBean?wsdl' : failed to load external entity "http://jadlog.com.br/JadlogEdiWs/services/ValorFreteBean?wsdl"
in /home/brewhead/public_html/catalog/model/shipping/jadlog5.php on line 65
[07-Dec-2016 21:13:08 America/Sao_Paulo] PHP Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://jadlog.com.br/JadlogEdiWs/services/ValorFreteBean?wsdl' : failed to load external entity "http://jadlog.com.br/JadlogEdiWs/services/ValorFreteBean?wsdl"
in /home/brewhead/public_html/catalog/model/shipping/jadlog5.php:65
Stack trace:
#0 /home/brewhead/public_html/catalog/model/shipping/jadlog5.php(65): SoapClient->SoapClient('http://jadlog.c...')
#1 /home/brewhead/public_html/catalog/controller/checkout/shipping.php(143): ModelShippingJadlog5->getQuote(Array)
#2 [internal function]: ControllerCheckoutShipping->quote(Array)
#3 /home/brewhead/public_html/system/modification/system/engine/action.php(65): call_user_func(Array, Array)
#4 /home/brewhead/public_html/system/engine/front.php(34): Action->execute(Object(Registry))
#5 /home/brewhead/public_html/system/engine/front.php(29): Front->execute(Object(Action))
#6 /home/brewhead/public_html/index.php(265): Front->dispatch(Object(Action), Object(Action))
#7 {main}
thrown in /home/brewhead/public_html/catalog/model/shipping/jadlog5.php on line 65
I tried to change the script several times but could not solve the problem.
follows my script making the Soap request:
$cost = 0;
//dados do carrinho e calcula as medidas
$pais = $address['iso_code_2'];
$tiposFrete = array('Expresso'=>0,'Package'=>3,'Rodoviario'=>4,'Economico'=>5,'DOC'=>6,'Corporate'=>7,'.COM'=>9,'Cargo'=>12);
$soapClient = new SoapClient("http://jadlog.com.br/JadlogEdiWs/services/ValorFreteBean?wsdl");
foreach($tiposFrete AS $k=>$v){
$tipos = $this->config->get('jadlog5_tipos');
if((!empty($tipos) && in_array($v,$tipos))){
$peso_cubado = $this->pesoCubado($v);
$fator_cubagem = $this->vCubagem[$v];
if($fator_cubagem=='6000'){
$prazo = $this->config->get('jadlog5_prazoa');
}else{
$prazo = $this->config->get('jadlog5_prazo');
}
//regra do maior peso
$weight = number_format($this->cart->getWeight()/1000, 2, '.', '');
//echo $peso_cubado." | ".$weight;
if($weight>$peso_cubado){
$peso_cubado=$weight;
}
//if($weight>$peso_cubado){
//$peso_cubado = $weight/1000;
//}
//print("$peso_cubado | $weight");
$default = array('cep_origem' => preg_replace('/\D/', '', $this->config->get('jadlog5_cep')),
'cep_destino' => preg_replace('/\D/', '', $address['postcode']),
'peso' => number_format($peso_cubado, 2, ',', ''),
'valor' => number_format($this->cart->getSubTotal(), 2, ',', ''),
'modalidade' => $v,
'cnpj' => trim($this->config->get('jadlog5_user')),
'password' => trim($this->config->get('jadlog5_senha')),
'seguro' => 'S',
'coleta' => number_format($this->config->get('jadlog5_coleta'), 2, ',', ''),
'acobrar' => ($this->config->get('jadlog5_frete')==0?'N':'S'),
'entrega' => ($this->config->get('jadlog5_entrega')==0?'D':'R'));
$consulta['vModalidade'] = $default['modalidade'];
$consulta['Password'] = $default['password'];
$consulta['vSeguro'] = $default['seguro'];
$consulta['vVlDec'] = $default['valor'];
$consulta['vVlColeta'] = $default['coleta'];
$consulta['vCepOrig'] = $default['cep_origem'];
$consulta['vCepDest'] = $default['cep_destino'];
$consulta['vPeso'] = $default['peso'];
$consulta['vFrap'] = $default['acobrar'];
$consulta['vEntrega'] = $default['entrega'];
$consulta['vCnpj'] = $default['cnpj'];
//echo "<pre>";
//print_r($consulta);
//echo "</pre>";
try {
$info = $soapClient->__call("valorar", array($consulta));
$calculo = json_decode(json_encode(@simplexml_load_string($info->valorarReturn)),true);
if(isset($calculo['Jadlog_Valor_Frete']['Retorno'])){
if($calculo['Jadlog_Valor_Frete']['Retorno']<=0){
$this->log->write("Erro jadlog ".$k.": " . $calculo['Jadlog_Valor_Frete']['Mensagem']);
}else{
$cost = str_replace('.','',$calculo['Jadlog_Valor_Frete']['Retorno']);
$cost = str_replace(',','.',$cost);
$cost = ($cost+$this->config->get('jadlog5_taxa'));
$code = $v;
$quote_data[$code] = array(
'code' => 'jadlog5.' . $code,
'title' => '<img src="https://brewheadshop.com.br/img_pagamento/jadlog.png"> '.$k.' '.$prazo.'<br>Entregas para todo o Brasil com prazos aproximados para cada Região a seguir:<br>Região Sul: de 4 à 7 dias úteis<br>Região Sudeste: de 3 à 5 dias úteis<br>Região Centro-Oeste: de 4 à 10 dias úteis<br>Região Nordeste: de 8 à 19 dias úteis<br>Região Norte: de 20 à 25 dias úteis<br><span style="font-size:16px;font-weight:bold">Valor de Entrega</span>',
'cost' => $this->tax->calculate($cost, $this->config->get('jadlog5_tax_class_id'), $this->config->get('config_tax')),
'tax_class_id' => $this->config->get('jadlog5_tax_class_id'),
'text' => $this->formatar($this->tax->calculate($cost, $this->config->get('jadlog5_tax_class_id'), $this->config->get('config_tax')))
);
}
}
} catch (SoapFault $fault) {
//print_r($fault->faultstring);
$this->log->write("Erro de acesso a api jadlog, verificar se o mesmo esta online e o firewall esta com a porta 8080 liberada!");
}
}
someone would be kind enough to tell me how to solve this problem?
thank you very much
Are you sure the problem is on your side? can you test in the old version? the error message is
SOAP-ERROR: Parsing WSDL: Couldn't load from ...
– rray
in the old version works ok. I am testing what our colleague posted below.
– Jasar Orion