/**
  * Shipping method save action
  *
  * @return void
  */
 public function saveShippingMethodAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->_message($this->__('Specified invalid data.'), self::MESSAGE_STATUS_ERROR);
         return;
     }
     try {
         $this->_initCheckout();
         $data = $this->getRequest()->getPost('shipping_method', '');
         $result = $this->_checkout->saveShippingMethod($data);
         if (!isset($result['error'])) {
             $message = new Mage_XmlConnect_Model_Simplexml_Element('<message></message>');
             $message->addChild('status', self::MESSAGE_STATUS_SUCCESS);
             $message->addChild('text', $this->__('Shipping method has been set.'));
             if ($this->_getQuote()->isVirtual()) {
                 $quoteAddress = $this->_getQuote()->getBillingAddress();
             } else {
                 $quoteAddress = $this->_getQuote()->getShippingAddress();
             }
             $taxAmount = Mage::helper('core')->currency($quoteAddress->getBaseTaxAmount(), false, false);
             $message->addChild('tax_amount', Mage::helper('xmlconnect')->formatPriceForXml($taxAmount));
             $this->getResponse()->setBody($message->asNiceXml());
         } else {
             if (!is_array($result['message'])) {
                 $result['message'] = array($result['message']);
             }
             $this->_message(implode('. ', $result['message']), self::MESSAGE_STATUS_ERROR);
         }
     } catch (Mage_Core_Exception $e) {
         $this->_message($e->getMessage(), self::MESSAGE_STATUS_ERROR);
     } catch (Exception $e) {
         $this->_message($this->__('Unable to save shipping method.'), self::MESSAGE_STATUS_ERROR);
         Mage::logException($e);
     }
 }