You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Alex Chatziparaskewas <ch...@swiftdsl.com.au> on 2003/11/06 11:38:24 UTC

some general questions

Hi Everybody

I have put the questions below onto the axis user list a while ago.
Unfortunately, I did not receive any reply. Hopefully this time it will be
more successful.

I have to admit that the questions/issues below are not really dev related
nor are they bugs. But in the worst case that there is a simple answer to
one of them, maybe it is just the documentation which is not sufficient.
Otherwise they can probably be treated as a 'development request'.


We have used web services using the axis implementation on one of our
projects. Among other things the web services served as a bridge between a
.NET client and a J2EE backend and is actually working quite well. But
anyway, during the implementation of the project some 'problems' popped up,
and we still do not have a satisfactory answer to some of them. Since these
questions are somewhat 'generic', maybe one of you has come across the same
problems ...

1) READ ONLY FIELDS - A lot of the web services are used to 'browse' through
existing data. Most of the 'data' is represented as simple beans. But, some
of the fields are - from the business perspective - read only and therefore,
e.g. the Java-Java interface does not expose a set method for those fields
to avoid a misusage of the interface. Unfortunately, the beans transferred
through the web service must be 'real' java beans - with public set/get
method - in order to get transferred correctly by the BeanSerializer. We
thought about writing our own version of a serializer, but some of the web
services are provided to the outside world and understandable we were quite
reluctant to provide custom serializers to the rest of the world. The
question of course is: Is there a way to 'define' read only methods on the
web service itself. The best solution we currently have are server side
checks, but unless everything is tested thoroughly problems will popup when
already in production.

2) DOCUMENTATION - The Java-Java interface is using javadoc for its
documentation which is sufficient. We would of course have liked to 'embed'
the documentation of the web service into the web service itself as first of
all no one is reading any 'printed' documentation and keeping a separate
document up to date is always a real pain. I have never seen it working
anyway (beside the big documentation update in the end of a release cycle).

3) WSDL FILE GENERATION - We used wsdd files to deploy the web services. The
description of the web service (wsdl) is then provided by axis. We wrote
unit test in Java to test the web services. The client side stub is
generated from the wsdl file provided by axis. The problem we faced: To
generate an up-to-date client stub the web service needs to be deployed in
order to access the wsdl file. Though it would have been possible to embed
something like this into our build environment/process it is not simple (you
need to start the application server, what do you do if there is already an
application server running, etc.). Axis provides the java2wsdl tool which
should be able to generate an wsdl file from java source. But then, who
guarantees that the wsdl file provided by the deployment of the web service
is the same as the one generated by java2wsdl? Instead of generating the
wsdl file we would have liked to generate the wsdd file! But we have not
found a way ...

Ok, that's should be enough for the moment. All comments will be greatly
appreciated!

Thanks & Regards
Alex
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 11/3/03


Re: some general questions

Posted by Steve Loughran <st...@iseran.com>.
Alex Chatziparaskewas wrote:
> Hi Everybody
> 
> I have put the questions below onto the axis user list a while ago.
> Unfortunately, I did not receive any reply. Hopefully this time it will be
> more successful.
> 
> I have to admit that the questions/issues below are not really dev related
> nor are they bugs. But in the worst case that there is a simple answer to
> one of them, maybe it is just the documentation which is not sufficient.
> Otherwise they can probably be treated as a 'development request'.
> 
> 
> We have used web services using the axis implementation on one of our
> projects. Among other things the web services served as a bridge between a
> .NET client and a J2EE backend and is actually working quite well. But
> anyway, during the implementation of the project some 'problems' popped up,
> and we still do not have a satisfactory answer to some of them. Since these
> questions are somewhat 'generic', maybe one of you has come across the same
> problems ...
> 
> 1) READ ONLY FIELDS - A lot of the web services are used to 'browse' through
> existing data. Most of the 'data' is represented as simple beans. But, some
> of the fields are - from the business perspective - read only and therefore,
> e.g. the Java-Java interface does not expose a set method for those fields
> to avoid a misusage of the interface. Unfortunately, the beans transferred
> through the web service must be 'real' java beans - with public set/get
> method - in order to get transferred correctly by the BeanSerializer. We
> thought about writing our own version of a serializer, but some of the web
> services are provided to the outside world and understandable we were quite
> reluctant to provide custom serializers to the rest of the world. The
> question of course is: Is there a way to 'define' read only methods on the
> web service itself. The best solution we currently have are server side
> checks, but unless everything is tested thoroughly problems will popup when
> already in production.

interesting q.
Are these beans value objects that you are transferring across the wire, 
or are you talking about methods that you are exporting from objects?

If the latter, a WSDL File that only defines the methods you want to 
export is the approach.

The other tactic is not to blindly export your existing objects, but 
define a 'service API' that is purely for external callers. This lets 
you explicitly nail down what it is your web service does, and isolates 
you from implementation details.

Of course, a service API is not exclusive from a prewritten WSDL file.

> 
> 2) DOCUMENTATION - The Java-Java interface is using javadoc for its
> documentation which is sufficient. We would of course have liked to 'embed'
> the documentation of the web service into the web service itself as first of
> all no one is reading any 'printed' documentation and keeping a separate
> document up to date is always a real pain. I have never seen it working
> anyway (beside the big documentation update in the end of a release cycle).


You can add comments to an XSD or a WSDL file by hand.

> 
> 3) WSDL FILE GENERATION - We used wsdd files to deploy the web services. The
> description of the web service (wsdl) is then provided by axis. We wrote
> unit test in Java to test the web services. The client side stub is
> generated from the wsdl file provided by axis. The problem we faced: To
> generate an up-to-date client stub the web service needs to be deployed in
> order to access the wsdl file. Though it would have been possible to embed
> something like this into our build environment/process it is not simple (you
> need to start the application server, what do you do if there is already an
> application server running, etc.). Axis provides the java2wsdl tool which
> should be able to generate an wsdl file from java source. But then, who
> guarantees that the wsdl file provided by the deployment of the web service
> is the same as the one generated by java2wsdl? Instead of generating the
> wsdl file we would have liked to generate the wsdd file! But we have not
> found a way ...

Write the WSDL file by hand.
yes, autogenerated WSDD would be nice -maybe we can do something with 
xdoclet there.

summary:

1. define a proper service API, the goal being longevity, flexibility 
and implementation independence. You should aim for an interface which 
could be used or implemented in another language (say C# and C++)

2. write the WSDL first, treat it as an ugly IDL

2. autogen the Java interfaces of your service using wsdl2java

3. add comments to the WSDL/XSD files you write.

This is extra work, but you gain many benefits

(a) there is now a pure interface definition; if that file is unchanged 
then you can be sure that the signature of your service is unchanged

(b) you can go WSDL2Java client side and server-side without deploying

(c) you can strip the endpoint URL from the WSDL, so forcing clients to 
implement a lookup mechanism, be it LDAP or UDDI

WSDL is ugly and brittle. By the latter I mean it is easy to write WSDL 
that doesnt work properly on some platform, and hard to track down the 
details. IDL is much nicer. But XML schema is OK. I usually define my 
types in XSD and include this in the WSDL, which is then a lot simpler.

-steve