Spring and SOA application - java

I'm new to WEB SOA applications and i have several questions about how to implements this architecture.
I would like to make a SOA based application involving multiple services using spring restfull api.
I'm aware of how to build each service itself.
i've already made a maven based project exposing a restful service using spring boot and secured it using spring security... my problem is to implement several services:
I don't know if i have to make a project for each one or there's a better solution... i want them to communicate through XML/Json so they won't be in same project in my point of view.
All secured by same service which makes use of spring security, i don't know how to link between the security service and the other ones. i don't want to write same security config classes on each project and then the user would be asked for sign in each time he accesses one of the services.
Share some resources which are used by all most services such as domain model classes, since i don't want to copy paste them (make duplicates), if i would change anything i would have to make changes in all services ... horrible :/
Thanks in advance.

1- Secure them all (the entire application) using one service which
make use of spring security and which will be asked for whenever a
client access one of the services.
This link will help you : https://www.youtube.com/watch?v=3s2lSD50-JI
2- Share some resources which are used by all most services such as
domain model classes.
Here it is about how to organize your project in your IDE or in your architecture. Using packages, shared libraries, shared projects or maven modules can help you.
3- Deploy all services inside one " application container ".
Your IDE or Maven should be able to help you deploy you application in a container. In the case of Spring Boot, there is an embedded Tomcat server that can run your application. Or if you have your Tomcat stand alone installation, you can deploy it by your self.
Reading you post, I guess your are new in Spring Boot development. The learning path I can suggest is the following (in my point of view) :
N-Tier Pattern for application architecture, and the purpose of the layers
The architecture of the Web and HTTP protocol
SOA and REST Services
Maven to build and compile your projects
Spring Boot, in mostly moderns architectures used to implement Backends my exposing REST Services
You can find by Googling tones of well explained documentations and blogs concerning those subjects.

Related

ReactJS proxy URL for localhost API in PROD when bundling with Spring Boot

I'm trying to bundle ReactJS and Spring Boot API together and build one fat jar. In every tutorial I read, I'm told to put the localhost API URL as a proxy in package.json of the React app like below.
"proxy": "http://localhost:8080"
As I obviously don't have PROD deployment experience with this, is this the way to go when you are deploying in PROD? Else, please guide me in the right direction. I couldn't find the answer anywhere.
Also, any cons in doing so in a medium sized project with two developers? Appreciate any input.
The "proxy" field should only be used in development environment when the Webpack dev server is first in line(to enable the Hot-Reload feature)
Here is a guide from 2018:
spring + react guide
regardless there are two main way of hosting the react app:
inside the spring boot Jar a static resource(you can use frontend-maven-plugin to run yarn/ npm again see the guide),
the advantages of this method is security, you don't need CORS enabled to serve the page.
the disadvantages is convenient this solution require more code, also the spring boot server handles UI serving to the client that requires extra calls to the server(spring first approach)
the other option is to host it in a hosting service like amazon S3 and then it will be hosted not in spring but in s3 and will be the first in line(UI first approach), you will need to enable CORS in spring boot app, but this is a more continent solution.
ps. I would read some guides first, it would help you with general understanding

Is there any possibility to add a module to a web service deployed on Tomcat without terminating the existing web service

I have developed a web service using spring mvc and hibernate. Currently I couldn't find a solution to add a module to the running web service without terminating it. My intention is to develop the web service as modules and plug modules in runtime. In .Net the solution is developing the program using MEF (Managed Extensibility Framework) the DLL's. I developed some solutions using OSGI framework but I found some practicability issues existing. Please help me to find an applicable solution for the scenario.
deepening of your plan. this is possible with OSGI by registering the new modules as Services and tracking all services in the Framework's service registry by using ServiceTracker
You can deploy the external module as a another app onto the container/server. And leverage JNDI for resource sharing. https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html

Which Java Spring components needed for Spring-WS?

I have Eclipse Kepler installed and working properly on Mac OSX. I'd like to install Spring in order to design, write, deploy a RESTful web service.
I see a plethora of components listed on the update site, and little guidance on what I do/don't need in order to just get started.
Do I need :
SpringSource DM Server Tools?
Spring IDE Core Developer Resources?
Web Flow?
If you have Eclipse installed then just follow the tutorial: Building a RESTful Web Service
http://spring.io/guides/gs/rest-service/
It provides details of the Maven/Gradle configuration that you need which will ensure that the correct dependencies are imported.
Note that it makes use of Spring Boot, which in turn will import dependencies required by Spring MVC. You don't need Spring-WS for REST web services. Spring-WS is for building SOAP web services.

Java Web Service - Has it to be in a new project?

As you can see, I'm really starting learning about Web Services and, in all examples I've seen, a new Web Project is created to implement the Web Service.
In my case, I already have a Web Application implemented and I need a WS to an Android app for this application. So, my question is: can I create the WS in this project or do I have to make a new project for that?
Any help will be apreciated, thanks.
Can I create the WS in this project or do I have to make a new project for that?
It depends on your design. Any web application can be the producer of the web services, so yes, you can use your current web application to host the services. But, there will be more requests to your application since there are new clients apart from internet browsers, so if your application is prepared to handle lots of requests, then do it. IMO it should be a different web application since they have different purposes, even if they use the same business services and data access layers, so if your main web application is undeployed for maintainability purposes, then your web application that hosts the services can be still up and running smoothly.

Spring WS and UDDI

I have a bunch of web services implemented in Spring-WS 1.5.9. We use Maven to do our builds, our services run on OC4J that have a UDDI provider.
What we want to do is to start using UDDi internally to register our web services to allow other groups in the business to find and use them.
The problem is that I've not been able to find how to actually put this all together. How do I get the services to register them selves when they are deployed to the app server.
Spring doesn't seem to have any support or annotations. There doesn't appear to be a maven plugin.
I've got all the pieces but how do I put these together into an automated solution?
For service discoverability, Spring-ws provides the DestinationProvider interface to locate the edpoint of a service at runtime. You can use the Wsdl11DestinationProvider class to retrieve the endpoint from a WSDL available or you can implement your own class by extending AbstractCachingDestinationProvider using UDDi access libraries.
For the automatic publication, I am aware of Mule Galaxy wich is a Service Registry solution (not based on UDDI but on ATOM/REST) that provides connectrs to automatically import artifacts from Maven for example.
You could use UDDI4J it let you interact with uddi servers :)
Check out Apache jUDDI. It has annotations that youc an use to automate the registration process. I'm not sure what you mean by "internal use only" but can you run optionally run the full server in embedded mode without a web container) or it can be ran within Tomcat, Jboss, and most other containers.
Example: http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/uddi-annotations/
There's also a number of other solutions, such as WS-Discovery, mDNS, ebXML etc.

Categories

Resources