function get_category_by_sku($sku)
{
    global $serviceUrl, $config, $service;
    $request = new MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKURequest();
    $request->setSellerId(MWS_MERCHANG_ID);
    $request->withMarketplaceId(MWS_MARKETPLACE_ID);
    $request->setSellerSKU($sku);
    return invokeGetMyCategoryForSKU($service, $request);
}
 /**
  * Get Product Categories For SKU
  * Gets categories information for a product identified by
  * the SellerId and SKU.
  *
  * @param mixed $request array of parameters for MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKU request or MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKU object itself
  * @see MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKURequest
  * @return MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKUResponse
  *
  * @throws MarketplaceWebServiceProducts_Exception
  */
 public function getProductCategoriesForSKU($request)
 {
     if (!$request instanceof MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKURequest) {
         require_once dirname(__FILE__) . '/Model/GetProductCategoriesForSKURequest.php';
         $request = new MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKURequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'GetProductCategoriesForSKU';
     $httpResponse = $this->_invoke($parameters);
     require_once dirname(__FILE__) . '/Model/GetProductCategoriesForSKUResponse.php';
     $response = MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKUResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
 * Uncomment to try out Mock Service that simulates MarketplaceWebServiceProducts
 * responses without calling MarketplaceWebServiceProducts service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MarketplaceWebServiceProducts/Mock tree
 *
 ***********************************************************************/
// $service = new MarketplaceWebServiceProducts_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for Get Product Categories For SKU Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKU
$request = new MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKURequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetProductCategoriesForSKU($service, $request);
/**
 * Get Get Product Categories For SKU Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param MarketplaceWebServiceProducts_Interface $service instance of MarketplaceWebServiceProducts_Interface
 * @param mixed $request MarketplaceWebServiceProducts_Model_GetProductCategoriesForSKU or array of parameters
 */
function invokeGetProductCategoriesForSKU(MarketplaceWebServiceProducts_Interface $service, $request)
{
    try {
        $response = $service->GetProductCategoriesForSKU($request);