For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

Removing InternationalShippingServiceOptions in SDK JAVA

  • Answer ID 599
  • Published 08/09/2006 08:07 AM
  • Updated 10/20/2013 06:41 AM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=599
 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));
            st1.setShippingInsuranceCost(new AmountType(1.0));

            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));
            st2.setShippingInsuranceCost(new AmountType(1.0));

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

How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter