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

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>

Related

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.

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?

Read adapter procedure requestTimeoutInSeconds from worklight.properties file

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

Worklight SAP Netweaver GateWay Adapter - Client ID

Currently we are using the Worklight SAP Netweaver GateWay Adapter to connect to our development environment of SAP. Our customer has configured two client environments 101 and 211. The default is 101.
When creating a connection based on the following adapter configuration...
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter xmlns:wl="http://www.worklight.com/integration" xmlns:nwgateway="http://www.worklight.com/integration/nwgateway" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SAPAdapter1">
<displayName>SAPAdapter1</displayName>
<description></description>
<connectivity>
<connectionPolicy xsi:type="nwgateway:NWGatewayHTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>10.9.5.27</domain>
<port>8000</port>
<serviceRootUrl>/sap/opu/odata/sap/services_x_y_z/</serviceRootUrl>
<authentication>
<basic/>
<serverIdentity>
<client>211</client>
<username>xyz</username>
<password>123</password>
</serverIdentity>
</authentication>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="10"/>
</connectivity>
<procedure name="getShipments"/>
</wl:adapter>
We assume to connect to client 211, but apparently we are connected to 101.
How is the client-id handled by the Worklight SAP NWG Adapter?
This has been identified as a defect in the product.
There is no available workaround.
To receive an iFix containing the fix for this defect, you need to open a PMR (support ticket).
Please mention this question as well as APAR #PI31148 in your query for reference.

Worklight [adapter-deployer] SEVERE: Element <port> must be a number

Currently in the environment being used, the port is not available to be specified all the time. Within my xml <connectivity> settings, the <port> will be blank.
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>worklightserver.test.com</domain>
<port></port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
When calling
<adapter-deployer deployable="test.adapter" worklightServerHost="http://192.168.1.9:8080"/>
I get the error:
[adapter-deployer] SEVERE: Element <port> must be a number.
Is this a bug in worklight? I would assume that if a port is not specified, it would use the proper port depending on the protocol specified. With a port specified, it works as it should
HTTP protocol can work on any port, not necessarily 80.
Port must be always specified.