how to set the environment variables in CAF

Hi,

I am working on a CAF project in webmethods version 8.0.
After binding the connector to the fields, I tried to publish it to the MWS and checked the page.
But it threw ACCESS DENIED error.

After a bit of research, I manually changed the web.xml values(wsclient-socketTimeout, wsclient-username, wsclient-password) and it worked. But I think its not a good practice at all.

How can we fix this issue without manually changing anything?
Please reply as it is bit urgent.

Regards
Jyoti

Hi Jyoti,

bind these in the designer to variables “${…}”.

You can then set those values in MWS using sysadmin to the correct values after deployment.

Administration Dashboard -> CAF Application Runtime -> -> Environment Settings

You can even modify the endpoint-address here.

See CAF_Development-Guide for further information.

Regards,
Holger

1 Like

Hello,

There are multiple ways to set values you use for the IS calls

  1. directly on the property bindings

private static final String[][] MYISCALL_PROPERTY_BINDINGS = new String[][] {
{ “#{myISCall.authCredentials.userName}”, “Administrator” },
{ “#{myISCall.authCredentials.password}”, “manage” },
{ “#{myISCall.endpointAddress}”, “http://localhost:5555/soap/rpc” },
{ “#{myISCall.socketTimeout}”, “500000” }, };

  1. in the web.xml as you did

  2. in configuration files
    wsclient-endpointAddress=http://localhost:5555/soap/rpc
    wsclient-username=Administrator
    wsclient-password=manage
    wsclient-socketTimeout=500000

In this case you will need also to have a class that reads the configuration files and saves the values in a Properties object maybe.

  1. As Holger mentioned above.
    However please note that the change you make in this way will require an application restart.

Hope it helps,
Vlad

1 Like

Yes Turian. We set the variables in web.xml file. I just wanted to know if that is the correct way.

Thank You
Jyoti

Hi Turian/All,

My code has been deployed to UAT IS.
My doubt is:
I have my CAF project in the DEV designer, and the connector is referring to the DEV URL right now.
How to migrate this project to UAT or is there any way to change the end point of the connector to UAT URL so that the UIs work fine in UAT environment.

Regards
Jyoti

Hi Jyoti,

when you have assigned the environment variables during design time as described by Vlad, they are pre-populated with the DEV values upon “Build And Upload”.

After Deployment to UAT MWS you have to change these under the SysAdmin User:

Application Dashboard -> CAF Runtime Configuration -> Search
Search for your application in the list (might not be on the first page)

You will find the entries under the Tree-Item Environment Settings.

Change these and apply them to the CAF Application.
Application will reload after that and from now on will use the modified parameters.

This only has to be done on the first deployment but should be checked thoroughly on subsequent deployments.

Regards,
Holger

Hi Holger,

I had set the environment variables in the web.xml file.
As you suggested, I tried first in DEV environment.
What I found is, In Admin Dashboard -> CAF Runtime Conf -> Environment setting, the values are coming from web.xml only.
I changed the web.xml values to some other values and the Admin Dashboard -> CAF Runtime Conf -> Environment setting values are getting changed.
So it does not work.
Could you please check.

Regards
Jyoti

Hi Jyoti,

as the web.xml gets deployed together with the application it will be overridden by any subsequent deployment forcing you to do the changes again every time after a deployment.

We prefer the variant to define the variables in designer and assign them to the corresponding bindings.

What happens if you change the values in the CAF runtime config and restart the application?
Are the new values persisted or are they reverted to the values in the web.xml?

Regards,
Holger

Hi Holger,

Yes.
The values are getting changed to the values mentioned in web.xml file.
Can you please suggest something.

Regards
Jyoti

I have deployed everything on to UAT now.
The UIs are working fine and showing the results which is because the connectors are still pointing to the DEV server I guess. Please correct me if I am wrong.
I need to change the URL of the connectors to the STAGE server.

Regards
jyoti