Good point, Rich.  Comments inline.

--Glen

> -----Original Message-----
> From: R J Scheuerle Jr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 13, 2002 10:34 AM
> To: [EMAIL PROTECTED]
> Subject: RE: how can I turn off xsi:nil="true" element
> 
> 
> Glen is concerned about method resolution problems associated 
> with omitted
> data.

Yup.

> But I think Ramana's problem is with omitted properties inside a
> complexType.  This is a slightly
> different issue and is "easier" to address.  Currently the 
> BeanSerializer
> does not have enough
> information to determine whether a field is:
> 
>    - "nillable=true" ...which dictates that a null value is 
> passed over the
> wire with xsi:nil="true"
>   - or "minOccurs=0"...which dicates that  a null value is 
> not passed over
> the wire at all.

For doc/lit, this distinction is important.  For SOAP encoding, it comes down to 
precisely the same thing, since the section-5 rules state that nils may be represented 
by omission.

> One way for you to address this problem is to provide your own
> BeanSerializer that does not
> serializer null values.

This is an easy-enough switch to add for us, which makes more sense than custom 
serializers, IMHO.

> Here is the snippet of code in the BeanSerializer that needs 
> to be changed.
> I added a comment next to the new code.
> 
>                    // Collection of properties: serialize each one
>                     int j=0;
>                     while(j >= 0) {
>                         Object propValue = null;
>                         try {
>                             propValue = 
> propertyDescriptor[i].getReadMethod
> ().invoke(value,
>                                                               
>        new
> Object[] { new Integer(j) });
>                             j++;
>                         } catch (Exception e) {
>                             j = -1;
>                         }
>                         if (j >= 0 &&
>                            propValue != null                
> //  <---- This
> will prevent serializing null values
>               {
>                             context.serialize(qname, null,
>                                               propValue,
> 
> propertyDescriptor[i].getReadMethod().getReturnType());
>                         }
>                     }
> 
> 
> 
> 
> Rich Scheuerle
> XML & Web Services Development
> 512-838-5115  (IBM TL 678-5115)
> 
> 
>                                                               
>                                                               
>                       Glen Daniels                            
>                                                               
>                       <gdaniels@macrome        To:       
> "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>              
>                       dia.com>                 cc:            
>                                                               
>                                                Subject:  RE: 
> how can I turn off xsi:nil="true" element                      
>                       03/13/2002 07:37                        
>                                                               
>                       AM                                      
>                                                               
>                       Please respond to                       
>                                                               
>                       axis-dev                                
>                                                               
>                                                               
>                                                               
>                                                               
>                                                               
> 
> 
> 
> 
> Right now, you can't.  This would very easy to add with another option
> (i.e. "OMIT_NILS"), but note that it would take more work for 
> us to be able
> to process *incoming* messages like this - we can't currently 
> deal with
> omission==null because we do all our parameter-matching by 
> position and not
> by name.  To recap: sending with omitted elements is easy, 
> receiving with
> omitted elements is hard at present.
> 
> (I'm working on stuff in my sandbox which will solve this 
> problem among
> other things, but it won't show up until post-beta)
> 
> --Glen
> 
> > -----Original Message-----
> > From: Jelda, Venkata Ramana [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, March 13, 2002 7:48 AM
> > To: [EMAIL PROTECTED]
> > Subject: how can I turn off xsi:nil="true" element
> >
> >
> > HI all,
> > In my soap message some elements can be null.
> > So I don't want to send those null elements at all.
> > for example in the follwing soap message:
> > <test xsi:type="ns3:t_Type">
> >       <startTime xsi:type="ns3:time_Type">1234</startTime>
> >       <endTime xsi:type="ns3:time_Type">12345</endTime>
> >        <option xsi:nil="true"/>
> > </test>
> >
> > I don't want to send  <option xsi:nil="true"/> element.
> > I want to send like this when the element is null.
> > <test xsi:type="ns3:t_Type">
> >       <startTime xsi:type="ns3:time_Type">1234</startTime>
> >       <endTime xsi:type="ns3:time_Type">12345</endTime>
> > </test>
> >
> > How can I do it??
> > thanks in advance,
> > Ramana
> >
> >
> > --
> > Ramana Jelda
> > mailto:[EMAIL PROTECTED]
> >
> > infosim Networking Solutions AG
> > Friedrich-Bergius-Ring 15 - 97076 Wuerzburg - Germany
> > Fon: +49 (0)931 20 592-262
> > Handy: +49 (0)178 807 65 69  Fax: +49 (0) 931 20 592-209
> > http://www.infosim.net
> >
> 
> 
> 

Reply via email to