com.ebay.app.pres.service.hosting.WebServiceDisabledExceptio
本文关键字:hosting WebServiceDisabledExceptio service pres ebay app com | 更新日期: 2023-09-27 18:34:54
我正在使用eBay API在我的 ASP.NET MVC4应用程序中调用GetSessionId方法。但是我收到此错误
com.ebay.app.pres.service.hosting.WebServiceDisabledException:Web 服务 eBayAPI 未正确配置或未找到并被禁用。
我的代码在这里...
[HttpPost]
public ActionResult f()
{
string endpointURL5 = _apiUrl + "?callname = GetSessionID" +
"&siteid = " + "0" +
"&appid = " + _appId +
"&version = " + "768" +
"&routing = default";
eBayAPIInterfaceClient service = new eBayAPIInterfaceClient();
System.ServiceModel.EndpointAddress address1 = new System.ServiceModel.EndpointAddress(endpointURL5);
service.Endpoint.Address = address1;
string version1 = "768";
GetSessionIDRequestType gs = new GetSessionIDRequestType();
gs.RuName = _ruName;
gs.Version = version1;
CustomSecurityHeaderType cred = new CustomSecurityHeaderType();
UserIdPasswordType cr = new UserIdPasswordType();
//cr.Username = "esandbox10539";
//cr.Password = "nomistakes";
cr.AppId = _appId;
cr.AuthCert = _authCert;
cr.DevId = _devId;
cred.Credentials = cr;
GetSessionIDResponseType sessionID = service.GetSessionID(ref cred, gs);
Session["sessionID"] = (sessionID.Any.GetValue(0) as XmlElement).InnerXml;
r.Data = _signInUrl + "?SignIn&runame=" + gs.RuName + "&SessID=" + Server.UrlEncode(Session["sessionID"].ToString());
return Json(r, JsonRequestBehavior.AllowGet);
}
这在 7 个月前工作正常。但是现在我收到此错误我已经检查了凭据,但凭据是完美的。我的_apiUrl是"https://api.ebay.com/wsapi">
感谢您的任何建议。
这是用于检查您的身份验证令牌是否有效的 PHP 代码。 抱歉,我是一名PHP开发人员,所以对ASP了解不多
$feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<GetTokenStatusRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>$this->auth_token</eBayAuthToken>
</RequesterCredentials>
<ErrorLanguage>en_GB</ErrorLanguage>
<MessageID>$messageID</MessageID>
<Version>$this->api_version</Version>
<WarningLevel>High</WarningLevel>
</GetTokenStatusRequest>
EOD;
$feed = trim($feed);
$site_id = 3;//3 For UK
$headers = array
(
'X-EBAY-API-COMPATIBILITY-LEVEL: ' . $this->api_version,
'X-EBAY-API-DEV-NAME: ' . $this->dev_id,
'X-EBAY-API-APP-NAME: ' . $this->app_id,
'X-EBAY-API-CERT-NAME: ' . $this->cert_id,
'X-EBAY-API-CALL-NAME: ' . $call_name,
'X-EBAY-API-SITEID: ' . $site_id,
);
// Send request to eBay and load response in $response
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, 'https://api.ebay.com/ws/api.dll');
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $feed);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($connection);
curl_close($connection);