private function doCall($transaction, $data) { $object = json_decode(json_encode($data), TRUE); Mage::helper('greatplains')->Log("Request array: " . print_r($object, true)); //Mage::helper('greatplains')->Log("Request XML: " . print_r($object, true)); $response = null; // $this->_response->return->error = array(); try { $client = $this->getSoapClient(); if (!$client) { return false; } $response = $client->{$transaction}($object); } catch (SoapFault $sf) { if ($response) { $response->return->error = $sf->getMessage(); } else { $response = $sf->getMessage(); } Mage::helper('greatplains')->Log("error : " . $sf->getMessage()); } catch (Exception $e) { if ($response) { $response->return->error = $e->getMessage(); } else { $response = $sf->getMessage(); } Mage::helper('greatplains')->Log("error : " . $e->getMessage()); } $request = $client->__getLastRequest(); try { Mage::helper('greatplains')->Log("Request : " . print_r($request, true)); } catch (Exception $e) { MAGE::Log("Error printing request to log"); } try { Mage::helper('greatplains')->Log("Response : " . print_r($response, true)); } catch (Exception $e) { MAGE::Log("Error printing response to log"); } return $response; }