As well known one can start to create WebServices by two ways:
1.) create a WSDL from an existing java class (with webservice annotations)
or
2.) Create a java class source skeleton from an existing WSDL definition file.
Which approach is more usual?
If webservice projects are started in real world which is preferable ?
Is there a web page which discusses the pros and cons of the two ways ?
J.
Lew - 25 Jan 2008 14:36 GMT
> As well known one can start to create WebServices by two ways:
>
[quoted text clipped - 3 lines]
>
> Which approach is more usual?
Does usual == correct?
> If webservice projects are started in real world which is preferable ?
If cabinetry projects are started in the real world, which is preferable, to
have a set of plans by which to build the cabinets, or to develop plans based
on actual cabinets one has built before?
There is a time in the development of a WSDL, like any other programming
artifact, where its expression is informed by prototypes and iterative
re-evaluation of successive versions.
Once the WSDL is published it represents a contract that a web service must
follow. So must its clients. Services and their clients will be generated in
accordance with that WSDL thenceforth.
Future generations of the WSDL will be different WSDLs. Backward
compatibility is less achievable, if ever, in the WSDL-web-service world.
Summary: WSDLs might come from annotated classes initially. Classes come
from WSDLs operationally.
> Is there a web page which discusses the pros and cons of the two ways ?
GIYF. But there really aren't "pros and cons" as if the different approaches
were somehow contradictory. They're complementary, intended for different
phases of the service's life and different purposes within it.

Signature
Lew
Arne Vajhøj - 26 Jan 2008 03:45 GMT
> As well known one can start to create WebServices by two ways:
>
[quoted text clipped - 5 lines]
>
> If webservice projects are started in real world which is preferable ?
My impression is that small solution are done Java->WSDL but
complex solutions are done WSDL->Java.
Reason: Java is 10 times easier to write than WSDL (at least for a
Java programmer), so if you are going to spend a week doing a
web service you prefer to start with Java - are you permanent
working with web services, dealing with interop issues with .NET,
PHP and Python then you will soon read WSDL as easily as Java and
then you will start with that.
Arne
Lew - 26 Jan 2008 13:49 GMT
> My impression is that small solution are done Java->WSDL but
> complex solutions are done WSDL->Java.
[quoted text clipped - 5 lines]
> PHP and Python then you will soon read WSDL as easily as Java and
> then you will start with that.
Unfortunately this approach disregards sound engineering reasons to go in one
direction or the other, and such reasons exist.
The use case for WSDLs is to guarantee that web service consumers understand
and use the interface recognized by a deployed web service. It's the
interface contract, equivalent to a Java interface or CORBA IDL file. It
isn't so much for the web service provider.
WSDLs must be crafted so that they accurately represent an enforceable
contract for the web service. Whether you are a newbie or a seasoned
web-service practitioner doesn't change that. Even a newbie must bear in mind
the real purpose of the WSDL, and even the veteran will develop WSDLs using a
mix of top-down, bottom-up and middle-out development. Once the WSDL is out
there, it /defines/ the web service, completely irrespective of anyone's skill
level or experience. All implementations service and client must thereafter
conform to the WSDL, no matter how they are developed.
The matter of familiarity with the format is a red herring.

Signature
Lew
Rob - 28 Jan 2008 20:02 GMT
> As well known one can start to create WebServices by two ways:
>
[quoted text clipped - 9 lines]
>
> J.
The WSDL is the API, the contract to the external user. So better to
get that right and think about it in terms of the WSDL client.
I believe it is better to do the WSDL and be more likely to get the
API right. When you generate the WSDL off the Java implementation
class then things can get messed up. The WSDL can contain
implementation details or extraneous stuff ends up in there. You could
(should) end up specially tailoring your Java class so that the WSDL
output is what you want. But by that time you're probably better off
just making the WSDL the authority and starting there.
In my experience around Web services I've never seen the WSDL first
approach and it's always been generated WSDL off the implementation
Java or C++ classes.
Rob
http://cbmc64.blogspot.com