0

具有以下功能:

web_reg_save_param("questionId", "LB=secretKnowledges\":\\[\\{", "RB=\"", LAST);

我尝试将来自服务器响应的“questionId”参数的值作为(json文件)捕获,如下所示:

"salutation":{"firstNaAction me":"Sebastian","lastName":"Martens"},"userAccount":{"mail":"gcdmtest_bp_pr_acc_po_20073@trash-mail.com","notificationLevel":"NEW_DEVICE","authenticationLevel":"ONE_FACTOR","gcid":"bb2e64a9-1b39-4692-9c52-4845eb15c4f7","secretKnowledges":[{"questionId":11301},{"questionId":11302}],"secretKnowledgeActivated":true,"status":"ACTIVATED"}}

而不是我收到以下错误:

Action.c(23): Error -26377: No match found for the requested parameter "questionId". Either the specified boundaries were not found in the response or the matched text is longer than current max html parameter size of 8000 bytes. The total length of the response is 1506 bytes. You can use web_set_max_html_param_len to increase the max parameter size.    [MsgId: MERR-26377]Action.c(23): Notify: Saving Parameter "questionId = ".

我做错了什么?

4

1 回答 1

1

不确定我是否理解你。如果您需要响应中所有questionId参数的值,请尝试以下操作:

web_reg_save_param("questionId", "LB={\"questionId\":", "RB=}", "Ord=All", LAST);

这将产生一个参数数组questionId_1questionId_2等。参数的数量也将保存到questionId_count参数。但是,如果您只需要该参数的第一次出现,只需跳过Ord=All参数。

还有一个用于 JSON 响应的特殊提取 API:web_reg_save_param_json。这是您的案例的示例:

web_reg_save_param_json("ParamName=questionId", "QueryString=$..questionId",
   "SelectAll=Yes", LAST);

此外,如果您需要基于 RegEx 的参数提取,您可以尝试web_reg_save_param_regexp

于 2015-10-10T10:57:49.573 回答