// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the CreativeWrapperService.
CreativeWrapperServiceInterface creativeWrapperService =
user.getService(DfpService.V201311.CREATIVE_WRAPPER_SERVICE);
Long labelId = Long.parseLong("INSERT_CREATIVE_WRAPPER_LABEL_ID_HERE");
// Create a creative wrapper.
CreativeWrapper creativeWrapper1 = new CreativeWrapper();
// A label can only be associated with one creative wrapper.
creativeWrapper1.setLabelId(labelId);
creativeWrapper1.setOrdering(CreativeWrapperOrdering.INNER);
creativeWrapper1.setHeader(
new CreativeWrapperHtmlSnippet("<b>My creative wrapper header</b>"));
creativeWrapper1.setFooter(
new CreativeWrapperHtmlSnippet("<b>My creative wrapper footer</b>"));
// Create the creative wrappers on the server.
CreativeWrapper[] creativeWrappers =
creativeWrapperService.createCreativeWrappers(new CreativeWrapper[] {creativeWrapper1});
for (CreativeWrapper creativeWrapper : creativeWrappers) {
System.out.printf(
"Creative wrapper with ID \"%s\" applying to label \"%s\" was created.\n",
creativeWrapper.getId(), creativeWrapper.getLabelId());