I guess you will not have access at either side of your application. Axis bean serialization / deserialization needs all fields to have setter and getter methods. Bean instances are created through the default constructor (with no parameters), so your ID initialization will not be executed.

AFAIK, there is no easy and straight solution for your problem. Probably, you will have to implement a custom serializer / deserializer for your bean, and use a read-only class for your bean. A common approach is to have a base read-only class with a protected Id field and the getId() method, and a subclass with the setId() method. Your serializer / deserializer will use the subclass, but you will see the base class by default. With this approach you can still access the setId method through class casting, but you must do it explicitly.

Axis does not provide a public way to specify you want to use a subclass for serializing / deserializing a given base class. This is the reason why you need to implement your own serializer to do this.

HTH,
Rodrigo Ruiz

pratibha dadegaonkar wrote:

Hi

I have a bean class wherein i have the details like address id, place, state and all info. In the address class, i have get,set methods for all fields but the id has only get method. Id can be set only using the constructor. The end user i.e. web service user can only access it. I have a web service which gives the user the whole address object. The web service user reads it and uses it. He can see the address it. The user sends the same address object to another of my web service wherein I need to see the id he has sent. The user sends the same object, but i am unable to view the id he has sent in my new web service. Any idea how it works? And which way i can handle that!

Thanks and regards
Pratibha.







Reply via email to