How to implement REST API for already developed Spring java Project (it has service and DAO layer alone no controller)
I asked this in general how should implement REST API in spring java project.
I have developed Spring + hibernate project i want to implement REST API on that how can we do that can anyone explain me with an example that should call Service Layer -> DAO Layer to persist or retrieve from DB.
If you are asking a spring-styled framework to export your DB service as a RESTful web service, the spring data rest project may helps you.
Related
Does any of you know any approach or tools to implement Consumer Driven Contracts with SOAP web services? I have a legacy Java application that publishes SOAP web services, implemented with Apache CXF, which are consumed by a bunch of Spring Boot Java microservices. I’m already using Pact and Spring Cloud Contract to test my REST calls between the microservices, but could not find a way to use these same tools, or any other, for SOAP web services.
There is JavaSeifenBenutzer
a project to create Soap/Xml support for pact-jvm via a reverse proxy that converts XML to JSON and vice versa
You can use Spring Cloud Contract with MockMvc and RestDocs to build stubs of the XML service. Then you have to package the stubs in a jar for other people to reuse it and that's it.
I am pretty new to spring and currently I was able to create a complete web service with spring-ws. Now I want to separate the functionalities of my web service in to two separate web services. But except the service layer there are other spring components (business layer) which are common to both of these services.
So my question is there a way to make spring web service depend on another spring project (business layer)? If you can provide such example or a tutorial where a spring web service depends on another spring project it will be really helpful.
Thanks in advance.
UPDATE
I could achieve above by building my business layer as a jar file and adding it as a dependency to the service. But now my supervisor wants me to deploy the business layer in a separate server. But I could not find any information on how to handle communication here between web service and the business layer. Any idea?
We have have an application who have a service and dao layer. It use spring 3.2
We started to create a new web application who use spring 4 (client side and controller).
What could be the best technology to communicate both application? Both are not on the same server.
I know there is spring remoting, but I don't know if it's still a good solution.
I'd recommend exposing the service layer using contract first SOAP or REST web services. They'll be reusable by any client that can make an HTTP request, including your new app.
Spring remoting is a fine solution and only takes a few minutes get set up.
I've created a "framework/toolkit" for a specific type of database search. This was done with Spring-Data JPA using hibernate. This framework is usable by standalone desktop app or as a web application.
This framework ships with entity classes, Spring-Data Repositories and a transactional Service layer with optional method level security (spring-security annotations).
now I would like to create a web application using this framework. Since grails is from spring to and also uses hibernate I thought this might work but I'm open to other suggestions.
The entities in the web application will extend such provided by my framework and should use spring-data repositories extending repositories provided by the framework and services extending provided services for data access.
Or said otherwise I'm mainly interested in the scaffolding part (controller and CRUD web pages) and not the data access part. I'm open to any other tools that can achieve this.
Is this possible with grails? Other suggestions? Spring Roo?
I have an Apache Axis web service that handles file uploads and enters and retrieves information from an Oracle database. It has all the functions my Spring MVC app needs. What I want to know is, how would I go about calling the methods from the web service in my application and giving them the parameters they need to work?
Use wsdl2java to build your client stubs which are Java classes that you call.