7

I am using Apache Tomcat v6 server. While creating a new Web Service, I get the Web service runtime options for "Apache Axis", "Apache Axis2" and "Apache CXF2.x".

Is it possible to have the runtime as "JAX-RPC" or "Jax-WS"?

I am using Eclipse IDE.

cottontail
  • 10,268
  • 18
  • 50
  • 51
user182944
  • 7,897
  • 33
  • 108
  • 174

3 Answers3

16

JAX-RPC and JAX-WS are specifications, Axis, Axis2 and CXF are implementations.

  • for JAX-RPC you need Axis (1)
  • for JAX-WS use CXF (I believe Axis2 also supports this spec but I've never used it)

If you have a choice I strongly recommend the latter (JAX-WS) as it's the more modern spec and more importantly the toolkits are being actively developed and updated - Axis 1 has been dormant for years and relies on old versions of a number of other libraries.

You're also likely to get better performance with a more modern toolkit like CXF or Axis2, which has been designed from the beginning to use streaming XML APIs wherever possible, rather than building a tree model in memory.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • Just want to point out that axis2 doesn't build a tree model in memory. For instance, with JAXB data binding, the unmarshall is done directly from a XMLStreamReader rather than a AXIOM in memory tree. I think that what you mean is that CXF was built from the group up, to "comply" with JAX-WS. But if you look carefully at axis2 architecture, you will see that it's scalable enough to "comply" with JAX-WS without any performance impact. But I tend to agree with you. CXF is becoming more popular these days... http://www.google.com/trends/explore#q=apache%20axis2,%20apache%20cxf – tuga Dec 30 '12 at 15:47
  • 2
    @PauloSilva I agree, I was trying to contrast the "modern" toolkits (CXF and Axis2) with the "old" one (Axis v1). I've edited my answer to make this clearer. – Ian Roberts Dec 30 '12 at 16:02
  • What is the exact meaning of the terms `implementation` and `specification`? What i understand is with these two terms is: `if we consider Axis(1) then RPC is built on Axis(1) i.e. RPC have all the features present in Axis1 as well as some additional features which the Axis(1) is lacking`. Please let me know if my understanding is correct or not. Also, you may also include something on these two terns if you want. – user182944 Dec 31 '12 at 13:16
  • @user182944 in this case the specification is http://jcp.org/en/jsr/detail?id=224, and in particular the classes and interfaces under `javax.jws` and `javax.xml.ws` - it defines a set of rules that an implementation must follow in order to be JAX-WS compliant. Apache CXF is an example of a toolkit that implements the JAX-WS specification, Glassfish Metro is another. Each implementation may have its own specific features in addition to those required by the spec (which is the inverse of what you've said in your comment). – Ian Roberts Dec 31 '12 at 13:24
  • Ok so it means RPC has got some predefined rules and Axis(1) is simply following the rules and some additional things as well correct? Using Apache tomcat v6.0, when I try to create a new web service, for service deployment configuration I used to get the web service runtime options as: Axis(1), Axis2 or CXF. But again, if i use WAS7.0, I used to get the service runtime options as: JAX-WS or JAX-RPC. Again for WAS 6.0, only JAX-RPC is available. Why are the RPC/WS options not available for APache or Axis options not available for WAS? Is it based on the vendor providing the server? pls help:( – user182944 Dec 31 '12 at 13:36
  • @user182944 I don't know, I've never used the Eclipse tools to create web service projects. But if you can build a CXF or Axis2 based service by targeting Tomcat, the resulting WAR file should be deployable to any other servlet container as well. – Ian Roberts Jan 01 '13 at 12:36
5

I'd like to expand and upon Ian Roberts answer and give you more options.

JAX-RPC

This is an older standerd. You can still find an implementation for it JAX-RPC SI (standard implementation) : http://java.net/projects/jax-rpc/

Also, many of the JAX-WS implementations will implement the old JAX-RPC standard. JAX-WS replaced JAX-RPC and you shouldn't really need it if you are creating a new project.

JAX-WS

JAX-WS standard: http://jcp.org/en/jsr/detail?id=224

JAX-WS implementations:

JAX-WS RI (reference implementation) : http://jax-ws.java.net/

Apache CXF : http://cxf.apache.org/docs/jax-ws-configuration.html

Apache Axis2 : http://axis.apache.org/axis2/java/core/

JBOSS-WS: http://www.jboss.org/jbossws (Easy if you choose jboss over a bare tomcat, pros and cons come along with this)

Choosing the right library

If you just want to get something up and running you can just have eclipse use Axis2 or CXF. (Just google "Eclipse Axis2" or "Eclipse CXF" and you'll find plenty of tutorials and videos on getting up and running.) I personally use JAX-WS RI, but all of the above options have pros and cons.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
Daniel Moses
  • 5,872
  • 26
  • 39
3

I can only answer a half of this question. Yes, it's possible to run JAX-WS and JAX-RPC on Tomcat 6:

JAX-WS

http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/

OR

http://puretech.paawak.com/2010/03/09/running-jax-ws-with-tomcat/

JAX-RPC

see the last 2 paragraphs at http://tomcat.apache.org/tomcat-6.0-doc/extras.html#Components_list and try to experiment

  • @user182944 Depending on your exact version of Tomcat, catalina-ws.jar will come with it. You only need to copy it over from extras to lib. i.e. for version 6.0.14 you can use these extras: http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/extras/ Other versions are here: http://archive.apache.org/dist/tomcat/tomcat-6/ As for the JAX-RPC Web Service client, see the example at http://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example/ If the extras section experiment works, you will have copied the files and JAX-RPC starts working as in the example. –  Jan 04 '13 at 12:27
  • @user182944 also note the JAX-RPC libs is a guess. It may not be required at all. Or it may serve a different purpose, such as to resolve web services references only. Hence, I said I am answering only a half of this question. It might be enough to get things working! –  Jan 04 '13 at 12:32