Skip to main content
Published: August 09 2006, 8:07:00 AMUpdated: July 26 2022, 12:52:02 PM

 Removing the InternationalShippingServiceOptions in SDK JAVA

The International Shipping Service Options can be removed in a listing via ReviseItem. You need to send in all the domestic shipping services and specify an empty tag for InternationalShippingServiceOption. Here is the sample code:
 
/*
 * TestReviseItem.java
 *
 */

package ebay.dts;

import com.ebay.soap.eBLBaseComponents.*;
import com.ebay.sdk.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import com.ebay.sdk.call.*;

public class TestReviseItem {
    private String configFile= "request_header_param.properties";
    private ApiContext apiContext;
    private ApiCall _apiCall;
  
   
    /** Creates a new instance of AppReviseItem */
    public TestReviseItem() {
       //Load the properties file into a Properties object
        Properties config = new Properties();
        try {
     config.load(new FileInputStream( configFile));
 } catch (IOException e) {
     System.out.println("config.properties file is missing from the current working directory.");
     return;
 }      
        apiContext = new ApiContext();
       
        // add ApiCredential to ApiContext
        ApiCredential credential= apiContext.getApiCredential();
        credential.seteBayToken(config.getProperty("token") );
          
        String server = config.getProperty("apiServer");
        apiContext.setApiServerUrl(server);
       
        //Enable logging
        ApiLogging logging = new ApiLogging();         
        apiContext.setApiLogging(logging);
    }
   
    public static void  main(String[] args){
        TestReviseItem ari = new TestReviseItem();
        String itemId = "110003230797";
 
        try {
            ItemIDType id = new  ItemIDType(itemId);
            ItemType item = new ItemType();
            item.setShippingOption(ShippingOptionCodeType.WorldWide);
            item.setShippingDetails(getShippingDetails());
            item.setItemID(id);
           
            ReviseItemCall rtc = new ReviseItemCall(ari.apiContext);
       
            rtc.setItemToBeRevised(item);
            rtc.setModifiedFields(null);
            rtc.reviseItem();
        }catch(Exception e){
           
        }
    }  
       
  
    private static ShippingDetailsType getShippingDetails(){
        // Build shipping details object.
        ShippingDetailsType sd = new ShippingDetailsType();
        try{    
            ShippingServiceOptionsType st1 = new ShippingServiceOptionsType();
            st1.setShippingService(ShippingServiceCodeType.USPSPriority.getValue());
            st1.setShippingServiceAdditionalCost(new AmountType(2.0));
            st1.setShippingServiceCost(new AmountType(10));
            st1.setShippingServicePriority(new Integer(1));
         

            ShippingServiceOptionsType st2 = new ShippingServiceOptionsType();
            st2.setExpeditedService(new Boolean(true));
            st2.setShippingService(ShippingServiceCodeType.USPSFirstClass.getValue());
            st2.setShippingServiceAdditionalCost(new AmountType(2.0));
            st2.setShippingServiceCost(new AmountType(15));
            st2.setShippingServicePriority(new Integer(2));
         

            sd.setShippingServiceOptions(new ShippingServiceOptionsType[]{st1, st2});
           
            InternationalShippingServiceOptionsType[] isso =new InternationalShippingServiceOptionsType[]{
                  new InternationalShippingServiceOptionsType()
            };
           sd.setInternationalShippingServiceOption(isso);    
        }catch(Exception e){}
         return sd;
    }
}

 

Attachments
How well did this answer your question?
Answers others found helpful