0
votes

We are using Worklight 6.2 developing an Hybrid application. Currently we need to pass custom body parameters from the client to the worklight server when we invoke an adapter.

Is it possible to add custom body parameters (next to the defaults: adapter, procedure and parameters) in the invocation of an adapter from from an Hybrid client (Javascript API)?

Thank you in advance for your help

2
Can you define what is a "custom body parameter" and how does it differ from any parameter that you would normally pass to the adapter procedure? - Idan Adar

2 Answers

0
votes

WL.Client.invokeProcedure does not allow for custom parameters.

Then again, why would you send these to the Worklight Server specifically?
Perhaps you mean that these parameters are parameters you need to send to a backend server?

What you could do is simply send those as a set of parameters to the adapter procedure, where you will place those as described in the HTTP adapter tutorial.

// ...
// handle the parameters... 
// ...

var input = {
        method: 'post',
        returnedContentType: YOUR-RETURNED-CONTENT-TYPE,
        body: {
            content: PLACE-PARAMETERS-HERE,
            contentType: 'text/xml; charset=utf-8',
        },
    };

var result = WL.Server.invokeHttp(input);
0
votes

This may not be of much help since you are on 6.2, but in MFPF v7.0.0 (Available now), we introduced RESTful access to adapters, including support for all verbs (GET/POST/PUT/DELETE/...) and parameters types (query, body, headers, etc).