Read adapter procedure requestTimeoutInSeconds from worklight.properties file - ibm-mobilefirst

I am developing a Worklight 6.2 application wherein I have a requirement to read parameters from worklight.properties file.
I have successfully read below parameters and set them.
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>${adapter.protocol}</protocol>
<domain>${adapter.domain}</domain>
<port>${adapter.port}</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="200" />
</connectivity>
But I am unable to set procedure requestTimeOutInSeconds attribute from worklight.properties file as below.
<procedure name="procedureName" requestTimeoutInSeconds="${procedure.timeout}" />
Can I set this using properties from worklight.properties?

That is indeed one of the parameters that you cannot 'externalize' to worklight.properties in order to read its value from a variable.
You can submit a feature request here: http://developer.ibm.com/mobilefirstplatform/help

Related

IBM Mobilefirst Java Adapter to connect Couchbase

Can we connect to Couchbase DB thorugh Mobilefirst 8 Java OR Javascript SQL adapter? Please suggest alternative option if available.
You can use a MFP 8.0 Java adapter or Javascript HTTP adapter and use it to make REST calls to the Couchbase DB.
Yes it is possible to connect any NoSQL DB(Couchbase DB) using MFP 8.0 JavaScript or Java HTTP Adapters,making use of REST calls.
Here is an sample example which connects to IBM Cloudant NoSQL DB using MFP 8.0 JavaScript HTTP Adapter.
AdapterSample.js file -->
function getDocByKey(key) {
var path = '/my_database/'+key;
var input = {
method : 'get',
returnedContentType :'json',
path : path
};
return WL.Server.invokeHttp(input);
}
adapter.xml file -->
<mfp:adapter name="AdapterSample"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mfp="http://www.ibm.com/mfp/integration"
xmlns:http="http://www.ibm.com/mfp/integration/http">
<displayName>AdapterSample</displayName>
<description>AdapterSample</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain> <-- DB URL here--> </domain>
<port>443</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<authentication>
<basic/>
<serverIdentity>
<username> <--DB Username here--> </username>
<password> <--DB Password here--> </password>
</serverIdentity>
</authentication>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
</connectionPolicy>
</connectivity>
<procedure name="getDocByKey" secured="false"/>
</mfp:adapter>
Click here for more information https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/

IBM Mobilefirst: Issue in calling a service from adapter with basic auth

I have a service call thats being called from my adapter and that particular service call is being protected by Basic auth. So I am adding the following code in adapter XML to help all the service calls from this adapter to do the Basic Auth validation.
<wl:adapter name="adapter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.ibm.com/mfp/integration" xmlns:http="http://www.ibm.com/mfp/integration/http">
<displayName>adapter</displayName>
<description>adapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>myweb.com</domain>
<!-- <port>443</port> -->
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<authentication>
<basic />
<serverIdentity>
<username>123-123-123-123</username>
<password>12334445!</password>
</serverIdentity>
</authentication>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
<!-- Following properties used by adapter's key manager for choosing specific
certificate from key store <sslCertificateAlias></sslCertificateAlias> <sslCertificatePassword></sslCertificatePassword> -->
</connectionPolicy>
</connectivity>
<procedure name="procedure1" securityTest="wl_unprotected"
connectAs="server" />
<procedure name="procedure2" securityTest="wl_unprotected"
connectAs="server" />
</wl:adapter>
When i trying hitting service by using the above xml it gives me Invalid Authorization. But when i added it manually to the header of my service call in the js code it gets through as below.
headers: {Authorization: "Basic MTIzLTEyMy0xMjMtMTIzOjEyMzQ1NiE="}
can some body help me in understanding what could be the issue. Will there be some issue if i keep special characters in the XML. How do i make it work.
Thankyou.
An adapter request with the Authorization header will be sent only if the destination service returns 401 or 403 first. If you are able to change the response code of that service, this may be a solution for you. Otherwise, continue with adding the Authorization header as you do, which as you say seems to work.

How to set the pre-emptive auth value in header value in adapter implementation file in mobile first 7.1?

I am using authentication header in the IBM integration bus, so to call the IIB service from mobile first adapter, I am using the following values in adapter.xml file. IIB service is expecting pre-emptive value, so how to set that value in adapter.xml
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain></domain>
<port>443</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<authentication>
<basic/>
<serverIdentity>
<username></username>
<password></password>
</serverIdentity>
</authentication>
<maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
<!-- Following properties used by adapter's key manager for choosing specific certificate from key store
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>

giving the host url dynamically in mobilefirst adapter

Hello all I need to pass the host name or url for the adapter dynamically from the client side.i.e when the user login he needs to type the url which will be set to the ${domainname} in the adapter.xml file.help needed pls.Thnks in advance
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wl:adapter xmlns:wl="http://www.ibm.com/mfp/integration" xmlns:http="http://www.ibm.com/mfp/integration/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SoapAdapter1">
<displayName>SoapAdapter1</displayName>
<description></description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>${domain}</domain>
<port>8001</port>
<connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
<socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
<maxConcurrentConnectionsPerNode>2</maxConcurrentConnectionsPerNode>
</connectionPolicy>
</connectivity>
<procedure name="userlog"></procedure>
</wl:adapter>
Those are not changeable values during runtime. You cannot decide dynamically where will the adapter connect to after the adapter has been built and deploy.
You could try Andrew's suggestion here: IBM Worklight - How to change dynamically domain/hostname to which the adapter connects from the client at launch or runtime?

What should be the value of maxConcurrentConnectionsPerNode in worklight adapter

I am developing IBM Worklight application. On production, application has about 1-2 thousand users. What should be the value of 'maxConcurrentConnectionsPerNode'?
In adapters the value of maxConcurrentConnectionsPerNode is 2 (default).
Application response is good while number of users are less but on heavy load(thousands of user), users are facing issue of connection with sever .
In addition, Backend databases are little bit slow.
<wl:adapter name="Authentication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>Authentication</displayName>
<description>Authentication</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>blank</domain>
<port>80</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="pro1"></procedure>
<procedure name="pro2"></procedure>
<procedure name="pro3" securityTest="appSecurityTest"></procedure>
</wl:adapter>
If you are asking for performance suggestions then this is not the place for it, and is wholly dependent on your specific machines and their setup.
I suggest that you will read the following materials and make educated changes based on it:
https://www.ibm.com/developerworks/community/blogs/worklight/entry/tuning_worklight_server?lang=en
http://www-01.ibm.com/support/knowledgecenter/SSHS8R_6.3.0/com.ibm.worklight.dev.doc/devref/r__maxConcurrentConnectionsPerNode__element_.html
http://dw.developer-works.com/article/10013142/Recommended+value+for+maxConcurrentConnectionsPerNode
search more online...