Thanks a lot Scott for your nice explanation.
Due to your explanation only, today we can finalize our project design.

regards,
Tans

----- Original Message ----- 
From: "Scott Nichol" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, October 10, 2002 10:29 PM
Subject: Re: Custom Deserializer


> > Apart from using apache SOAP in my project, we have one more specific
> > requirement for which Is it possible to use the existing/modifying
> Apache
> > source code?
> 
> Yes, you can modify the source for Apache SOAP and use it if you want.
> 
> > If yes, my requirement is that I want to pass a DOM node to
> unmarshall()
> > method of a Deserializer (may be Bean or custom) during runtime and
> get the
> > Object as return value.
> 
> That it how deserializers always work.
> 
> > If the DOM node is like this.
> >
> >
> > <PesronalInformation type="PesronalInformation">
> >
> >                              <Name type="String">John</Name>
> >
> >                              <Age type="int"> 25 </Age>
> >
> >                              <Address type="Address">
> >
> >                                            <City
> type="String">NY</City>
> >
> >                                            <Street
> > type="String">OldTraffic</Street>
> >
> >                              </Address>
> >
> > </PesronalInformation>
> >
> > For this, I will call SOAPMappingRegistry#mapTypes() in my client
> program
> > for both PesronalInformation and Address as they are complex types.
> 
> That's right.  You can do that without modifying the Apache SOAP code.
> 
> > Also some elements may appear in the DOM node or not.
> > Ex- in one DOM node during runtime, "Age" field may not be there.
> >
> > Still in that case I should get object as "new
> > PesronalInformation("John",0,new Address("NY","OldTraffic"))"
> > Here 0 is the initialized value for "int" datatype.
> >
> > If I dont put any value for "Age" in my SOAP client program, still
> SOAP
> > request message contains the <Age> element.
> >
> > My question is,  if this <Age> element would not have been there in
> XML,
> > still BeanSerializer could have instantiated the proper object ???
> > If yes, then I may not need a custom deserializer.
> 
> The supplied BeanSerializer treats the Java class as a bean: it
> instantiates it with the default (no argument) constructor, then sets
> property values for supplied properties.  It will never call a different
> constructor.  In your case, if there is no Age, then that property value
> will never be set.  Any property that is supplied, however, must be
> writeable, which effectively means it must either be a public field or
> have a public mutator (setter) method.  In the case above, the Name, Age
> and Address properties must be writeable.
> 
> Scott Nichol
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to