Why can't you just extend the existing BeanSerializer/Deserializer?

Or please explain what you are trying to do which the existing serializers
can't do.

Why don't you try using BeanPropertyTarget instead of ValueTarget or
MethodTarget ?

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                       
                                     
                      David Turner                                                     
                                     
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]       
                                     
                      .mit.edu>                cc:                                     
                                     
                                               Subject:  Deserializer (MethodTarget, 
FieldTarget)                           
                      04/05/2002 08:32                                                 
                                     
                      AM                                                               
                                     
                      Please respond to                                                
                                     
                      axis-dev                                                         
                                     
                                                                                       
                                     
                                                                                       
                                     



I've posted a couple of messages already both to the user and dev lists,
but got no response.

I've been trying to write my own deserializer for the following simple
class which is based on your encoding example:

public class Data
{
    private String name;
    private int age;

    public Data() {}

    pubic Data(String name, int age)
    {
        this.name = name;
        this.age = age;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName() { return this.name; }

    public void setAge(int age)
    {
        this.age = age;
    }

    public int getAge() { return this.age; }

}



What doesn't work is the parameter to the method registerValueTarget(new
FieldTarget(value, localname)) or registerValueTarget(new
MethodTarget(value, methodName)).

Using FieldTarget requires that the class being deserialized have public
field members. FieldTarget is using Class.getField() which only works on
public fields.

MethodTarget, on the other hand doesn't work either.  I pass in the name
of the method so it can set the private field, but it can't find it
because MethodTarget is using Class.getMethod(methodName, Class[] {
Object.class }).  My setters have a String parameter and the other has a
int parameter.  MethodTarget can't find my method because it's looking
for an Object parameter in the method parm list.


I need to deserialize and serialize some complex objects in my project,
but this is stopping me.  I need to have something that goes beyond the
BeanSerializer.

I could use some help and/or feedback.

Thanks

David









Reply via email to