axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R J Scheuerle Jr" <>
Subject Re: Deserializer (MethodTarget, FieldTarget)
Date Fri, 05 Apr 2002 16:51:33 GMT
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                                                       
                      <turner@genome.wi        To:      
            >                cc:                                    
                                               Subject:  Deserializer (MethodTarget, FieldTarget)
                      04/05/2002 08:32                                                   
                      Please respond to                                                  

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)
    { = name;
        this.age = age;

    public void setName(String name)
    { = name;

    public String getName() { return; }

    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

I could use some help and/or feedback.



View raw message