3

我正在尝试与 C# 中的 ebay API 交互。他们为获得时间而提供的 C# 示例代码工作正常。这似乎是在 VS 中使用“网络参考”(我使用的是 2008 Express)。

当我通过向我的项目添加“服务引用”来尝试时,我必须以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.

有任何想法吗?我的意思是我假设我在这里没有做任何愚蠢的事情:)

4

1 回答 1

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...
于 2012-02-08T21:40:49.630 回答