Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client Code Change - Adding new field

 
chethana reddi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic