我必须在 android 中获取 SessionID ebay。我使用过 xml 解析器。
代码是,
static final String url = "https://api.sandbox.ebay.com/ws/api.dll";
HttpClient httpClient = new DefaultHttpClient();
final HttpParams httpParams = httpClient.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 100000);
HttpPost httpPost = new HttpPost(url);
StringEntity se = new StringEntity("<RuName>\"your runame\"</RuName>",HTTP.UTF_8);
//StringEntity entity = new StringEntity(sb.toString(),"UTF-8");
httpPost.setEntity(se);
httpPost.setHeader("X-EBAY-API-COMPATIBILITY-LEVEL","673");
httpPost.setHeader("X-EBAY-API-APP-NAME", Constants.EBAY_APP_ID);
httpPost.setHeader("X-EBAY-API-DEV-NAME",Constants.EBAY_DEV_ID);
httpPost.setHeader("X-EBAY-API-CERT-NAME", Constants.EBAY_CERT_ID);
httpPost.setHeader("X-EBAY-API-SITEID","0");
httpPost.setHeader("X-EBAY-API-CALL-NAME","GetSessionID");
httpPost.setHeader("Content-Type","text/xml");
//httpPost.addHeader("Content-Length","4392");
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
Log.e("xml", xml);
但它显示响应,
12-22 14:52:57.327: ERROR/xml(422):
<?xml version="1.0" encoding="UTF-8" ?>
<eBay>
<EBayTime>2012-12-22 07:52:57</EBayTime>
<Errors>
<Error>
<Code>10007</Code>
<ErrorClass>SystemError</ErrorClass>
<SeverityCode>1</SeverityCode>
<Severity>SeriousError</Severity>
<Line>0</Line>
<Column>0</Column>
<ShortMessage><![CDATA[ Internal error to the application ]]></ShortMessage>
</Error>
</Errors>
</eBay>
有什么解决办法吗?
最佳答案
引用自 http://developer.ebay.com/devzone/xml/docs/Reference/eBay/Errors/ErrorMessages.htm :
Error 10007 ("Internal error to the application") indicates an error on the eBay server side, not an error in your application.
您尝试过实时网站吗? eBay 沙箱有时会出现一些问题。
关于java - 错误 ebay [CDATA[ 应用程序内部错误 ]],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14001145/