I have SOAP web services for Application 1 available to me. And, I'd like to implement a Java application that translate Application 1's Web Services calls to Application 2's JMX API. So App 1 can manage a bunch of operations through App 2.
If I understand the problem correctly, I want to build a SOAP/JMX Proxy (Remote Proxy design pattern) as my translation layer. This means it will receive SOAP requests and translate them to JMX, forwarding the translated request and then do the inverse to return the response.
Do you have suggestions on this approach and if there is another way to proceed? Any pointers/corrections are highly appreciated.
Epitaph, this looks like a repost of your same question Ideas on how to approach a project involving Integration of APIs. In essence, it is the proxy pattern. Your web services are just calling another object via the JMX API.
Related
I've restful web service. I created a restful java client which can abstract connection details and expose beans to set the data. Now what happen if my web service has to be consumed by different platform than Java ? Wouldn't it had been better to avoid the client itself and let consumer make direct HTTP call ?
WADL (https://wadl.java.net/) is the WSDL-equivalent for RESTful services, however, it is not very widely used by now.
Edit: A reason why it might be not popular can be found in this article: http://bitworking.org/news/193/Do-we-need-WADL
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.
We are seeing Spring in school right now but we don't have the time to wait till the end of the semester to start developing an application. We continue using an app we made last year, and are writing the service layer right now.
The problem is our "client" wants to have a desktop client and a webpart, which used the same dtatabase. This would be no problem if we hook up a server that can handle RMI. So basically we want to be able to retrieve/send data to the server that runs our service layer, and use the objects on the client side as well.
I have no idea where to start digging in Spring to figure out how to do this, so some help would be appreciated.
PS: At this point I do not need MVC yet. MVC is handled from within the desktop app where we have views and controllers.The model is the same from the one on the service layer. How do we use the same model without copying it?
Check out spring remoting: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html
It's easy to expose your spring beans remotely, using a variety of protocols.
You might want to take a look at the REST paradigms. With this in mind you could have a web server running your server part of the application and communicating with clients through the HTTP protocol. A simple client could be a webpage in the browser which gets the corresponding HTML pages from the server, or a Swing client which communicates over JSON with the server.
The server can implement different methods for JSON or HTML communication and the server can decide what implementation to use by looking at the Accept Header of the Request objects sent to it, that's what they call Content Negotiation
JSR-311 is implemented as Project Jersey which is a framework for RESTful webservices. You might want to take a look at that.
hope that helped
i intent to replace wcf service with some java service . how should i design my wcf service such that it's gets replaced or can be replaced with the java service later such that i dont have to do any work or very little work on the client i.e on my silver light application .
any idea's / suggestions?
P.S
1. that is the reason i am not using RIA services.
2.my wcf service should work like wcf data services work. it should allow me to do CRUD operations on my entities.
Create java services using Apache CXF or Apache Axis. Deploy those services in Tomcat server. You can easily create client proxies for those services by using adding service reference in Silverlight Client application. Now you can consume the webservice from silverlight.
The standard answer is this: use the BasicHttpBinding on the service. Don't add anything else to it. Most other stacks support BasicHttpBinding just fine.
Alternatively, use a WCF REST endpoint and standardize on consuming JSON. Then, your service can be PHP, Ruby, Java, or anything else.
Basically I need webservice where client can request with id one boolean value from our webservice. What technology would be most suitable for this small API? Of course it is possible that there will be more functions to interface, but now we need only one function. It also needs to have authentication, so that only auhtorized clients can access service. And every client have different auth credientials.
What would be good technology for this purpose?
I am using resteasy to build my webservices and it is pretty easy to use ... just need to use annotations on my methods to deliver the webservices.
Here is a comparison of different JAX-RS frameworks. Take a look at it
First of all: authentication and authorization. Don't do it yourself, pick an app server or servlet container and configure it to do the job.
For the web service....
The simplest thing to do it just implement a servlet that responds to a POST (not a GET if request modifies internal state) and returns the result in the body. This way you don't need any frames works, no learning to do (if you already know servlets). The downside is it won't scale as you add more features, and your not using enough buzz words.
If you want a SOAP based webservice, then look at JAX-WS. Now that it's backed into java 6 it's pretty easy.
At the simplest level JAX-WS lets you put a few annotations on your class, like #WebService, and it auto generates a wsdl and exposes an instance of your class via the web service.
There is plenty of documenation out around how to do it:
http://java.sun.com/webservices/docs/2.0/tutorial/doc/
http://www.java-tips.org/java-ee-tips/java-api-for-xml-web-services/developing-web-services-using-j.html
http://cwiki.apache.org/GMOxDOC20/simple-web-service-with-jax-ws.html
JAX-WS + any servlet container (Tomcat is usual choice)
#WebService(targetNamespace = "http://affinity.foo.com", name="RewardsStatus")
#SOAPBinding(style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.LITERAL)
public interface RewardsStatusIF {
#WebMethod(operationName="GetLastNotificationDate", action="urn:GetLastNotificationDate")
#WebResult(name="return")
public Date getLastNotificationDate() throws AffinityException;
...
Actually, you don't even need a servlet container. JAX-WS has a way to run the service under a standalone Java application. It has some limitations (I have failed to make a stateful service work), but it's
very simple to create.
Given that you tagged your question as "Java", I suggest Jetty. It is a very good small servlet engine. It has support for sessions, so adding authentication should not be a problem.
If you are using Java 6, there is already a HTTP Server builtin, it supports Http authentication. That's all you need. Check out,
com.sun.net.httpserver
You could use some restful framework like jersey.
An alternative to SOAP-based web services with JAX-WS would be JAX-RS (for RESTful web services).
We have a lot of scenarios on our project where we want small amounts of data available via simple HTTP URLs while the app is running and in my experience, Restlet (http://www.restlet.org/) seems to be one of the easiest things available for setting up simple "web-service"-like interfaces (RESTful interfaces) within Java apps.