Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Web Services - Is Axis Necessary?

Is AXIS or CXF necessary for Java web services? Can it be all done via the JDK (1.6)?

like image 371
user353829 Avatar asked Oct 01 '09 17:10

user353829


People also ask

What is Axis in Web services?

Apache Axis (Apache eXtensible Interaction System) is an open-source, XML based Web service framework. It consists of a Java and a C++ implementation of the SOAP server, and various utilities and APIs for generating and deploying Web service applications.

Is Apache Axis deprecated?

We are planning to deprecate Apache Axis in October 2021. If your organization currently uses this framework, we wanted to tell you how this impacts you and what your options are.

How do I use Axis Web services?

Axis2 Web Service invocation using Stub Files. Create a Java Project Axis2Client in Eclipse. Create lib folder and copy all the Axis2 jars from downloaded binary distribution lib folder. Add these jars to the build path of the project.

What is Axis SOAP?

Introduction. Apache Axis is an implementation of the SOAP ("Simple Object Access Protocol") submission to W3C. From the draft W3C specification: SOAP is a lightweight protocol for exchanging structured information in a decentralized, distributed environment.


4 Answers

Is AXIS or CXF necessary for Java web services?

No. Although Axis2 is the most popular framework to work with Web Services is not the only way to do them.

Can it be all done via the JDK (1.6)?

Yes, but it is way much harder. You will benefit tremendously from using a framework used by others apps and from the bug fixes the development team provide. Doing all by hand is like reinventing the wheel.

If you want to have full control of what's happening underneath, probably you could go with: JAX-WS

or if the application is very simple, directly with socket.

But again, Axis2 is the canonical way to do WS ( but not the only one )

like image 200
OscarRyz Avatar answered Oct 17 '22 05:10

OscarRyz


The following is based on an all to true and personal story:

So you want to consume a web service in your Java web application, and you don't want to add 10MiB of JARs to your lean 1.3 MiB .war file, and besides you are great at parsing XML (you can hand code XPath Queries, and XSLT files), you totally understand HTTP, and the client you are interfacing with has great documentation. You download the WSDL look at your endpoints and your methods and start creating a Java class that maps to the features you are going to need. You feel great already.

They you start reading up on how to send a SOAP request and you think well this looks a little verbose but what they hey it's all just a string, so you start building a utility that takes your Java request object and converts it to a SOAP request. You send your clear SOAP request to the server but it gets denied (missing a signature).

So now you start adding encryption JARs to your project and you start looking at how to calculate a signature of part of an XML document and include both it and the document in the request. This takes you a while but with enough hacking you get a message that you can send to your soap service and you are now dealing with the SOAP response. Now you are feeling great...

Until the admin at your client changes their security requirements, issues new public keys, and updates the soap interface with some custom types, and your next client who is running a similar service (but on a Windows Server) wants you to implement with them as well.

At this point I gave up trying to implement this in a pure Java way and just started using standard libraries. They deal with stuff like encryption, marshaling, deviations form the standards and they let you focus on stuff that is closer to your problem domain. I hope you can save yourself the lost month it took me to learn this lesson.

like image 36
Jason Sperske Avatar answered Oct 17 '22 05:10

Jason Sperske


An update on the landscape of web services in 2013.

Web services used to be SOAP and XML-based. Web services were standardized into JAX-WS. Some of the more popular frameworks are (were):

  • Axis 1.x
  • Axis 2
  • Apache CXF - CXF also includes other protocols. It is a much broader framework
  • Metro Web Services which includes the JAX-WS Reference Implementation.
  • Java 6 and Java 7 include the JAX-WS RI by default. It means that frameworks are no longer needed except to generate client and service stubs / skeletons

There are other implementations not listed here that are vendor-specific e.g. IBM Websphere's WS implementation and Weblogic's WS implementation.

Generally though, to create web services, I would recommend Metro and the JAX-WS RI.

Note that there are many WS-* standards e.g. WS-Security which may not be part of all WS implementations.

Since web services have been around for a while, other alternatives have come up both in terms of architectural style, protocol, and encoding.

For instance, XML used to be the de-facto encoding. JSON is now more prevalent. It is worth looking into Jackson, a JSON parser, or Google GSON. The main arguments in favor of JSON are that it is easy to use, lightweight, and developer-friendly.

Along with JSON came REST. REST is an architectural style. With REST, you can still implement "web services" in the sense of remote services that can be easily consumed over a network. REST has also been standardized in the Java family of standards as JAX-RS. Some of the popular JAX-RS implementations include CXF, Jersey, and RESTLet.

Finally, there are some new kids on the block that use binary encodings. Those are Google Protocol Buffers and Apache Thrift. Their main goal is performance as well as broader support for other languages (Java, C#, Erland, Perl...).

When developing a web service today, the question should be: - do I care about performance? - do I want to access the service from many different languages? - do I want mobile-friendly?

These should help you guide your choice. Also, I prefer to keep my dependencies to a minimum. This means I would rather take something that is native to the JRE or JDK e.g. the JAX-WS or JAX-RS reference implementation.

like image 4
David Brossard Avatar answered Oct 17 '22 04:10

David Brossard


As an alternative to Axis, you can use the Spring WebServices framework to run your webservices application within a J2EE container like Tomcat or anything similar. I've found it very easy to use and setup, and if you want to integrate your webservices into another web application later, it's quite easy to do (I've done so myself on two separate occasions).

like image 2
Alex Marshall Avatar answered Oct 17 '22 03:10

Alex Marshall