IBM MobileFirst - Properties files - ibm-mobilefirst

I have a MobileFirst APP, calling three web services, when I call these Web services, using an IP (localhost), but when I connect my mobile PC have to use another IP calls, and then have to use other production.
To make it easy and comfortable setup, as I can do in MobileFirst, it is the worklight.properties file?
Greetings and thank you,

That's some crazy English going on there...
If your question is really "can I save the web service IP address (that I am using in my adapter XML file) in a variable in worklight.properties, so that different IPs will be used for my adapters in different environments (DEV, QA, PROD)" - yes.
I believe that in this case JNDI properties will not help, but you could do the following.
You will need to create a different copy of worklight.properties per the environment you want to test at, and in each file add custom properties, for example:
myWebServiceIP=192.168.123.1 (you'll need to change this value per file)
Then in the adapter XML file, use it like this:
<domain>${myWebServiceIP}</domain>

Related

Openshift PHP application - Virtual Host

I have a php application on openshift. This main application is actually made of 2 different parts: Students & Employees. As I want to keep the code clear and separate for each (even though they share some common data), I need to create Virtual Host in Openshift.
After the user logs in, depending on what his setting was - I want to direct him to either the student or the employee management section. For example say my main application is https://manage.example.com, when the user logs in I want to be able to direct him to a virtual directory(host?) such as
https://manage.example.com/student OR
https://manage.example.com/employee
I am a little new to web related development but I 'assume' that Virtual host may be the right thing? If yes then any clues or leads on how to set up Virtual hosts on Openshift as I understand I have limited access to server configuration files on Openshift.
You will not be able to create more virtual hosts on OpenShift Online for one application, however, there are a couple of other routes that you can go.
You could create two separate applications (each having their own gears) and run each part of your code on a different application. If you need to share a database between them, make sure that you create one of them as scaled (the one you add the database to). Note that these two applications will not share a filesystem.
You could setup each application to run in it's own "subdirectory", something like you had proposed above, you should be able to easily setup the different routes in your application, this would also allow the applications to share a filesystem.

Worklight Server Configuration on different WAS Server

We have a scenario where we have different app servers like Dev/QA/Stage/Prod and all have different configuration settings (Which normally every Org have) like hostname/portno/jndi etc
My questions are:
What is the best way to deal with different environment server (Dev/QA/Stage/Prod) with different config settings.
Where and how can we set these properties for the worklight project?
Also can we set some configuration file in Worklight project with different environments so that it can change the hostname/port at run-time depending on the environment.
If any one have done this before, please guide on this and if feasible provide any sample file. If someone answer question no three (3), that will help me alot.
Thanks
It is possible to manage different worklight environments using multiple copies of worklight.properties ( eg worklight.properties.STAGE etc) and changing the settings in there for the target environment. This way when you build for each environment the required settings are picked up.
If you do not want to build for each environment you can uninstall the worklight war file and reinstall it by setting jndi properties with required environment variables. This will create entries in the server.xml file that correspond to settings in worklight.properties
Also you can use <include optional=true>additionalServerConfig.xml</include> in the server.xml for was and store configurations for each environment in separate xml files for the given environment and import them using this include mechanism.
Here is a link to some slides I put together on setting some of these things up
https://slides.com/donalspring

How to specify default glassfish-web.xml?

I have a situation where I need to specify some properties in glassfish-web.xml (like
session-properties & cookie-properties) that needs to be applied to all web application that are deployed under that domain.
One option is to create glassfish-web.xml per web-application. This is fine if there are only a few web applications on a domain.
However as these properties are common across all web applications I am wondering if there is a way to specify these configuration at glassfish server domain level (like default-web.xml) that are applied to every web application deployed.
If you are using Glassfish 3+, put the configurations desired in [GF_HOME]/domains/[yourdomain]/config/default-web.xml
Take a look at: https://docs.oracle.com/cd/E19798-01/821-1752/beagc/index.html

Web Service Reference to reportservice20xx.asmx on a distributed application

I have an .Net webapplication which connects to a reporting web service.
In my development studio, I just add an webreference, then specify the path where the reporting server is installed and reportservice2010.asmx is found and ready for use.
But i do not know how to deal with it, after my application is compiled.
When I would like to distribute it on lets say 100 different servers.
The path to reportservice2010.asmx may(and surely will) change.
Of course what will make my application corrupt.
Please help !
When you added the web reference, Visual Studio should also have added a new section to the application's configuration file. That section specifies the environment-specific details of the web reference.
If, for any given target environment, the target address of the web reference changes then you can simply change the URL in the application's configuration file.

Getting configuration strings from Weblogic

This question is related to Weblogic 12c.
I have an EAR file that I want to deploy in various environments (dev, QA, pre-prod and prod). However, my application requires a username and a password (to connect to another server) and they're not the same across the four environments. I don't want to package 4 different property files in 4 different EAR files. I want a single generic EAR file. Beside, I don't want to handle the prod password during packaging.
Ideally, I'd like the admin of each environment to provide the appropriate username nad password for the environment. Unlike Tomcat, Jetty or JBoss(?), I think it's not possible for a WebLogic Admin to specify this information in a way that it will become available under the java:comp/env JNDI context.
How can an application obtain some admin-defined configuration strings from Weblogic?
BTW, it's not a username/password for a JDBC connection.
From what I understand, you need to change parameters based on the environment you are using right?
If you would like to override parameterss on the fly you can use WebLogic deployment plan concept.
Did you mean that you need to provide username/password to start-up the application?
If so, you may accomplish that by creating a script with WLST http://docs.oracle.com/cd/E15051_01/wls/docs103/config_scripting/using_WLST.html
As far as I know, the WebLogic way is to
Define your username/password as env-entry in the deployment descriptor
Deploy your application together with the plan.mxl whereas each environment admin maintains his own envrionemnt-specific version of the plan.xml
That way you get them into /comp/env/config
More details here: http://docs.oracle.com/cd/E11035_01/wls100/deployment/config.html
Only drawback known to me: plan.xml will always contain the unencrypted password but as the admin knows the password anyway and this is "his" file on "his" maschine that should be fine.