public static void runExample(
      DfaServices dfaServices,
      DfaSession session,
      String creativeName,
      String mobileAssetFileName,
      long advertiserId,
      long campaignId)
      throws Exception {
    // Request the service.
    CreativeRemote service = dfaServices.get(session, CreativeRemote.class);

    // Create the mobile display creative.
    MobileDisplayCreative mobileDisplayCreative = new MobileDisplayCreative();
    mobileDisplayCreative.setAdvertiserId(advertiserId);
    mobileDisplayCreative.setName(creativeName);
    mobileDisplayCreative.setArchived(false);
    // The type ID for mobile creatives is 30. See GetCreativeTypes.java
    mobileDisplayCreative.setTypeId(30);

    // Set the mobile creative asset.
    HTMLCreativeAsset htmlCreativeAsset = new MobileDisplayCreativeAsset();
    htmlCreativeAsset.setAssetFilename(mobileAssetFileName);
    mobileDisplayCreative.setCreativeAssets(new HTMLCreativeAsset[] {htmlCreativeAsset});

    // Save the mobile display creative.
    CreativeSaveResult creativeSaveResult = service.saveCreative(mobileDisplayCreative, campaignId);

    // Display the new creative ID.
    System.out.printf(
        "Mobile display creative with ID \"%s\" was created.%n", creativeSaveResult.getId());
  }
  public static void runExample(
      DfaServices dfaServices,
      DfaSession session,
      String assetName,
      String pathToFile,
      long advertiserId)
      throws Exception {
    // Request the service.
    CreativeRemote service = dfaServices.get(session, CreativeRemote.class);

    // Create the HTML asset.
    CreativeAsset swfAsset = new CreativeAsset();
    swfAsset.setForHTMLCreatives(true);
    swfAsset.setName(assetName);
    swfAsset.setContent(Media.getMediaDataFromFile(pathToFile));
    swfAsset.setAdvertiserId(advertiserId);

    // Save the asset.
    CreativeAssetSaveResult creativeAssetSaveResult = service.saveCreativeAsset(swfAsset);

    // Display the new asset file name.
    System.out.printf(
        "Asset was saved with file name of \"%s\".%n", creativeAssetSaveResult.getSavedFilename());
  }