执行addSiteAccount1时获取com.yodlee.core.IncompleteArgumentException

时间:2015-12-18 09:48:00

标签: yodlee

我正在努力理解yodlee聚合java apis以在我的应用程序中实现它们。我尝试了测试驱动以及来自yodlee的java示例来探索apis。

I tried to add a new site account by using the addSiteAccount1 api but I got the following exception in test drive:

> {
>     "errorOccurred": "true",
>     "exceptionType": "com.yodlee.core.IncompleteArgumentException",
>     "referenceCode": "_0941afbc-10ed-4420-beaf-e8637ec5f7e2",
>     "message": "PASSWORD" }
> 
> Following are the parameters I passed in test drive
> 
> cobSessionToken *
> 08062013_0:66add93284e25548f783b432bdf55ead14ff7a153378f06285db3a46a5c675d101dac065d778adf446e38963ad21cd9c6771fe9568bfbd15d5a8ffeffc4b1aa4
> userSessionToken *
> 08062013_0:4efcec3bf34d801d7ad85bd019968a40ef432006545778a0b0920ae15bd1f623faa86236bc6ba82e1e321461f75316db85a03dfcf0305a9d13f99c4ba58ea95e
> siteId * 16441 credentialFields.enclosedType *
> com.yodlee.common.FieldInfoSingle credentialFields[0].displayName *
> Username credentialFields[0].fieldType.typeName * IF_LOGIN
> credentialFields[0].helpText 150862 credentialFields[0].maxlength 40
> credentialFields[0].name * LOGIN credentialFields[0].size 20
> credentialFields[0].value * sha5.Investment1
> credentialFields[0].valueIdentifier * LOGIN
> credentialFields[0].valueMask * LOGIN_FIELD
> credentialFields[0].isEditable * true credentialFields[1].displayName
> * Password credentialFields[1].fieldType.typeName * IF_PASSWORD credentialFields[1].helpText 150863 credentialFields[1].maxlength 40
> credentialFields[1].name * PASSWORD1 credentialFields[1].size 20
> credentialFields[1].value * Investment1
> credentialFields[1].valueIdentifier * PASSWORD
> credentialFields[1].valueMask * LOGIN_FIELD
> credentialFields[1].isEditable * true

此外,我尝试从我的应用程序执行相同的操作,但是出现以下错误:

  

{&#34; exceptionType&#34;:&#34;异常   发生&#34;&#34; referenceCode&#34;:&#34; _3b60bb3c-99d7-470a-bba0-a9fdb83eccf8&#34;&#34; errorOccurred&#34;:&#34;真&#34;} < / p>

以下是我的代码:

public JSONObject addSiteAccount(String cobrandSessionToken,String userSessionToken) {
        DefaultHttpClient httpclient = new DefaultHttpClient();
        JSONObject result = new JSONObject();
        String url = "https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/SiteAccountManagement/addSiteAccount1";
        try {
            HttpsURLConnection.setDefaultHostnameVerifier(new NullHostnameVerifier());

            PostMethod pm = new PostMethod(url);
            pm.addParameter(paramNameCobSessionToken, cobrandSessionToken);
            pm.addParameter(paramNameUserSessionToken, userSessionToken);

            pm.addParameter("credentialFields[0].name", "LOGIN");
            pm.addParameter("credentialFields[0].displayName", "Username");
            pm.addParameter("credentialFields[0].isEditable", "true");
            pm.addParameter("credentialFields[0].isOptional", "false");
            pm.addParameter("credentialFields[0].helpText", "22059");
            pm.addParameter("credentialFields[0].valuePattern", "null");
            pm.addParameter("credentialFields[0].defaultValue", "null");
            pm.addParameter("credentialFields[0].value", "test1");
            pm.addParameter("credentialFields[0].validValues", "test1");
            pm.addParameter("credentialFields[0].displayValidValues", "null");
            pm.addParameter("credentialFields[0].valueIdentifier", "LOGIN");
            pm.addParameter("credentialFields[0].valueMask", "LOGIN_FIELD");
            pm.addParameter("credentialFields[0].fieldType", "LOGIN");
            pm.addParameter("credentialFields[0].validationRules", "null");
            pm.addParameter("credentialFields[0].size", "20");
            pm.addParameter("credentialFields[0].maxlength", "40");
            pm.addParameter("credentialFields[0].userProfileMappingExpression",
                    "null");
            pm.addParameter("credentialFields[0].fieldErrorCode", "1");
            pm.addParameter("credentialFields[0].fieldErrorMessage", "null");

            pm.addParameter("credentialFields[1].name", "PASSWORD");
            pm.addParameter("credentialFields[1].displayName", "Password");
            pm.addParameter("credentialFields[1].isEditable", "true");
            pm.addParameter("credentialFields[1].isOptional", "false");
            pm.addParameter("credentialFields[1].helpText", "AUS_Row_Name");
            pm.addParameter("credentialFields[1].valuePattern", "null");
            pm.addParameter("credentialFields[1].defaultValue", "null");
            pm.addParameter("credentialFields[1].value", "test2");
            pm.addParameter("credentialFields[1].validValues", "test2");
            pm.addParameter("credentialFields[1].displayValidValues", "null");
            pm.addParameter("credentialFields[1].valueIdentifier", "PASSWORD");
            pm.addParameter("credentialFields[1].valueMask", "LOGIN_FIELD");
            pm.addParameter("credentialFields[1].fieldType", "PASSWORD");
            pm.addParameter("credentialFields[1].validationRules", "null");
            pm.addParameter("credentialFields[1].size", "20");
            pm.addParameter("credentialFields[1].maxlength", "40");
            pm.addParameter("credentialFields[1].userProfileMappingExpression",
                    "null");
            pm.addParameter("credentialFields[1].fieldErrorCode", "1");
            pm.addParameter("credentialFields[1].fieldErrorMessage", "null");
            pm.addParameter("credentialFields.objectInstanceType",
                    "[Lcom.yodlee.common.FieldInfoSingle;");

            pm.addParameter("siteId", "8995");
            // pm.addParameter("siteId.objectInstanceType", "long");

            HttpClient hc = new HttpClient();
            hc.executeMethod(pm);

            String source = pm.getResponseBodyAsString();

            System.out.println(pm.getResponseBodyAsString());

            result = new JSONObject(source);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            httpclient.getConnectionManager().shutdown();
        }

        return result;
    }

提前致谢 Abhisek

1 个答案:

答案 0 :(得分:0)

@Abhisek,

检查网站对此请求所需的参数。每个站点都有自己的输入命名约定。您可以使用here

检查网站表单及其参数

更好的方法是使用for循环动态生成所有这些参数。