Java EE and Grails: Communication with WebServices? Which framework? - web-services

Hy, I'm developing a Grails app which has to communicate with an existing Java EE application (built with EJB2).
Both the "legacy" app and the new Grails app will offer services and consume them.
For intercompatibility reasons, I'm thinking of communicating using WebServices. Now I'm wondering which frameworks I should use on both sides.
Since the Java EE application now runs under JDK5, I could use JAX-WS on I guess it would make sense to use Metro (https://jax-ws-commons.dev.java.net/grails/) on the Grails side. Does anybody have experiences with that? Or other suggestions?

If both the Grails and EJB applications live on the same LAN then there is nothing wrong with using RMI. Its the default way of talking to EJB's, is native to Java and is supported in Grails.
If you need to use Web Services then your container will have built in support for exposing the EJB's as Web Services (assuming J2EE 1.4 or later). Which container are you using?
If you cant use (or don't trust) the containers WS support then its best to pick a framework that you can use in both applications, thereby avoiding compatibility issues. Metro has worked well for me standalone but I haven't tried it with Grails.
Also there are more lightweight ways of exchanging XML messages than full SOAP'y Web Services. Hessian and Burlap are examples, plus Spring has its own HTTP messaging framework.

Related

Call EJB 3.1 from EJB 2 client

I need to develop a server side component to accomplish some internal task for my company.
We have a Java EE scheduler application deployed on WebSphere 6.x that will be my client application.
I'd like to write my server side component with EJB 3.1 or with another Java EE 6 compliant technology.
Can I generate a legacy EJB 2.1 client for my component with maven?
Is it better to use another solution like web services and let the scheduler generate his own client?
Other ideas?
I'd suggest using Web Services. EJB will involved RMI/IIOP and serialization. Since you will have 2 different servers, JDK versions you may have much more troubles using EJB integration. If communication is asynchronous, you could also consider JMS.

Difference between Axis2 webservice and CXF web service

I would be grateful if any one help me to understand the difference between axis2 web service and CXF web service.
The main differences between axis2 web service and CXF web service are as follows:
CXF has support for WS-Addressing, WS-Policy, WS-RM, WS-Security,
and WS-I BasicProfile. Axis2 supports each of these except for
WS-Policy, which will be supported in an upcoming version.
CXF was written with Spring in mind; Axis2 is not.
Axis2 supports a wider range of data bindings, including XMLBeans,
JiBX, JaxMe and JaxBRI as well as its own native data binding, ADB.
Note that support for JaxME and JaxBRI are still considered
experimental in Axis2 1.2. CXF currently supports only JAXB and
Aegis; support for XMLBeans, JiBX and Castor will come in CXF 2.1.
Axis2 supports multiple languages--there is a C/C++ version
available in addition to the Java version.
In comparing these frameworks, though, it's just as important to look at their approach to developing web services as it is to compare features. From a developer perspective, both frameworks behave very differently from one another. Axis2 has taken an approach that makes it in many ways resemble an application server in miniature. Axis2 comes packaged with a WAR that can be deployed on a servlet container such as Tomcat that is designed to make web services easier to manage and deploy on the fly. The Axis2 Web Administration module allows Axis2 to be configured dynamically while applications are running--new services can be uploaded, activated or deactivated and their parameters may be changed. The administration UI also allows modules to be enabled on one or more running services. The only downside to using the UI for these purposes is the fact that configuration changes made through it are not persistent--they go away when the servlet container is restarted.
Axis2 lends itself towards web services that stand alone, independent of other applications, and offers a wide variety of functionality, and a good model for adding more functionality as time goes on through its modular architecture. Some developers may find that a little too cumbersome or heavy-duty for their needs. These developers might prefer to look at Apache CXF.
CXF concentrates on developer ergonomics and embeddability. Most configuration is done via the API instead of cumbersome XML files, Spring integration is heavily emphasized, including support for Spring 2.0, and CXF's APIs and Spring configuration mirror one another fairly closely. CXF emphasizes code-first design, using simple APIs to make development of services from existing applications easier (and its embeddability helps too).
Whichever framework you choose, you'll have the benefit of an active and stable open source community. Each of these frameworks has corporate backing: Axis2 is backed by WSO2, and CXF by Iona. Both have lively developer communities. Axis2 has been around longer but CXF is catching up quickly. My recommendation is this: If multilanguage support is important, Axis2 is the clear choice. If you care about an implementation focused on Java with tight integration into projects like Spring, CXF is a better choice, particularly for embedding web services inside of other programs. If the new features in these projects are not important, and you're relatively happy with Axis1, you should consider staying on this and keep up with the latest maintenance releases until you have a business reason to migrate.

Webservices for Spring 2.5.5

I have web application designed using spring 2.5.5 MVC, JBoss server. I want to expose my spring services (like add/update User, comments, documents, etc.) using WebService for EAI. Requirement is like any third-party application should be able to perform operations in my web application after authentication/authorization.
I have novice knowledge of SOAP (Axis2) and REST (Jersey), however i am not sure which will be best suited for my application.
Cheers
We are using Spring 3.0 actually. But former using Axis2 with Spring 2.5.x.
You might review our stack at http://incubator.apache.org/openmeetings the axis.
We simply integrated the regular Axis2 configuration into the web.xml and build a Facade to load the spring beans into the Axis enables Web-Service and forward the calls to the Spring enabled context that way.
Comparable to https://svn.apache.org/repos/asf/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/FileWebServiceFacade.java
It is not the perfect solution, the Axis2 documentation also contains other ways to load the Spring context in the Web-Service enabled class, however it was never possible to make that work stable so we decided for this workaround.

WCF service with Qt?

I would like my Qt app to expose a service to another app written in .Net using WCF.
Is there any support in Qt for implementing WCF services?
AFAIK there is no 'native' Qt support for WCF or extensions; however as you know WCF can consume and expose a web service (in addition to a WCF or remoting service, etc.) All you need to do is expose it as a Web Service for the other .NET app to consume.
But that brings up an interesting aspect; usually you would write a windows service (I presume you are on Windows) which is exposed as a Web service rather than one via Qt. Qt is not ideal as it is a GUI framework (and a very good one); you will get into a few interesting situations as discussed here. It is usually easier to consume a web service with Qt as shown in this example.
Do you have the option to expose your service using some other stack such as ASP.NET or WCF or Java?

How to deploy a Java EE project that has web services

I already have an enterprise Java EE application. I want expose some of the existing EJBs as web services.
I wanted to know how to organize the Java EE project. I mean where does the web services sit in the Java EE EAR file hierarchy and how to invoke the deployed webs services?
It depends upon exactly how you implement your WebService and also on which Java EE version you are using. Simplest, with JAX-WS your webservice implementation and interface are all packed in the WAR. See the sun tutorial. Possibly you may implement your service as an EJB and in which case you can simply use the #WebService annotation. In which case you're delivering the EJB jar.
Recommend you work through a few tutorials for the specific App Server you are using.