Java equivalent to WCF Data Services - java

Is there anything in Java that's the equivalent of WCF Data Services ?
Does Spring have the capabilities to expose databases as a RESTful web service like WCF Data Services ?
Thanks !

These are two separate capabilities - database access and REST web services - but Spring indeed has both.
You can access databases in Spring using JDBC, Hibernate, TopLink, or iBatis.
You can expose web services as SOAP using Spring web services or RESTful web services using Spring 3.x.
You can put the two together to achieve your stated goal.

Related

Data exchange between Java (Spring app) and C#

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.

Integrate REST Web Services with Spring Integration

I have implemented Restful web services using spring technologies. Now, I need to integrate these services to work together on the same context using spring integration.
How To make web services methods as endpoints ? How can I realize the coreography of web services ? How It is possible to transform messages exchanged between web services ?
The spring-integration tag has links to lots of resources.

Are RESTEasy, JAX-RS just tools to develop RESTful web services?

I'm learning about RESTful web services and there is a lot of terminology jumbled up in my head. Can someone briefly provide a distinction between the following technologies.
RESTEasy
JAX-RS & JAX-WS
Jersey
Restlet
JAXB
If I want to develop a RESTful web service and have that web service be consumed by an Android app, which technologies from the above should I use? I do not want to use SOAP...
Can someone briefly provide a distinction between the following
technologies?
JAX-WS (JSR-224)
This is the Java standard for SOAP web services which are different from RESTful web services. There are multiple implementations of this standard.
JAX-RS (JSR-311)
This is the Java standard for RESTful web services. There are multiple implementations of this standard which include:
Jersey (http://jersey.java.net)
Restlet with JAX-RS Extension (http://wiki.restlet.org/docs_1.1/13-restlet/28-restlet/57-restlet.html)
RESTEasy (https://www.jboss.org/resteasy/)
JAXB (JSR-222)
This is the Java standard for converting objects to/from XML. All JAX-RS implementations leverage a JAXB implementation when the JAX-RS service returns Java objects that need to be converted to/from XML. Some even leverage it when converting to/from JSON. There are multiple implementations of this standard.
Project JAXB (http://jaxb.java.net)
EclipseLink JAXB (MOXy) (http://www.eclipse.org/eclipselink/moxy.php)
If I want to develop a RESTful web service and have that web service
be consumed by an Android app, which technologies from the above
should I use?
Any Java EE 6 compliant application server will all the components necessary to create a RESTful web service that can easily be consumed by an Android app. Below is a series of articles I wrote that should help:
Part 1 - The Database
Part 2 - JPA Entities
Part 3 - JAXB Bindings
Part 4 - The RESTFul Service
Part 5 - The Client
JAX-RS are mainly used for web services but you can use it as servlet as you like.
I have used Jersey with Freemarker to develop frontend website and it works perfectly.
I have seen some projects which use Jersey as backend web services and backbone.js to develop frontend website.

Client architecture for calling Spring based web service

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.

Why can't i create a RESTful web service in ejb module?

I am using Netbeans 6.8. I can see an option to create a web service in my independent ejb module but i can't seem to find an option to create a RESTful based web service in my ejb module. Is there any kind of restriction in ejb module that i can only create SOAP based web service and not RESTful? or is it the bug of Netbeans 6.8?
Chapter 2.6 of the EJB3 specs:
To support web service
interoperability, the EJB speciļ¬cation
requires compliant implementations to
support XML-based web service
invocations using WSDL and SOAP or
plain XML over HTTP incon- formance
with the requirements of the
JAX-WS[32], JAX-RPC[25], Web Services
for JavaEE[31], and Web Services
Metadata for the Java Platform [30]
speciļ¬cations.
In other words: EJB3 can be exposed only as SOAP web service.
REST is just HTTP, usually implemented with servlets, so it would naturally be added to a WAR file that may or may not be packaged into an EAR with EJBs.
I don't believe that EJBs know or care about SOAP or REST. EJBs use RMI as their communication protocol of choice.
I found an article about EJB 3.1 and JSR-311 REST but I've to admit that I never tried it.
Write a wrapper class to the EJB which you are going to mark it as restful webservice with Jax-rs annotations with support of CXF rest api or Jersey api.

Categories

Resources