public static void runExample(
DfaServices dfaServices, DfaSession session, String creativeName, String assetFileName,
long advertiserId, long sizeId, long campaignId) throws Exception {
// Request the creative service from the service client factory.
CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);
// Create the image creative.
ImageCreative imageCreative = new ImageCreative();
imageCreative.setId(0);
imageCreative.setName(creativeName);
imageCreative.setActive(true);
imageCreative.setAdvertiserId(advertiserId);
imageCreative.setSizeId(sizeId);
imageCreative.setAssetFilename(assetFileName);
// The type ID for image creatives is 1. See GetCreativeTypes.java
imageCreative.setTypeId(1);
// Save the image creative.
CreativeSaveResult creativeSaveResult = creativeService.saveCreative(imageCreative,
campaignId);
// Display the new creative ID.
System.out.printf("Image creative with ID \"%s\" was created.%n",
creativeSaveResult.getId());