当我调用login API时,我收到“找不到会话ID”响应。我确保cobsessiontoken是有效的而不是空的,但是Yodlee的服务认为该字段是空的。
HttpPost httpPost2 = new HttpPost(yodleeURL+login);
List<NameValuePair> nvps2 =new ArrayList<NameValuePair>();
System.out.println(yodleeURL+login);
nvps2.add(new BasicNameValuePair("name", "cobSessionToken"));
System.out.println(sessionToken);
nvps2.add(new BasicNameValuePair("value", sessionToken));
nvps2.add(new BasicNameValuePair("name", "login"));
nvps2.add(new BasicNameValuePair("value", "xxxxxxx"));
nvps2.add(new BasicNameValuePair("name", "password"));
nvps2.add(new BasicNameValuePair("value", "xxxxxxx"));
UrlEncodedFormEntity encodedURL = new UrlEncodedFormEntity(nvps2);
httpPost2.setEntity(encodedURL);
CloseableHttpResponse response2 = httpclient.execute(httpPost2);
JsonElement element1 = new JsonParser().parse(EntityUtils.toString(response2.getEntity()));
JsonObject jobject1 = element1.getAsJsonObject();
System.out.println(jobject1.toString());
答案 0 :(得分:0)
当你没有将'cobSessionToken'作为输入参数传递或传递错误时,会出现此响应。 如果您正在通过,请确保其外壳也是正确的,因为它区分大小写。
尽管如此,根据您的代码,您似乎正确地传递了参数名称
答案 1 :(得分:0)
万一你还没弄明白。请使用以下代码
HttpPost httpPost2 = new HttpPost(yodleeURL+login);
List<NameValuePair> nvps2 =new ArrayList<NameValuePair>();
System.out.println(yodleeURL+login);
nvps2.add(new BasicNameValuePair("cobSessionToken", sessionToken));
nvps2.add(new BasicNameValuePair("login", "xxxxxxx"));
nvps2.add(new BasicNameValuePair("password", "xxxxxxx"));
UrlEncodedFormEntity encodedURL = new UrlEncodedFormEntity(nvps2);
httpPost2.setEntity(encodedURL);
CloseableHttpResponse response2 = httpclient.execute(httpPost2);
JsonElement element1 = new JsonParser().parse(EntityUtils.toString(response2.getEntity()));
JsonObject jobject1 = element1.getAsJsonObject();
System.out.println(jobject1.toString());