How to write effective web services in java
Asked Answered
E

2

18

Though this might appear as a duplicate of Java Web Services , I would like to know Where to start and to continue.In the past, I have invested so much of time to find where to start but I wasn't able to. There are so many jargons and chaos (at least for me!) while reading the pages about web services. There are so many terms - like JAX-RPC, JAX-WS, Axis, Rest, Servlet as WebService, EJB's as Web Service and other terms that I don't know. Can this User group consolidate and give a highlevel overview of Java Web Services which is easy to understand and follow? I appreciate your kindness and thanks for your help.

Eulogize answered 11/5, 2010 at 12:7 Comment(0)
M
34

That's indeed a bit a jungle to understand web services. The wikipedia page is decent, but still lacks some elements.

I've flagged this answer as community wiki, so feel free to update it, or correct it. It's only a basis.

A bloated term:

First, the term web service is used to refer to many thing. While many people use it to refer to SOAP-based web service, the term can be used to denote any service provided through a web interface; this is a source of confusion.

Implementation and design style:

  • SOAP-based -- SOAP is still the de-facto standard for web services. SOAP is protocol on top of HTTP that describes the exchange of message and exception. SOAP grew from something simple to something very complicated with all the WS-* standards that have been added later. The most important are: WS-Policy, WS-Security, WS-Addressing, WS-Transaction. Another important spec is MTOM for large message.
  • RESTful -- The term RESTful relates to the fact that the service is stateless and all relevant information is passed as parameter. Also instead of using a protocol like SOAP, plain HTTP verbs are used, e.g. Get, Put, Delete, Update.
  • Stateless -- WS are usually stateless. Business processed sometimes rely on so-called correlation identifiers (with WS-Addressing) that are used to match requests and response together; this is the same idea like storing a session identifier in a cookie because HTTP is stateless.
  • Stateful -- There are some proposal to have stateful WS, but I don't know much about it.

Implementation and technology stacks:

  • Servlet -- The lowest-level way to implement a WS: you basically parse the request and spit the HTTP response all by yourself.
  • EJB -- Since EJB3, EJB can be exposed as web service very easily. Needs an EJB container, of course.
  • Apache Axis -- Used to be a popular technology stack which is declining now.
  • Apache CXF -- Another popular choice.
  • JBossWS -- Yet another popluar choice.
  • JAX-WS -- The official web service stack from Sun, very good. So far I know, this replaces JAX-RPC which was simply renamed JAX-WS.

Related concepts and jargon:

  • WSDL -- Defines the contract/interface of the web service, in case of SOAP-based WS.
  • Contract-first -- Refers to the fact that that a technology is able to support any WSDL provided upfront. On the contrary to an implementation technology which will generate the WSDL based on the implementation of the web service, in which case the WSDL can not always be customized as necessary
  • Profile -- To simplify this mess, they've introduced profiles which are groups of related specifications/capabilities that need to be supported for interoperability. The main one is WS-I Basic Profile.
  • UDDI and discovery -- It seems like some people thought the web service would be published in a public register so as to be discoverable by potential consumer. I don't think this vision gained much momentum.
Microreader answered 11/5, 2010 at 12:8 Comment(3)
+1 Very nice post - something I desperately needed today, conveniently enough.Scutter
Can someone share the Setup Procedures, with eclipse, axis2, tomcatRapp
Note that "JAX-WS" is used to refer to both a standard/API (from JSR 224; it does replace JAX-RPC) and Sun's Reference Implementation of it, which I think was the code from Project Kenai is now called "Project Metro" and ships with GlassFish. Other stacks, like Apache CXF, also implement the JAX-WS standard, which provides some interoperability. (I was going to update the Wiki with this, but I'm not sure I understand the distinction well enough myself to word it correctly.)Bernhard
H
0

The best explanation I know for "contract first" web services is Spring web service module.

Heterogony answered 11/5, 2010 at 12:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.