Trying to identify worklight adapter requests from web server access logs, but all the requests look really generic. Any idea how to identify adapter requests?
The Request only contains "POST /Worklight/apps/services/api/MobileApp/android/query HTTP 1.1". I
can't see the adapter name nor procedure name.
while this query is indeed an adapter invocation , the adapter name, method and parameters are embedded into the POST HTTP message body. its not a big payload (less than 1KB).
I'm not an IHS log expert, but maybe there is a way to log also message body.
( I saw this un-answered: https://stackoverflow.com/questions/27354942)
However, if you upgrade to newer MFP version (v7.0+) then you can expose adapters as a RESTfull service. This will make the IHS logs much more clear which adapter was called (each one has different URL).
Related
I have created REST API for POST HTTP and import it to Mule applications then deploy it to CloudHub and used that URL in Shopify Webhook then trying to get data but unable to get data from postman...
Is this a correct way to use Webhook in Mule applications...
Since Mule runtime doesn't has a concept of webhooks there is not a correct or incorrect way to use them. Mule applications can listen to HTTP requests. If another system sends an HTTP request to the correct URL that the Mule application is listening it should work. To the Mule application it doesn't matter if it is coming from a webhook, another application, Postman or whatever HTTP client implementation.
I am trying to invoke worklight adapter from external application. I also got the answer in Calling Worklight adapter from external app thread. However I dont want to send adapter name, procedure name and parameters as query params. Rather, I want to send them as payload inside request body. Pls suggest answers.
If you were using MFP v7.0+ you know that each MFP adapter is exposed as a REST API as well.
you just need to remove the security so external applications can access that REST API easily.
Not sure if its healthy to reduce security.
but you can mark the (via the adapter xml file) method as "wl_unprotected"
Is is possible somehow to access the httprequest inside the code of the adater?
The root reason for asking this is a bit tricky...
I need to know the ip of the worklight server to use it later in the app for other uses.
From the app I have not found any API that could help.
Detect Worklight Server Hostname/IP Address from Worklight Client code
In the server it was possible using the WL.Server.configuration["local.IPAddress"] to get the ip but that was static and now there is no "local.IPAddress". Any way this is static.
Using J2SE API is possible to access to the network interfaces but as there can be more than one it is not the best option.
I was thinking about using the httprequest getLocalAddres method that return the ip being invoked.
Thank you
If you're talking about httprequest from client to WL server - yes, it is possible. you have WL.Server.getClientRequest() API
If you're talking about httprequest from WL server to backend - no, this is not possible. Adapter is used to abstract the need for direct usage of HTTP client internals.
I am using the client side API WL.Client.InvokeProcedure(invocationData, options, UseSendInvoke) in worklight 6. But I could not find a description for the parameter UseSendInvoke in the API. Do you guys know what it is?
This parameter is used internally by WL authentication framework. Technically there should not be a reason for developer to use it.
There are several ways to invoke adapters.
(1) First one is via client application. This is where you use WL.Client.invokeProcedure(invocationData, options) API.
(2) Second is by using adapter invocation service - http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fdevref%2Fc_adapter_invocation_service.html. Basically issuing an http request to WL server and getting a response from adapter. RPC style.
When you're doing it via (1) - you have two authentication layers - first is security test defined for application, second is security test defined for adapter procedure.
When you're doing it via (2) - there is only one security layer - security test defined for adapter procedure.
UseSendInvoke param (which is, once again, for internal usage) means that your application will go via path (2) instead of regular path (1).
There's no UseSendInvoke argument that WL.Client.invokeProcedure takes, at least not in the public API defined in the documentation. You can look at the documentation for Worklight v6.0.0, Worklight v5.0.6, Worklight v5.0.5 to learn more about that particular API.
First off I'm not too familiar with restlets , just starting out. I wanted to implement a broadcast chatroom where a client sending a message would have the message broadcast to all other clients.
My attempt was to use a resource on the server side where the client would send the message(as a String) using POST. The other clients would constantly have to poll this resource to receive the message. I know this method must be horribly ineffective.
I was wondering if there was a better method where a change on the server side(in this case the sending of the string message) would result in the server alerting the clients of this update.
Some things will come in version 2.1 with the new nio connector. Within web page, you might consider using technologies like Comet or HTML5 web sockets.
See the specification page from the developer wiki of Restlet: http://wiki.restlet.org/developers/172-restlet/g3/354-restlet.html
Thierry