code: public function cancelShipment($request)
      {
          if (!($request instanceof MWSMerchantFulfillmentService_Model_CancelShipmentRequest)) {
              require_once (dirname(__FILE__) . '/Model/CancelShipmentRequest.php');
              $request = new MWSMerchantFulfillmentService_Model_CancelShipmentRequest($request);
          }
          $parameters = $request->toQueryParameterArray();
          $parameters['Action'] = 'CancelShipment';
          $httpResponse = $this->_invoke($parameters);
  
          require_once (dirname(__FILE__) . '/Model/CancelShipmentResponse.php');
          $response = MWSMerchantFulfillmentService_Model_CancelShipmentResponse::fromXML($httpResponse['ResponseBody']);
          $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
          return $response;
      }
docs: Cancel Shipment
  Cancels an existing shipment.  This will only succeed if the cancellation window has not passed and if the shipment
  has not been cancelled already.
  
  @param mixed $request array of parameters for MWSMerchantFulfillmentService_Model_CancelShipment request or MWSMerchantFulfillmentService_Model_CancelShipment object itself
  @see MWSMerchantFulfillmentService_Model_CancelShipmentRequest
  @return MWSMerchantFulfillmentService_Model_CancelShipmentResponse
  
  @throws MWSMerchantFulfillmentService_Exception