How can i expose a web service in Grails made with Java? - web-services

I need to expose a web service in my Grails application but made in Java, the reason to this is that any of the Grails plugins for web services, does what we need, but after looking at Spring services, I know is possible, after all Grails is made upon Spring
Note that I'm speaking of a Service as a Web Service, not a Servlet, a SOAP to be exact. If I don't find a way to do this in Java, my superiors are pointing to .NET and I really going to hate doing that going to .NET from Java is just wrong.
=== Software currently used ===
-> Grails Version 2.4.3
-> WebService type must be SOAP I have no other choice since my superior does not like REST
-> Spring 4
-> IDE is Intellij

Related

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.

Nunit - XML based Data provider

I have used TestNG & Selenium for Test UI Automation
For .NET web services testing http web requests can be used to do functional testing
Has any one tried web services automation using Nunit ? Does it support passing data parameters in XML (Data Driven Testing) like TestNG?
Any experience/guidelines with WCF / ASPX 2.0 Web services functional test automation using Nunit if you can share would be helpful
Thanks,
Siva
I like to think about Web Services, WCF Services as another kind of interface to my business logic. And I only unit test my logic.
There is nothing specific in NUnit for testing WCF or Web Services.

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.

Java EE and Grails: Communication with WebServices? Which framework?

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.