Example 26 : Find international delivery options
This example will find a consignment in the system, and will then modify some fields.
package com.metapack.dm.test; import com.metapack.deliverymanager.client.Address; import com.metapack.deliverymanager.client.DeliveryOption; import com.metapack.deliverymanager.client.FindDeliveryOptionsParams; import com.metapack.deliverymanager.client.webservices.DeliveryOptionsService; public class Example26 extends ExampleBase { public void run() throws Exception { DeliveryOptionsService service = createDeliveryOptionsService(); FindDeliveryOptionsParams params = new FindDeliveryOptionsParams(); params.setWarehouseCode( "DEFAULT" ); params.setConsignmentWeight( 1.24 ); params.setSenderAddress( createDefaultAddress() ); Address address = new Address(); address.setLine1("Australian Government Information Management Office"); address.setLine2("John Gorton Building"); address.setLine3("King Edward Terrace"); address.setLine4("Parkes"); address.setPostCode("ACT 2600"); address.setCountryCode("AUS"); params.setRecipientAddress( address ); DeliveryOption[] options = service.findDeliveryOptions( params ); if( options.length == 0 ) { System.out.println( "No carriers can take this consignment" ); } else { for( DeliveryOption option : options ) { System.out.println( "Service " + option.getCarrierServiceCode() + " can deliver it and it will cost " + option.getCost() ); } } } }

