2011-05-18 46 views
3

我想與C#中的易趣API接口。他們給出的C#中的示例代碼可以很好地工作。這似乎是使用VS中的「Web引用」(我正在使用2008 Express)。Ebay eBayAPIInterfaceClient C#幫助

當我有一個去加入一個「服務引用」我的項目,我必須使用eBayAPIInterfaceClient以下列方式(我無法找到任何ebayAPIInterfaceService像他們爲榜樣參考使用):

eBayAPIInterfaceClient client = new eBayAPIInterfaceClient(); 

CustomSecurityHeaderType credentials = new CustomSecurityHeaderType(); 

credentials.Credentials = new UserIdPasswordType(); 

credentials.Credentials.AppId = AppSettings.EbayAppID; 
credentials.Credentials.DevId = AppSettings.EbayDevID; 
credentials.Credentials.AuthCert = AppSettings.EbayCertID; 
credentials.eBayAuthToken = AppSettings.EbayToken; 

GeteBayOfficialTimeRequestType ebayTimeReq = new GeteBayOfficialTimeRequestType(); 

ebayTimeReq.Version = "551"; 

GeteBayOfficialTimeResponseType response = client.GeteBayOfficialTime(ref credentials, ebayTimeReq); 

無論如何,它不起作用(顯然我使用的是相同的設置,如AppID,令牌等)。這讓我回:

com.ebay.app.pres.service.hosting.WebServiceDisabledException: The web service eBayAPI is not properly configured or not found and is disabled.

任何想法?我的意思是我假設我沒有在這裏做任何真正愚蠢的事情:)

+0

沒有爲eBayAPIInterfaceClient沒有URL屬性還沒有爲異步調用沒有憑據屬性。 – 2012-10-12 14:37:23

回答

1

看起來你忘了設置網址。您需要指出web服務的適當url,以指示您是否嘗試使用實時環境或沙箱。

https://ebay.custhelp.com/app/answers/detail/a_id/861/~/error---webservicedisabledexception

試試這個(活):

eBayAPIInterfaceClient client = new eBayAPIInterfaceClient(); 
client.Url = "https://api.ebay.com/wsapi"; 

// etc... 
+0

我認爲https://ebay.custhelp.com/app/answers/detail/a_id/2045/~/c%23.net-code-sample-to-call-ebay-trading-api-using-.net-框架-4比描述更好一些。我同意網址是必要的 - 而且我現在正在自己得出這個結論。 – 2012-07-25 22:41:12