// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the OrderService.
OrderServiceInterface orderService =
user.getService(DfpService.V201308.ORDER_SERVICE);
// Set the advertiser (company), salesperson, and trafficker to assign to
// each order.
Long advertiserId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");
Long salespersonId = Long.parseLong("INSERT_SALESPERSON_ID_HERE");
Long traffickerId = Long.parseLong("INSERT_TRAFFICKER_ID_HERE");
// Create an array to store local order objects.
Order[] orders = new Order[5];
for (int i = 0; i < 5; i++) {
Order order = new Order();
order.setName("Order #" + i);
order.setAdvertiserId(advertiserId);
order.setSalespersonId(salespersonId);
order.setTraffickerId(traffickerId);
orders[i] = order;
}
// Create the orders on the server.
orders = orderService.createOrders(orders);
if (orders != null) {
for (Order order : orders) {
System.out.println("An order with ID \""
+ order.getId() + "\" and named \"" + order.getName() + "\" was created.");