问题
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