File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Distributed Java and the fly likes Client Accessing another client in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Client Accessing another client in java" Watch "Client Accessing another client in java" New topic
Author

Client Accessing another client in java

Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Hello,

How can one client access another client in java assuming the two clients are two seperate web applications?

Regards,
Padma priya N.G.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Usually the clients don't talk directly to each other. There would be one central server, which would act as a data disbursement point (among other things)
What problem are you trying to solve and why do you wish the clients to talk to each other directly


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Such communication should be avoided but a web application also has a client-server component within itself where the client are typically html based pages and the server side has Servlet based classes. You can make your webapplications' server sides communicate using HTTP based integration methods e.g REST (or plain HttpURLConnection classes) or other web available protocols like websockets.
Tim Cooke
Bartender

Joined: Mar 28, 2008
Posts: 858
    
  42

You'll need to provide some sort of API to your applications for them to use to communicate with each other. Something like a REST or SOAP API, or perhaps some sort of Message Bus. Because they are two separate applications, web or otherwise, you will not have direct access to its classes to be able to just call into a Java class.

Edit: Also, what they said. (You guys type faster than me)


Tim Driven Development
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Assuming that the two applications are soap based applications in the same machine, should I use the context root of the first application in the url to access it from the other application

Thanks,
Padma priya N.G.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Padma priya Gururajan wrote:Assuming that the two applications are soap based applications in the same machine, should I use the context root of the first application in the url to access it from the other application

Thanks,
Padma priya N.G.


Generally yes but depends on how you are accessing the applications.
This is an integration solution design so you should take a step back and solve this as an integration problem just doing what works.
Are the applications deployed on the same server? Should they be in an ear file instead and share a common service layer? Is there a chance of the applications being deployed on different servers in the future? What data are the applications accessing from each other (Generally web layers do not have business processing so it is rare to need to call another web application from another)?
So then, what are you trying to access from the other web application here?
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
The applications are on the same server. One application is trying to use the services of another application. Is it possible to specify it in the url directly after deploying?
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Padma priya Gururajan wrote:The applications are on the same server. One application is trying to use the services of another application. Is it possible to specify it in the url directly after deploying?

See ALL the questions I asked above.
Padma priya Gururajan
Ranch Hand

Joined: Oct 05, 2006
Posts: 434
Both the applications have dynamic web projects. They can be run alone. How can one application access another application?
 
jQuery in Action, 2nd edition
 
subject: Client Accessing another client in java
 
Similar Threads
JDBC and RMI?
Architecture Help
Using badges to authorize web app access
Tricky question (How to pass javax.ejb.Handle)
Connecting Access Databases remotely?