Anne,
Yes, I came to the conclusion there was a difference, but I added both
purely to try and persuade Axis to handle the error.
I think Axis is ignoring the minOccurs="0", despite the fact I can see it
being set up in the source code generated:
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("requestCategoryCode");
elemField.setXmlName(new
javax.xml.namespace.QName("http://www.caps-solutions.co.uk/schema/uniform/72b/servicerequest/sr/srtypes","RequestCategoryCode"));
elemField.setXmlType(new
javax.xml.namespace.QName("http://www.caps-solutions.co.uk/schema/uniform/72b/common/uniformtypes",
"CNCODE_CodeValue"));
elemField.setMinOccurs(0);
elemField.setNillable(true);
Can this really be an Axis bug? I thought this would be fairly heavily tested?
John
On Fri, Aug 05, 2005 at 08:08:08AM -0400, Anne Thomas Manes wrote:
> John,
>
> There's a difference between missing and null. If the element had a
> null value, then the element would be there, and it would say
> <requestCategoryCode nil="true"/>.
>
> If the schema says minOccurs="0", then this message is valid.
> It appears that Axis is not properly handling minOccurs="0".
>
> Anne
>
> On 8/5/05, John Baker <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am using a WSDL file supplied to be by a third party and I suspect it
> > doesn't quite reflect what their .NET server is returning in the SOAP
> > messages. I am getting this exception:
> >
> > java.io.IOException: Non nillable element 'requestCategoryCode' is null.
> > at
> > org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.
> > java:215)
> > at
> > org.apache.axis.encoding.SerializationContext.serializeActual(Seriali
> > zationContext.java:1426)
> > at
> > org.apache.axis.encoding.SerializationContext.serialize(Serialization
> > Context.java:914)
> > at
> > org.apache.axis.encoding.SerializationContext.serialize(Serialization
> > Context.java:702)
> > at
> > org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.
> > java:230)
> > at
> > org.apache.axis.encoding.SerializationContext.serializeActual(Seriali
> > zationContext.java:1426)
> > at
> > org.apache.axis.encoding.SerializationContext.serialize(Serialization
> > Context.java:914)
> >
> > So looking at (an extract of) the XML received by Axis:
> >
> > <AdministrationDetails><ComplaintTypeCode>PESTM</ComplaintTypeCode><Com
> > plaintTypeText>Mice</ComplaintTypeText><AllocatedToCode>CRMTES</AllocatedToCode>
> > <AllocatedToText>CRM Test
> > Officer</AllocatedToText><HowReceivedCode>CC</HowRecei
> > vedCode><HowReceivedText>Call
> > Centre</HowReceivedText><TimeReceived>2005-08-04T0
> > 6:52:03.0000000+01:00</TimeReceived><StatusCode>REC</StatusCode><StatusText>Rece
> > ived</StatusText><AreaTeamCode>E</AreaTeamCode><AreaTeamText>Eastern Area
> > Team</
> > AreaTeamText></AdministrationDetails>
> >
> > And here's the relevant part of the WSDL:
> >
> > <xs:complexType name="AdministrationDetailsType">
> > <xs:annotation>
> > <xs:documentation>Contains details of status,
> > allocated officer
> > codes etc</xs:documentation>
> > </xs:annotation>
> > <xs:sequence>
> > <xs:element name="ComplaintTypeCode"
> > type="uni:CNCODE_CodeValue">
> > <xs:annotation>
> > <xs:documentation>Code
> > value for complaint
> > type</xs:documentation>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="ComplaintTypeText"
> > type="uni:CNCODE_TextValue">
> > <xs:annotation>
> >
> > <xs:documentation>Full text of complaint type - read
> > only</xs:documentation>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="RequestCategoryCode"
> > type="uni:CNCODE_CodeValue">
> > <xs:annotation>
> >
> > <xs:documentation>complaint type category code if set
> > </xs:documentation>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="AllocatedToCode" type="uni:CNCODE_CodeValue">
> > <xs:annotation>
> > <xs:documentation>Officer code for
> > allocated officer</xs:documenta
> > tion>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="AllocatedToText"
> > type="uni:CNCODE_TextValue">
> > <xs:annotation>
> > <xs:documentation>Full name of allocated
> > officer</xs:documentation
> > >
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="TimeAllocated"
> > type="xs:dateTime" minOccurs="0">
> > <xs:annotation>
> > <xs:documentation>The date and time the request
> > was allocated to a
> > n officer to investigate</xs:documentation>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="HowReceivedCode"
> > type="uni:CNCODE_CodeValue">
> > <xs:annotation>
> > <xs:documentation>Code value indicating how the
> > complaint was rece
> > ived</xs:documentation>
> > </xs:annotation>
> > </xs:element>
> > <xs:element name="HowReceivedText"
> > type="uni:CNCODE_TextValue">
> > <xs:annotation>
> > <xs:documentation>Full description of how received
> > code</xs:docume
> > ntation>
> > </xs:annotation>
> > </xs:element>
> >
> > (etc.)
> >
> > It would seem to me that this change needs to be made:
> >
> > <xs:element name="RequestCategoryCode" type="uni:CNCODE_CodeValue"
> > minOccurs="0" nillable="true">
> >
> > As the .NET server has not sent back a RequestCategoryCode element.
> >
> > Does this sound correct?
> >
> > Thanks,
> >
> >
> > John
> >