Search code examples
javaweb-servicesapiaxisxfire

Efficient and easy way to expose an existing function as web service


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.


Solution

  • 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)