Required REST response is empty

1

My store is experiencing the following problem when shipping rest:

  

Exception 'Zend_Http_Client_Exception' with message 'Unable to read response, or response is empty' in D: \ wamp \ www \ santaines \ lib \ Zend \ Http \ Client.php: 1081 Stack trace: # 0 D: \ wamp \ www \ santaines \ lib \ Varien \ Http \ Client.php (61): Zend_Http_Client-> request (NULL) # 1 D: \ wamp \ www \ santaines \ app \ code \ local \ Envato \ Custompaymentmethod \ controllers \ PaymentController (418): Envato_Custompaymentmethod_PaymentController-> gatewayAction (418): Variant_Http_Client-> request () # 2 D: \ wamp \ www \ santaines \ app \ code \ core \ Mage \ Core \ Controller \ (4) D: \ wamp \ www \ santaines \ app \ code \ core \ Mage \ Core \ Controller \ Varien \ Router \ Standard.php (250): Mage_Core_Controller_Varien_Action-> dispatch (gateway) # 4 D: Mage_Core_Controller_Varien_Router_Standard-> match (Object (Mage_Core_Controller_Request_Http)) # 5 D: \ wamp \ www \ santaines \ bin \ app \ code \ core \ Mage \ Core \ Model \ App.php (354): Mage_Core_Controller_Varien_Front-> dispatch () # 6 D: \ wamp \ www \ santaines \ app \ Mage.php (684): Mage_Core_Model_App-> run (Array) # 7 D: \ wamp \ www \ santaines \ index.php (87): Mage :: run ('', 'store') # 8 {main}

Requisition code:

    $arr_querystring = array(

    'numero' =>  $orderId, 
    'nome' => Mage::helper('customer')->getCustomerName(),
    'valor' =>  $totalPedido,
    'cpf' => $cpfComprador,
    'email' => Mage::helper('customer')->getCustomer()->getData('email'),
    'celular' => $celularComprador,
    'dtNascimento' =>  $dataNascimentoComprador,  
    'envioSMS' => 'N' );

$jsonData = Mage::helper('core')->jsonEncode( $arr_querystring );
$headers = array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jsonData),
    'lgn:xxx',
    'pwd:xxx');

$client = new Varien_Http_Client();

$client->setUri('https://nameOfServerRest')
         ->setMethod('POST')
         ->setHeaders($headers)
         ->setRawData($jsonData);
try{

  $response = $client->request();

  if ($response->isSuccessful()){

    $statusJson = $response->getBody();

    $json = Mage::helper('core')->jsonDecode($statusJson);

    if ($json['Status'] == "001"){  

        $link = $json['Message'];
        $this->_redirectUrl($link);
        Mage_Core_Controller_Varien_Action::_redirect('custompaymentmethod/payment/response', array('_secure' => false, '_query'=> $arr_querystring));


        }else{
          Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/error', array('_secure'=> false));
        }
    }

}catch (Exception $e){
    echo $e;
}  

I tested with another store and the server I shipped to is normally running. What could be happening?

    
asked by anonymous 17.02.2017 / 16:29

0 answers