Resource for learning the details of Java Web Services? - java

I'd like to build a Java Web Service using JAX-WS and GlassFish 3. All of the guides showing the basics of Web Services in Java using tools like wsgen and wsimport to generate a lot of the boilerplate code to implement the Web Service. Is this just how it is done or does anyone know of some resources that go into more of the details?

IF you want to learn from the very beginning:
Heavyweight Web Services (SOAP/RPC) with JAX-WS
SOAP Contract (WSDL) and the Contract-first vs Code-First debate
Lightweight Web Services (RestFul) with JAX-RS
RESTFul Contract (WADL)
Web Service Deployment (Frameworks + JAX-* deployed in some App Servers)
Web Service Clients (i.e. usage of wsimport)
Introduction to Web Service Security, Addressing, etc
I recommend you Java Web Services. Up and Running by Martin Kalin. After that, if you need to go further with one of these subjects, I suggest you to get any of the 'cookbooks' published by O'Reilly.

Good starter point is Official Java EE Tutorial.

Related

How to decide on what framework to use in Java Web Service?(SOAP)

I am fairly new in Java EE web service. Right now we have a project to create an API web service that connects to a database and do some retrieve and write functions.
I've heard about the following:
Axis
Struts
Spring
Can someone please enlighten me as to what framework is applicable for the said project? I've tried Google of course but I need opinion on people who have experience on the said framework.
BTW we are going to create a SOAP web service. Additional tips are also appreciated.
Note that Java has the JAX-WS API which is a technology for building web services and clients that communicate using XML. In JAX-WS, a web service operation invocation is represented by an XML-based protocol, such as SOAP.
From the frameworks you mentioned, Spring brings SpringWS which you can use to build a SOAP web service.
However i don't know about Struts 2 core api offering any SOAP capabilities.
But it can be extend with other plugins that handle SOAP.
Axis (use the latest, Axis 2) is a good choice for SOAP. It is a Web Services / SOAP / WSDL engine. It also has some support for the Spring Framework.
There is also Apache CXF. It is the most widely used Web Services Standard Now; Improvement over AXIS2, which is now gradually being replaced by Apache CXF
If you need help deciding between them, read this comparison (Apache CXF vs. Apache AXIS vs. Spring WS) for the pros and cons.
There's also this great answer about cxf and axis 2.

How to create RESTful service with GlassFish 4?

I've come from a C#.NET development, have developed and implemented RESTful services in Visual Studio with WCF hosted on IIS, but now I need guidance on one of my project requirement, to develop RESTful service with GlassFish Server Open Source Edition 4.0 (not Oracle GlassFish), found here:
https://glassfish.java.net/download.html
I have no idea about Java and GlassFish, so if any tutorial post or video provided will be highly appreciated. What all sorts of application software do I need to install and what will be the development environment? I mean every step involved in the process of developing in GlassFish.
Also is there any way to develop RESTful service in C#.net and deploy on GlassFish 4?
I've done REST web service with C# and with Java and, basically, both technologies are quite similar. I would recommend you to spend some time learning the servlets, understanding then and with your knowledge of web services you will find no problems to implement your service.
Additionally, yopu could also take a look to the Java technologies specifically implemented for REST like "JAX-RS: Java API for RESTful Web Services" (https://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services). This may help you, but I would begin with the basics of a servlet and the servlet container (GlassFish).

what actually JAX-WS is?

I need to work on webservice project. So going through book to cover the basics of webservice project. But these are questions I am struggling with:-
1.Java API for XML Web Services(JAX-WS):- JAX-WS is nothing but just a java programming language API for creating web services which is now a part of core java starting from version 6 (though originally developed as part of Java Web Services Development Pack). Is it right?
2.All other webservices framework whether it is metro, jersey, glassfish uses the JAX-WS internally. Is it correct?
Q: 1.Java API for XML Web Services(JAX-WS):- JAX-WS is nothing but just a java programming language API for creating web services which is now a
part of core java starting from version 6 (though originally developed
as part of Java Web Services Development Pack). Is it right?
It is correct, JAX-WS is an application programming interfaces (API). That API, together with the JAX-WS reference implementation (JAX-WS RI, RI = reference implementation) is a part of JDK since version 6. To extend a little bit, JAX-WS 2.0 is included in JDK 6 from the beginning, JAX-WS 2.1 comes with JDK 6u4, and you will find JAX-WS 2.2 in JDK 7 (see this link).
Q: 2.All other webservices framework whether it is metro, jersey, glassfish uses the JAX-WS internally. Is it correct?
Strictly speaking, Metro doesn't "use" JAX-WS, but includes already mentioned JAX-WS reference implementation. Jersey included JAX-RS implementation, and Glassfish is not a Web-service framework, but an application server. Glassfish comes with the complete Metro distribution.
JAX-WS is a Web Services framework that provides tools and infrastructure to develop Web Services solutions for the end users and middleware developersJAX-WS stands for Java API for XML Web Services. JAX-WS is a technology for building web services and clients that communicate using XML. JAX-WS allows developers to write message-oriented as well as RPC-oriented web services.
In JAX-WS, a web service operation invocation is represented by an XML-based protocol such as SOAP. The SOAP specification defines the envelope structure, encoding rules, and conventions for representing web service invocations and responses. These calls and responses are transmitted as SOAP messages (XML files) over HTTP.
There is another type of web-service, which is called RESTful.RESTful web services are built to work best on the Web. Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web. The resources are acted upon by using a set of simple, well-defined operations. The REST architectural style constrains an architecture to a client/server architecture and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.
Genrally JAX-RS is used for developing RESTful web services. JAX-RS is a Java programming language API designed to make it easy to develop applications that use the REST architecture. The JAX-RS API uses Java programming language annotations to simplify the development of RESTful web services. Developers decorate Java programming language class files with JAX-RS annotations to define resources and the actions that can be performed on those resources. JAX-RS annotations are runtime annotations; therefore, runtime reflection will generate the helper classes and artifacts for the resource. A Java EE application archive containing JAX-RS resource classes will have the resources configured, the helper classes and artifacts generated, and the resource exposed to clients by deploying the archive to a Java EE server.
Different frameworks uses either JAX-WS or JAX-RS. Jersey uses JAX-RS and Metro uses JAXWS.

Integrate Groovy in an existent Web app

I have an existent web application, I'd like to add Groovy to this web app so that I can develop web service providers easily if possible.
Is there a way to write a service class (like Grails service classes) and expose this class as ws without much pain ?
Grails uses the same thing : after adding one line to the service class, that class will be exposed automatically as a web service.
Regards
GroovyWS is a SOAP based implementation of Apache CXF.
After some quick searching I found two tutorials that may be of help.
One using Jersey and the other using Restlet. The Jersey one seems simpler.
Creating RESTful services with Jersey and Groovy
Building RESTful Web Apps with Groovy and Restlet, Part 1: Up and Running

What is the Java EE framework for web services?

I would like to build a server with web services using Java EE, but I don't know which is the best Java EE framework.
Important to me are interoperability, performance, security and changeability.
P.s.
My server will not be used for a website, but it will be used to distribute applications (for mobile).
JAX-WS, JAX-RS, JAXB
There are numerous java API for the web services. The varies depends on the data handling formats;
1. SOAP
2. RESTful web services, which is commonly used i.e. JAX-WS and JAX-RS
But mostly used web service is Restful...

Categories

Resources