Oops I fired off the note too quickly! The actual snippet of code in BeanSerializer is:
// Normal case: serialize the value Object propValue = propertyDescriptor[i].getReadMethod ().invoke(value,noArgs); if (propValue != null) // <----------- Add this line to preven 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) R J Scheuerle Jr/Austin/IBM@IBM To: [EMAIL PROTECTED] US cc: Subject: RE: how can I turn off xsi:nil="true" element 03/13/2002 09:34 AM Please respond to axis-dev Glen is concerned about method resolution problems associated with omitted data. 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. One way for you to address this problem is to provide your own BeanSerializer that does not serializer null values. 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 >