我正在尝试使用 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、 token 等)。它给了我返回:
com.ebay.app.pres.service.hosting.WebServiceDisabledException: The web service eBayAPI is not properly configured or not found and is disabled.
有什么想法吗?我的意思是我假设我在这里没有做任何真正愚蠢的事情:)
最佳答案
您似乎忘记设置 url。您需要为网络服务指明适当的 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...
关于C# eBayAPIInterfaceClient 错误 : The web service eBayAPI is not properly configured or not found and is disabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6050369/