Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 通过API退货将易趣订单标记为发货人';GetSellerTransactionsResponseType与CompleteSaleSponseType不兼容';错误_Java_Ebay Api - Fatal编程技术网

Java 通过API退货将易趣订单标记为发货人';GetSellerTransactionsResponseType与CompleteSaleSponseType不兼容';错误

Java 通过API退货将易趣订单标记为发货人';GetSellerTransactionsResponseType与CompleteSaleSponseType不兼容';错误,java,ebay-api,Java,Ebay Api,我需要将易趣订单标记为通过易趣API发货 有一个方法: public void ShippEbayOrder(EbayOrder ebayOrder) { string Developer = WebConfigurationManager.AppSettings["EbayProductionDevID"]; string Application = WebConfigurationManager.AppSettings["EbayProductionAppID"];

我需要将易趣订单标记为通过易趣API发货

有一个方法:

public void ShippEbayOrder(EbayOrder ebayOrder)
{
    string Developer = WebConfigurationManager.AppSettings["EbayProductionDevID"];
    string Application = WebConfigurationManager.AppSettings["EbayProductionAppID"];
    string Certificate = WebConfigurationManager.AppSettings["EbayProductionCertID"];
    string eBayToken = WebConfigurationManager.AppSettings["EbayProductionUserToken"];
    string SoapApiServerUrl = WebConfigurationManager.AppSettings["EbayProductionApiServerUrl"];
    string SignInUrl = WebConfigurationManager.AppSettings["EbayProductionSignInUrl"];
    string EPSServerUrl = WebConfigurationManager.AppSettings["EbayProductionEPSUrl"];

    var ebayService = GetebayService();

    CompleteSaleRequestType completeSaleRequestType = new CompleteSaleRequestType();
    completeSaleRequestType.Version = version;

    if (ebayOrder.ContainsOrderType == EbayOrder.OrderType.Transaction)
    {
        completeSaleRequestType.TransactionID = ebayOrder.SourceOrderId;
        completeSaleRequestType.ItemID = ebayOrder.ItemsInfo[0].SourceItemId;
    }
    else
        completeSaleRequestType.OrderID = ebayOrder.SourceOrderId;

    completeSaleRequestType.Shipped = true;
    completeSaleRequestType.ShippedSpecified = true;
    CompleteSaleResponseType completeSaleResponseType = ebayService.CompleteSale(completeSaleRequestType);
但当代码调用CompleteSale方法时,它会抛出一个exeption:

java.lang.ClassCastException: com.ebay.domain.apisoap.pres.service.hosting.soap.basecomponents.GetSellerTransactionsResponseType incompatible with com.ebay.domain.apisoap.pres.service.hosting.soap.basecomponents.CompleteSaleResponseType

谁能帮我?谢谢大家!

正确的代码和方法应为:

public void ShippEbayOrder(EbayOrder ebayOrder)
    {
        string Developer = WebConfigurationManager.AppSettings["EbayProductionDevID"];
        string Application = WebConfigurationManager.AppSettings["EbayProductionAppID"];
        string Certificate = WebConfigurationManager.AppSettings["EbayProductionCertID"];
        string eBayToken = WebConfigurationManager.AppSettings["EbayProductionUserToken"];
        string SoapApiServerUrl = WebConfigurationManager.AppSettings["EbayProductionApiServerUrl"];
        string SignInUrl = WebConfigurationManager.AppSettings["EbayProductionSignInUrl"];
        string EPSServerUrl = WebConfigurationManager.AppSettings["EbayProductionEPSUrl"];

        var ebayService = new eBayAPIInterfaceService();

        string version = "551";
        string requestUrl = SoapApiServerUrl + "?callname=CompleteSale&siteid=0"
                            + "&appid=" + Application + "&version=" + version + "&routing=default";
        ebayService.Url = requestUrl;
        ebayService.RequesterCredentials = new CustomSecurityHeaderType();
        ebayService.RequesterCredentials.Credentials = new UserIdPasswordType();
        ebayService.RequesterCredentials.Credentials.AppId = Application;
        ebayService.RequesterCredentials.Credentials.DevId = Developer;
        ebayService.RequesterCredentials.Credentials.AuthCert = Certificate;
        ebayService.RequesterCredentials.eBayAuthToken = eBayToken;

        CompleteSaleRequestType completeSaleRequestType = new CompleteSaleRequestType();
        completeSaleRequestType.Version = version;

        if (ebayOrder.ContainsOrderType == EbayOrder.OrderType.Transaction)
        {
            completeSaleRequestType.TransactionID = ebayOrder.SourceOrderId;
            completeSaleRequestType.ItemID = ebayOrder.ItemsInfo[0].SourceItemId;
        }
        else
            completeSaleRequestType.OrderID = ebayOrder.SourceOrderId;

        completeSaleRequestType.Shipped = true;
        completeSaleRequestType.ShippedSpecified = true;
        CompleteSaleResponseType completeSaleResponseType = ebayService.CompleteSale(completeSaleRequestType);
    }

ebayService.CompleteSale
返回什么,因为它显然不是
completeSalesponseType
我们需要更多信息。它返回completeSalesponseType对象