2011-05-18 116 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