Reading sendFormParameters params for JS Adapter

为君一笑 提交于 2019-12-12 04:20:35

问题


I have javascript WLResourceRequest.POST call at client side. I'm trying to read the received values at server end. On the server side I can to read only "AB".

Client side code:

var resourceRequest = new WLResourceRequest("/adapters/AdapterNewGet/getFeed", WLResourceRequest.POST);
var formParameters={"params":"['AB','CD','EF']")};   
resourceRequest.sendFormParameters(formParameters).then(app.onSuccess, app.onFailure);

Adapter Side code:

function getFeed(tag) {
    var input = {
        method : 'get',
        returnedContentType : 'xml',
        path : getPath(tag)
    };
    return MFP.Server.invokeHttp(input);
}

Here, when I print JSON.stringify(tag), it prints only "AB". Please let me know the way to access all passed values from client code.


回答1:


For Javascript adapter, you need to modify your procedure's method signature to include the parameters you are sending.

For

var resourceRequest = new WLResourceRequest("/adapters/AdapterNewGet/getFeed", WLResourceRequest.POST);
var formParameters={"params":"['AB','CD','EF']")};   
resourceRequest.sendFormParameters(formParameters).then(app.onSuccess, app.onFailure);

in your client code, change the Javascript adapter to :

function getFeed(arg1,arg2,arg3) {

  MFP.Loggerinfo(arg1);
  MFP.Loggerinfo(arg2);
  MFP.Loggerinfo(arg3);
  .....

  return MFP.Server.invokeHttp(input);
}


来源:https://stackoverflow.com/questions/43287348/reading-sendformparameters-params-for-js-adapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!