I have written a SOAP based web service which runs fine on a Tomcat server. The Web Service service itself is a Spring MVC based web service that runs on the Tomcat application server.
Now i need to write a Thick client which will be a standalone Java app that will use the services of the web service. I think i am correct in that the client only needs to know about the service details (i.e. operations) and nothing else.
What i am not sure of is the architecture and environment i should use for the client. The client application will be based on Swing but is it possible to use Spring with Swing together?
On the web service i have the following setup
view --> Service --> Model
The client application is basically a configuration tool. It uses the web service to configure user accounts. This means that the client application does not actually write anything to any database. It just uses the services of the web service to make changes to 'user account' and probably view list of accounts.
My question really is
- Is an MVC design suitable for such a use case
- Usually Spring is used for web based applications. Is there any benefit in using Spring with the Swing based client?
- Are there any alternative or better solutions/design/architecture that would achieve the same?
An example showing Spring used in conjunction with a Swing application would be very usefull.
Thanks in advance.
Spring MVC is not appropriate for a Swing-based client. Use the core Spring framework and a JAX-RS implementation like Jersey to provide simple REST web services in tomcat. Jersey also provides a corresponding client API that you can use within your Swing application to invoke the REST services.
If you have decided upon Swing as your platform, there are two options you can look at:
(1) Net Beans Rich Client Platform
http://netbeans.org/kb/trails/platform.html
(2) You can roll up your sleeves and write your own app using a low level yet extremely flexible framework called Swixml
http://www.swixml.org/
Give Swixml a good try before you try others, it may surprise you.
You can implement Swing-based thin client application with Spring Integration backend serving as a integration tier. It can expose gateways accepting simple Java types or DTOs. Your Swing presenters / controllers interacts with these components in order to call remote webservices.
Related
I have developed a Spring Boot Web applications. I have provided REST API's for users to interact with the server.
Now i want to write application for admin to interact with server, in the sense change the data in database. I know i can do REST api with admin role and do a authentication and authorization. But currently i have made front end application with python and this i will like to change later on to angular.
So, as of now i don't want to create extra REST api's and the logic around it. Is it possible to create a Swing GUI with the spring boot web application ? So, admin can directly interact with the database.
I can create a separate GUI application for admin, to interact with database, but i have already defined entity and mongorespository in web application. I would like to use the same and not maintain two copies of same.
Yes, you can call REST APIs from a Swing application using JAX-RS.
There are some resources here. In particular, note the section on RESTful Java clients
https://mkyong.com/tutorials/jax-rs-tutorials/
I have a Spring web application and an standalone application written on C#. Only Spring application has an access to DB, so I want to implement data exchange between Java and C#. The data isn't large (100KB / Min or so). Application will be placed on the same machine. What is the best way to integrate a communication? Does Spring Framework has a module to work with?
Spring certainly does have a module for doing this, it's called Spring Integration. You can define inbound and outbound channels/gateways and before the data comes in or out do any transformation on it needed to get it in the right format. Pretty standard functionality for doing enterprise integration.
Alternatively if that's too heavy weight you could expose a RESTful webservice in the spring application using the #RestController annotation and call that api from C# application. Another alternative would be to expose a spring-ws Web service in the spring application and write a Soap client that calls it in the C# application.
We are developing a java application which provide web services through SSL. This application is running in Tomcat server.
The purpose of web services is insert, update and select data. So under web service tier is implemented backend tier, which provide access to database.
Suddenly we were asked to build swing application which will also access the data in database. We want to use the same backend (exactly the same runtime) which is used for web service application. How to reach this goal?
I see following possibilities:
use web app instead swing application, which will be part of the same project like web service application and then it will be able to connect backend
Provide some extra web services for swing application only.
Use JMX. It is possible run JMX on Tomcat. Backend could provide functionality through JMX and Swing application could connect it.
Each of these possibilities have advantages and disadvantages. We followed solution 3 and I think it wasn't a clever selection. JMX has problem with generics, you can run only one JMX on tomcat etc.
Java world is rich and there should be some optimal solution for this situation. Could you help?
Add a web service client to the Swing app and let it make exactly the same calls to web services that a browser based UI would.
You're certainly free to add extra, Swing-only web services if you choose.
I didn't think JMX was anything other than a way to allow you to monitor MBeans using a JConsole. What does that have to do with Swing?
We have the following architecture in mind:
To an existing application, we would like to add a web service front end.
The web service will be used from a web portal, which runs on a different web server.
So, we will not use a database on this different web server and just forward entries from the web portal to the web service and show what the web service returns.
First question: what do you think about this architecture?
Second question: Can you recommend a java framework for this web server?
On the second question: one possibility is to use WSRP with Java Portlets.
I currently have a full java web application stack (J2EE web app using Spring and Hibernate with a RIA client using dojo).
I have to move technology stacks for the UI to be asp.net but am allowed to keep the server components in java.
Any ideas on best practice here - and yes, I have to adopt this hybrid tech stack.
Initial thoughts are:
asp.net ajax (possibly using asp.net MVC) to provide the UI and a thin control layer in IIS.
expose current java web app (residing on a remote machine) as RESTful web services (the web app would remain in a J2EE serlet container such as Tomcat or Jetty). The new control layer would provide security (authentication and authorisation), comet server push abilities and then basic request passthrough to the web app.
Basically, I am unsure 'how much' C# I should write in the control layer and how best to expose and communicate with the existing java web app. Also, currently, I use JSON as the data interchange format.
I would suggest you start moving to asp.net feature by feature, don't try to implement everything at once.