Java 通过API退货将易趣订单标记为发货人';GetSellerTransactionsResponseType与CompleteSaleSponseType不兼容';错误
我需要将易趣订单标记为通过易趣API发货 有一个方法: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"];
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对象