File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes clients stubs regeneration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "clients stubs regeneration" Watch "clients stubs regeneration" New topic

clients stubs regeneration

Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Hi all,

In some cases I need to add a field in a complex type of return. The problem is that the service is used by many systems, and in some cases I do not know them until they give error. What is the best way to avoid this problem? For example, everything to continue operating without new information, without generating errors?

I am using Axis.

Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104

If you add an element to an existing return type of an operation, clients will fail. To avoid regenerating the client stubs (since they are out of your control) you must version your web services, so that old clients (that know about the previous format of the data type) are redirected to a version of your web service that will return back, an object of the type they can understand.
Check out these:
WS backward compatibility
WS-SOA backward compatibility
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
If you do WSDL-first development, then you can set minOccurs for any field to zero, in which case it becomes optional.
Of course your code will have to written accordingly, so that it does not assume there is a value for such a field.
This way you do not have to regenerate any client artifacts.
Best wishes!

My free books and tutorials:
Luciano A. Pozzo
Ranch Hand

Joined: Jun 20, 2005
Posts: 112
Thank's Jim and Ivan!
I agree. Here's the link:
subject: clients stubs regeneration
jQuery in Action, 3rd edition