30

What is/are the difference/s of Java's JAX-WS and Metro? Are they the same of are they two different JAX-WS implementations?

According to my research, JAX-WS is already a part of JDK 6. However, JAX-WS does not come with the standard bundle of JDK so I looked for a Java EE jar. However, it seems that Oracle does not host a compiled Java EE jar but instead provides Glassfish which is a Java EE server.

I was able to run my web service on Glassfish. What JAX-WS implementation does Glassfish use? Since it's hosted on Oracle, I'm assuming that it is using Java's implementation of JAX-WS which is supposedly a part of JDK 1.6? Am I correct with my assumption? Also, to run a JAX-WS based web service, I need to download JAX-WS jars. I found Metro. But on it's page, I see the link of metro to be a sublink of Glassfish. So I'm now confused. Is Glassfish using Metro? Or is Glassfish using Java's JAX-WS?

Are Metro and Java's JAX-WS the same?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Arci
  • 6,647
  • 20
  • 70
  • 98

2 Answers2

32

JAX-WS is an API while Metro is the reference implementation for the JAX-WS API; both are from Sun/Oracle, thus are standard. You can see them as an interface (JAX-WS) and a class implementing the interface (Metro), only at a higher level. Glassfish also uses Metro as implementation for JAX-WS.

To be noted that Metro contains implementation for JAXB and other APIs.

Also, SOAP Web Services are somehow obsolete; the new trend is to use REST Web Services; JAX-RS (with various implementations from the standard Jersey to Restlet or CXF).

David Brossard
  • 13,584
  • 6
  • 55
  • 88
Random42
  • 8,989
  • 6
  • 55
  • 86
  • Thanks for your answer! Then what is the one included on JDK 1.6? Is it just an API or a JAX-WS implementation? – Arci Oct 01 '12 at 09:08
  • @Arci It includes Metro also. See here an elaborate answer - http://stackoverflow.com/questions/9116008/does-java-7-include-a-jax-ws-implementation-or-just-the-api . – Random42 Oct 01 '12 at 09:13
  • Uhm.. But I thought JDK 1.6 contains an implementation of JAX-WS? Or is it just an API when they said JDK 1.6 is bundled with JAX-WS? When you say API, does it mean that it's just an interface and not an implementation? – Arci Oct 01 '12 at 09:13
  • 2
    @Arci JDK includes both the JAX-WS API and the Metro implementation for the JAX-WS API. – Random42 Oct 01 '12 at 09:14
  • 4
    Oh... Thanks! Got it now. I know this is not a really a part of my question but when you say JDK, it doesn't mean that it contains the implementation of the included classes right? Because I'm running my Tomcat on Eclipse under JDK 1.6 but I still need to include the JAX-WS jars on Tomcat to be able to run a JAX-WS based web service. If both the JAX-WS API and Metro implementation are already included in JDK 1.6, then why do I still need to add the JAX-WS jars? I'm getting an error if I don't add the jars from Metro on Tmocat. – Arci Oct 01 '12 at 09:21
  • 1
    @Arci That is because Tomcat does not have the implementation for JAX-WS (like Glassfish); you need to include those libraries in Tomcat library folder so that Tomcat could use them directly. – Random42 Oct 01 '12 at 09:27
  • Yes, I know that Tomcat does not have the implementation for JAX-WS like Glassfish. What I'm confused is that I've set my Tomcat to use JDK 1.6 on Eclipse as it's JRE. But I think I know the answer already. Even though I point Tomcat to a JDK library, it still uses only the JRE part of JDK and not the whole JDK. Since JRE does not contain the J2EE implementation, the JAX-WS jars must be included on Tomcat. Thanks, m3th0dman! :) (Note: Please tell me if I'm wrong with my assumption. If I'm correct, a confirmation will do.) – Arci Oct 01 '12 at 09:41
  • @Arci, at this point, have you resolved the confusion if `jax-ws` jars (API and Implementation, i.e. Metro) are in the `JDK` or not ? – Muhammad Gelbana Mar 16 '13 at 22:52
  • @MuhammadGelbana: Thanks for the concern! Yes. JAX-WS is in JDK but not in JRE. Tomcat uses JRE, not JDK. As such, the required jars must be bundled together with the project (in the lib folder) to run JAX-WS on Tomcat. :) Did I get it right? – Arci Mar 18 '13 at 08:36
  • 4
    @m3th0dman your comment on SOAP vs. REST is subjective. Lots of enterprises still use SOAP. The use of SOAP vs. REST vs. REST/JSON depends largely on what environment you are in. There is no good vs. bad here. – David Brossard Oct 08 '13 at 09:29
2

Accourding to Metro's home page, "Metro consists of JAX-WS Reference Implementation project and Web Services Interoperability Technology project."

Web Services Interoperability Technologies (WSIT) (previously known as Project Tango) includes implementations of:

  • SOAP over TCP
  • WS-AtomicTransactions/Coordination
  • WS-MetadataExchange
  • WS-Policy (https://github.com/javaee/metro-policy)
  • WS-ReliableMessaging
  • WS-SecureConversation
  • WS-Security
  • WS-SecurityPolicy
  • WS-Trust

Look at this answer for futher information.

Rahul Khimasia
  • 473
  • 12
  • 24