1

I've got 2 different web applications running.

'Web application A' has all the business logic layer services.
I need to invoke methods defined in 'Web application A' from 'Web application B'.

How can I use services(or methods) from 'Web application B' without sending
a http request ?

So far I've found that you can invoke a java programme as described in this question.
Execute a Java program from our Java program

I wonder which one is the right way. Call method by sending a http request or call some method directly.
Could you also tell me which one is better, and why ?

Edit
Could I use Springframework's remote invoking ?
http://static.springsource.org/spring/docs/2.0.x/reference/remoting.html
Which one is more desirable. Spring remoting or EJB ?
We are using Tomcat.

Community
  • 1
  • 1
Ascendant
  • 827
  • 2
  • 16
  • 34

2 Answers2

1

Remote EJB invocation is the standard way to make a call between two applications in the Java EE world.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Bogdan
  • 934
  • 7
  • 13
0

I thing RESTful Web Services is the right way of doing this. You will just expose some of your classes and method as a service and some other application may call them whenever it wants. See this very basic tutorial from Oracle.

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
  • He asked about invocation without using HTTP calls, the standard implementation of REST web services is also over HTTP. – Bogdan Feb 05 '13 at 09:40
  • OP asked what is the right way and I think this is a perfect use case for web services. – Petr Mensik Feb 05 '13 at 09:47