You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jarmo Doc <ja...@hotmail.com> on 2005/08/31 22:08:55 UTC

Remoting object changes

My web service serves up Employee objects.  Each employee has dozens of 
attributes, such as name and gender.  On the server side, an employee can be 
updated as follows:

  emp.setName("Jones, Bob");
  emp.setGender("male");
  emp.commitUpdates();

The Employee class that the web services client sees also has get/setName() 
and get/setGender() methods but obviously has no commitUpdates() method.  
Now, the client can call setName() and setGender() locally but the question 
is how to get these changes back to the server in some optimal fashion.

Now I could add a web service method updateEmployee(employee) which the 
client could call after making a couple of changes to his local Employee 
object and that would cause the modified Employee to be sent back to the 
server.  But how would the server know which fields had been updated, other 
than to diff the old employee and new employee objects field by field?

Alternatively, I could add web service methods setName(employee, newname) 
and setGender(employee, newgender).

Neither option scales well when there are dozens of attributes and dozens of 
other classes in a similar situation.

So, what's the optimal web services way to remote the client's changes to an 
object?

Thanks very much.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


RE: Remoting object changes

Posted by Michael Oliver <ol...@alariussystems.com>.
We use a POJO that is the Employee class with all its getters and setters
and a Services class with Create(authToken, employee), Retrieve(authToken,
employee), Update(authToken, employee) and Delete(authToken, employee)

In all cases we return a response object that includes an Object[] where we
put the employee object when doing a Retrieve.  On Create and Update the
employee object is fully populated by the client and on Retrieve the
employee object is populated only with sample data and we use Hibernate to
fetch the object from the database and to store the object to the database.

Michael Oliver
CTO
Alarius Systems LLC
6800 E. Lake Mead Blvd, #1096
Las Vegas, NV 89156
Phone:(702)643-7425
Fax:(702)974-0341
*Note new email changed from oliverm@matrix-media.com
-----Original Message-----
From: Jarmo Doc [mailto:jarmod@hotmail.com] 
Sent: Wednesday, August 31, 2005 1:09 PM
To: axis-user@ws.apache.org
Subject: Remoting object changes

My web service serves up Employee objects.  Each employee has dozens of 
attributes, such as name and gender.  On the server side, an employee can be

updated as follows:

  emp.setName("Jones, Bob");
  emp.setGender("male");
  emp.commitUpdates();

The Employee class that the web services client sees also has get/setName() 
and get/setGender() methods but obviously has no commitUpdates() method.  
Now, the client can call setName() and setGender() locally but the question 
is how to get these changes back to the server in some optimal fashion.

Now I could add a web service method updateEmployee(employee) which the 
client could call after making a couple of changes to his local Employee 
object and that would cause the modified Employee to be sent back to the 
server.  But how would the server know which fields had been updated, other 
than to diff the old employee and new employee objects field by field?

Alternatively, I could add web service methods setName(employee, newname) 
and setGender(employee, newgender).

Neither option scales well when there are dozens of attributes and dozens of

other classes in a similar situation.

So, what's the optimal web services way to remote the client's changes to an

object?

Thanks very much.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/