public static void runExample(
      AdManagerServices adManagerServices,
      AdManagerSession session,
      long advertiserId,
      long traffickerId)
      throws RemoteException {
    // Get the OrderService.
    OrderServiceInterface orderService =
        adManagerServices.get(session, OrderServiceInterface.class);

    // Create an order.
    Order order = new Order();
    order.setName("Order #" + new Random().nextInt(Integer.MAX_VALUE));
    order.setAdvertiserId(advertiserId);
    order.setTraffickerId(traffickerId);

    // Create the order on the server.
    Order[] orders = orderService.createOrders(new Order[] {order});

    for (Order createdOrder : orders) {
      System.out.printf(
          "An order with ID %d and name '%s' was created.%n",
          createdOrder.getId(), createdOrder.getName());
    }
  }
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long advertiserId , long traffickerId ) throws RemoteException { OrderServiceInterface orderService = adManagerServices . get ( session , OrderServiceInterface . class ) ; Order order = new Order ( ) ; order . setName ( "Order #" + new Random ( ) . nextInt ( Integer . MAX_VALUE ) ) ; order . setAdvertiserId ( advertiserId ) ; order . setTraffickerId ( traffickerId ) ; Order [ ] orders = orderService . createOrders ( new Order [ ] { order } ) ; for ( Order createdOrder : orders ) { System . out . printf ( "An order with ID %d and name '%s' was created.%n" , createdOrder . getId ( ) , createdOrder . getName ( ) ) ; } }
Runs the example.

@param adManagerServices the services factory.
@param session the session.
@param advertiserId the ID of the advertiser (company) that all creatives will be assigned to.
@param traffickerId the ID of the trafficker (user) associated with this order.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.