Author Message
VishweshwarG
Joined: Dec 21, 2013
Messages: 107
Offline
Hi,

I am using web services in my DD application. There are around 35 web services which I am using through WSOP.

Both UAT and production end pint URL's are different. So, each and every time whenever I am moving application to the production I have to change the web service end point URL's.

So, I need to find a solution where all the web service end point URL's can be configured in a properties file and the property file will be different for both UAT and production.

If anyone have code ready with you it will much helpful to me

DD version 5.1

Thanks in advance....
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
You can easily set a dynamic endpoint for a WSOP. First, open up the Java file corresponding to the WSOP. By default it is located at:

<PROJECT_ROOT>/WEB-INF/src/connectivity.ws.operations

The name of the file is also, by default, the same as the WSOP. Inside the file, scroll to the bottom of the constructor and find the line that reads:


//}}END:CLASS:CONSTRUCTOR


Anything that comes before that is autogenerated and custom code will get overwritten if it is inserted there. After the above line, you can set your endpoint as follows:


endPoint = "http://customURL.com/WebService";


Addressing the properties file idea, the above line will set the URL to be whatever you want. So, you can just use some Java to open up a file and read in the URL from there, rather than typing it in string format. There are a ton of ways to open a file, but basically the end of the constructor would look something like:


//}}END:CLASS:CONSTRUCTOR

BufferedReader in = null;

try {
in = new BufferedReader(new FileReader("C:\\customURL.properties"));

endPoint = in.readLine();
}
catch(Exception e) {
e.printStackTrace();
}


You would have to modify each WSOP's Java file, though, as there's no single place where you can change all of them.
VishweshwarG
Joined: Dec 21, 2013
Messages: 107
Offline

I need to try this code ... Thank you very much Samaresh...
Go to:   
Mobile view