Web Services sharing on different projects

2

I have 2 projects, using RestFull Jersey:

  • ProjectX
  • ProjectY

And the User module, this module is responsible for making GET, POST, REMOVE to manipulate User information.

This module is shared between these projects. But written in different Tablespaces, but with the same table structure.

We use the following stream:

UserWebService - > UserAppService - > BabyUser - > UserID

The problem is:

  • I create a third ProjectGlobal project to place these layers including WebService
  • Or do I create a third project with only the last 3 layers and a UserWebService for the ProjectX and another for the ProjectY ? >

I need to understand what's best from a technical point of view.

    
asked by anonymous 19.05.2016 / 16:30

3 answers

0

I recommend that you create or deploy a OAuth2 server in your application. This has been done very well in large companies like Google and Facebook, in addition to giving a much greater possibility of growth in their application.

If you are using Java and decide to make modifications to one of your projects, I recommend using Spring Security and < a href="https://projects.spring.io/spring-security-oauth/"> Spring Security OAuth2 to develop within the project.

If you decide to create a new project use Spring Boot , and if you are not sure what to do, a href="https://spring.io/guides/tutorials/spring-boot-oauth2/"> How to create an OAuth server with Spring .

I also recommend reading and deepening your knowledge in OAuth 2.0 and implementing Spring Security in both your projects to make everything work as well as possible.

I left some links at the end of the answer that might help you.

I hope I have helped. Hugs!

Note

OAuth 2.0 has other forms of implementation in its documentation and does not work only in JAVA as I may have let you understand. So if you're using another language, just look at the examples available on official website .

Links that can help you

12.06.2016 / 16:35
0

The purpose of the solution is not very well explained.

To clarify: Would the user to be returned in the below (fictitious) request be the same or different?

GET http://projeto-x.meudominio.com/usuario/1
GET http://projeto-y.meudominio.com/usuario/1

If different, it is likely that the user domain evolves differently in the projects, so I would not reuse the code. They are simply different designs with different codes. For example, if you put a specific field of the x-project for the user and it was mandatory, you would have to do the modification and deploy in the y-project, which would not make any sense.

If the expected return is the same, it makes sense to reuse the implementation (or part of it). What is strange, from the architecture point of view, is two distinct projects doing the same thing for the same entity (read / write). If project-x and y-project uses user services, it is best to have the services of these projects use a "user-service.jar" in their service layers.

[]'s

    
12.06.2016 / 17:56
-1

jbueno, most likely it is using Java ...

Jorge, you need to better explain the functionality of the user module, this can greatly influence your decision.

However, I advise you to take a look at the standard DTO projects, ideally you should put your service isolated from the X and Y projects and share only the DTOs.

This with a superficial view of your problem.

    
19.05.2016 / 16:48