We are using WL.Server.invokeProcedure to call procedure between two Javascript adapters. Basically we are doing adapter mashup.
How Mobilefirst calls WL.Server.invokeProcedure procedure either GET or POST.
responseData = WL.Server.invokeProcedure({
adapter: "ServiceAdapter",
procedure: "storeDocuments",
parameters: [params],
});
The above code doesn't have method parameter. We are facing issue for large payload where procedure calling fails for large JSON parameter object.
Is there any other way to pass large payload.
When adapter mashup happens, adapter1 constructs a REST url of adapter2 and fires it. This call will reach adapter2 as if originating from an external client.
You can try out the JNDI property mfp.adapter.invocation.url and set a local url here , such that REST call stays internal to the system . This way the calls should execute faster and you should be able to carry more payload.
Set the JNDI property with a locally accessible URL including the context root.
For example:
mfp.adapter.invocation.url="http://localhost:9080/mfp"
Modify the value to suit your environment.
More details here.
Related
We are building a PDF report using OpenPDF which prints client logo dynamically based on the url passed by the calling client.
Scenario:
A print request is received, it also has logoURL as a parameter.
Then in one of the steps while processing the request, this url is passed to Image.getInstance(logoURL) of the OpenPDF's Image class, which either returns a proper image or an exception. If exception occurs we fall back to a locally stored standard logo.
I wanted to know if this approach is secure to let the calling api or client send a url, and then we use that internally to download an image. If this is not the right approach, what is a standard way of achieving this.
I have to expose a ReST API that will perform some operation and write the data in a CSV file. This is a very long running process so I want to make it asynchronous so that when client call this API it will simply return status code 202 and then run in background and write data on the csv file.
I was trying to use CompletableFuture with ResponseEntity<?>.
Is there any better way of implementing this without CompletableFuture?
I have a method createFileInBackground(FileInputData fileData) that will write the data in CSV file.
CompletableFuture<ResponseEntity<?>> cf = new CompletableFuture<>();
cf.complete(createFileInBackground(fileData);
return cf;
Now the first question is - Will the complete() method run in a separate thread?
The issue which I am facing is that the client receives status code 500 instead of 202. with below exception in log-
java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "true" to servlet and filter declarations in web.xml.
I am not using Spring Boot.
Any help would be highly appreciated.
I have an existing SQL adapter used to get some data from the DB server, a simple query that returns a language.
I want to call it from an HTML page, to display the page in the language returned from the adapter.
I'm trying to call it before the dojoConfig object is created because it sets the locale, that then it's used by dojo to do the internationalization work. Is there a way to call the adapter synchronously so it executes before the dojo configuration happens? I mean to catch either the success or failure response before a dojoConfig object is created.
How could i invoke it?
Worklight APIs can only be used once wlCommonInit has been called.
If you can delay/postpone/set dojoConfig on the success callback of the adapter call, then this may be your way out of the problem you have encountered.
This might sound a bit crazy but is there a way to call a procedure synchronously?
I am using MobileFirst Platform Foundation 7.1 and I am writing an app in javascript for the browser. I usually call my javascript adapter by:
WL.Client.invokeProcedure({
adapter: 'MyAdapter',
procedure: 'myProcedureName',
parameters: []
}).then(function(res) {
...
});
But in this particular case I need to open another window after getting some data from the server. Since browsers will block windows when they come from async ajax my new windows does never open.
A way to solve this would be to do the ajax request sync. Is this possible with WL.Client apis? Is there a way for constructing the request manually so I can set the sync ajax flag by myself?
PS: in my case doing sync ajax request would work nice since I show a "Loading ..." view on top of everything to prevent user interaction while the request is being done.
WL.Client.connect() does not support .then. Additionally, starting 7.0 you should use the REST API method WLResourceRequest: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/server-side-development-category/
Lastly, you could just put the second request in the onSuccess callback of the first...
I am calling a public adapter procedure and have assigned securityTest="wl_unprotected" to it. If I call the procedure via URL, it works fine, but when calling from device/app then it's not working...
What could be the reason?
As discussed by email, the issue is not in the way the adapter procedure is being setup in the adapter XML, but IMO in the way the client-side code is handling it.
This question is not so fit to Stackoverflow...