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.

5
  • 1
    making a HTTP call might prove to be very cozy Commented Feb 5, 2013 at 9:12
  • making a HTTP call might prove to be very cozy , on the other hand the other alternative you mentioned is not really the way to do it Commented Feb 5, 2013 at 9:13
  • @HussainAkhtarWahid Thank you. I wonder if sending a http request might bring some overhead compared to calling it directly in a Java-ish way than Servlet-ish way ? Commented Feb 5, 2013 at 9:15
  • actually with my experience the converse is true , rest i hope the genius race from stackoverflow may give any superlative advice Commented Feb 5, 2013 at 9:17
  • The standard version of Tomcat does not have support for EJBs, you need to use TomEE, or plug OpenEJB into Tomcat to use EJBs. If you are using Spring already then you can consider that Spring remote invoking option. Commented Feb 5, 2013 at 9:38

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

He asked about invocation without using HTTP calls, the standard implementation of REST web services is also over HTTP.
OP asked what is the right way and I think this is a perfect use case for web services.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.