Share Web Services in different projects

Asked

Viewed 58 times

2

I have 2 designs, using Restfull Jersey:

  • Projectox
  • Projectoy

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

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

We use the following flow:

Usuariowebservice -> User appservice -> User -> User

The problem is:

  • I create a third project Projectoglobal to place these layers including the Usuariowebservice
  • Or I create a third project with only the last 3 layers and a Usuariowebservice to the Projectox and another to the Projectoy ?

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

  • Young, first thing: what language? Click [Edit] and add the language tag.

3 answers

0

I recommend that you create or deploy a server in your application Oauth2. This is done very well in large companies like Google and Facebook, in addition to giving a much greater growth possibility in its application.

If you are using Java and decide to make modifications to one of your projects, I recommend using Spring Security and Spring Security Oauth2 to develop within the project.

If you decide to create a new project use Spring Boot, and if I don’t know what to do I left a guide on how to create an Oauth server with Spring.

I also recommend reading and deepening your knowledge in the project Oauth 2.0 and implementation of Spring Security in both your projects so that everything works in the best possible way.

I left some links at the end of the reply that will possibly help you.

I hope I helped. Hug!

Observing

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

Links that can help you

0

The purpose of the solution is not well explained.

To clarify: The user to be returns in the request below (fictitious) would be the same or different?

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

If it’s different, the user domain is likely to evolve differently in projects, so I wouldn’t reuse the code. They’re just separate projects with different codes. For example: if you put a specific project-x field for the user and it was mandatory, you would have to do the modification and deploy it in the project-y, which would make no sense.

If the expected return was the same, it makes sense to reuse the implementation (or part of it). What’s strange, from an architectural point of view, is two distinct projects doing the same thing for the same entity (reading/writing). If the project-x and project-y used user services, the most indicated is that the services of these projects use a "user-service.jar" in their service layers.

[]s

-1

jbueno, most likely he 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 pattern of DTO projects, ideally you would put your service isolated from X and Y projects and share only the Dtos.

This with a superficial view of your problem.

  • Gustavo, the response location can only be used to post answers. Remember Stack Overflow in English is not a forum. When you have enough reputation points, you can comment on any publication. Until then, I would advise you to try to answer answers that do not require further information from the questioner. You can better understand the use of the site on [tour] and [help], you can also see [Ask] and [Answer]. By the way, welcome to [en.so]!

  • I updated the description. Check if now I was more objective. Vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.