I have an existing application (say 'A') and I want to call a java function of this app from another app 'B'.

I don't want to put dependency of this app('A') in my calling application('B') to avoid running 'A' at multiple places.

We thought of exposing 'A's function as a web service, which can be called by 'B' by putting dependency on the 'A's client.

What is the efficient and easy way to do this.

Thanks in advance.

有帮助吗?

解决方案

Depending on the type of service:

  • SOAP service: JAX-WS
  • RESTful service: JAX-RS, Spring-MVC

Either way, you put a couple of annotations on your class, and configure the framework to expose the service (refer to the documentation of whichever you choose)

其他提示

Have a look at Jax-WS. I don't know what's easier :D You can annotate methods with @WebMethod and deploy your work onto a application server - and there you go!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top