axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sosnoski <...@sosnoski.com>
Subject Re: minOccurs and nillable
Date Sun, 14 Aug 2005 22:13:58 GMT
The XML instance document you supplied doesn't match the WSDL schema, so 
Axis is correct in rejecting it. You should just have minOccurs="0" 
added to the schema for the element. There's no reason to add 
nillable="true", since just leaving the element out is the cleaner approach.

How did the third party generate their schema? It's very sloppy that 
they built this incorrectly, since the schema is supposed to be the 
contract for the XML representation.

  - Dennis

Dennis M. Sosnoski
Enterprise Java, XML, and Web Services
Training and Consulting
http://www.sosnoski.com
Redmond, WA  425.885.7197



John Baker 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
>
>  
>

Mime
View raw message