I'm tying to create a system that allows EAR applications to register into another EAR application to receive certain Web Services requests. Lets call this the Main EAR and the Plugin EAR.
The logic for this would be:
1 - Main EAR starts
2 - Plugin EAR starts
3 - Plugin EAR sends it's configuration to Main EAR (with it's allowed request types)
4 - External application sends a request to Main EAR
5 - Main EAR checks to see if it's able to handle the request and if not, sends it to Plugin EAR (if it's on the allowed request type list)
6 - Plugin EAR handles the request and responds to Main EAR
7 - Main EAR responds to the External application with the information handled by Plugin EAR
To implement this I created a WS on the Main EAR that receives (among other parameters) the requests that the Plugin EAR can handle, it's context root and the IP:port, but the problem is obtaining the Plugin EAR incoming port.
Already tried the following solutions, but they are to server specific, and I need to be able to get this working on WebSphere and JBoss:
Get the server port number from tomcat with out a request
org.apache.catalina.ServerFactory.getServer() equivalent in Tomcat 7
There would be an easy solution that was to add the port (since all the other parameters are easily obtainable) into a configuration file and then send it. But I'm trying to reduce to the maximum the number of configuration options.
So I'm wondering if there's another way to make the EAR communicate with each other? Or is there any other way to discover the Plugin EAR incoming request port?