wood burning stoves 2.0*
The moose likes Web Services and the fly likes Client Code Change - Adding new field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Client Code Change - Adding new field" Watch "Client Code Change - Adding new field" New topic
Author

Client Code Change - Adding new field

chethana reddi
Greenhorn

Joined: Dec 01, 2008
Posts: 2
A new field is supposed to be added in my service. Is there any way that I can do that with out changing the client code that is already generated.

Any help is greatly appreciated.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Even if you could - an unchanged client wouldn't be able to access the new field. What then is the point of adding a new field?

If the web service was developed contract first you could add the new field as an optional element to an existing XML document. That would ensure that the existing clients wouldn't break - but the existing clients still wouldn't be able to use the new field.
chethana reddi
Greenhorn

Joined: Dec 01, 2008
Posts: 2
Can this change be implemented using the Contract Last(ie generating wsdl from java)?

Contract First approach can be achieved only using Springs is it?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by chethana reddi:
Can this change be implemented using the Contract Last(ie generating wsdl from java)?


No. The Java code and the Code-To-Contract tool dictate how the change in the Java code will affect the contract, usually rendering the contract incompatible with the previous version.

Contract First approach can be achieved only using Springs is it?


No. Contract first merely states that you start with the WSDL and generate the Java code from that. That gives you the control to change the contract (WSDL and/or references Schemas) in a manner that is compatible with the older contract that the existing clients are based on. That of course means that you need a solid understanding of XML, XML Schema, SOAP, and WSDL.

Contract-To-Code tools like
  • Axis 1.x WSDL2Java
  • Axis2 WSDL2Java
  • JAX-WS wsimport (Creating a service from WSDL)

  • can be then used to generate the new service skeleton from the updated contract.
     
    Don't get me started about those stupid light bulbs.
     
    subject: Client Code Change - Adding new field