0

我必须在 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>

任何解决方案?

4

1 回答 1

1

来自http://developer.ebay.com/devzone/xml/docs/Reference/eBay/Errors/ErrorMessages.htm的引用:

错误 10007(“应用程序的内部错误”)表示 eBay 服务器端的错误,而不是您的应用程序中的错误。

你试过现场直播吗?eBay 沙箱有时会有点问题。

于 2012-12-23T14:04:10.100 回答