You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Cheng Po-wen <st...@itri.org.tw> on 2003/09/09 03:55:08 UTC

Schema checking problem about xsi:nil="true" & minOccurs="0"

Hi, all:

I tried check the validation of request sent to Amazon,
the following is the request that Axis client sent to Amazon:
(I've turned off the multiref and send_xsi, and
  added  xsi:type="ns1:KeywordRequest" to KeywordSearchRequest element)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

 <soapenv:Body>
  <ns1:KeywordSearchRequest
       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

       xmlns:ns1="http://soap.amazon.com">
   <KeywordSearchRequest xsi:type="ns1:KeywordRequest">
    <keyword>dog</keyword>
    <page>1</page>
    <mode>book</mode>
    <tag>webservices-30</tag>
    <type>lite</type>
    <devtag>your-dev-tag</devtag>
    <sort xsi:nil="true"/>
    <locale xsi:nil="true"/>
    <price xsi:nil="true"/>
   </KeywordSearchRequest>
  </ns1:KeywordSearchRequest>
 </soapenv:Body>
</soapenv:Envelope>


and the following is the schema for KeywordRequest:

<xsd:complexType name="KeywordRequest">
  <xsd:all>
    <xsd:element name="keyword" type="xsd:string"/>
    <xsd:element name="page" type="xsd:string"/>
    <xsd:element name="mode" type="xsd:string"/>
    <xsd:element name="tag" type="xsd:string"/>
    <xsd:element name="type" type="xsd:string"/>
    <xsd:element name="devtag" type="xsd:string"/>
    <xsd:element name="sort" type="xsd:string" minOccurs="0"/>
    <xsd:element name="locale" type="xsd:string" minOccurs="0"/>
    <xsd:element name="price" type="xsd:string" minOccurs="0"/>
  </xsd:all>
</xsd:complexType>

I use Xerces 2.5 and its XNI(Grammer pool or something...) to check the
validation,
and it tells me the following error message:

[Error] KeywordSearchRequestSample_gen_no_multiRef.xml:16:27:
cvc-elt.3.1: Attribute
 'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on
element
'sort', because the {nillable} property of 'sort' is false.


Does anyone know how to solve this problem?

THANX

Sting

Re: Schema checking problem about xsi:nil="true" & minOccurs="0"

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
I believe that Axis is generating an incorrect soap message.  A bug report
should be submitted if none exists for this problem already.

The elements sort, locale and price are not explicitly nillable in the
schema.  They should be omitted from the message (as minOccurs="0" allows)
in order to indicate no value.  They are allowed to have the empty string as
a value, so the xsi:nil attribute should not be present.

Jeff
----- Original Message ----- 
From: "Cheng Po-wen" <st...@itri.org.tw>
To: <ax...@ws.apache.org>
Cc: "·¨²Qªâ" <Gl...@itri.org.tw>; "§õ¨ô«T" <Ch...@itri.org.tw>
Sent: Monday, September 08, 2003 6:55 PM
Subject: Schema checking problem about xsi:nil="true" & minOccurs="0"


> Hi, all:
>
> I tried check the validation of request sent to Amazon,
> the following is the request that Axis client sent to Amazon:
> (I've turned off the multiref and send_xsi, and
>   added  xsi:type="ns1:KeywordRequest" to KeywordSearchRequest element)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
>  <soapenv:Body>
>   <ns1:KeywordSearchRequest
>        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>
>        xmlns:ns1="http://soap.amazon.com">
>    <KeywordSearchRequest xsi:type="ns1:KeywordRequest">
>     <keyword>dog</keyword>
>     <page>1</page>
>     <mode>book</mode>
>     <tag>webservices-30</tag>
>     <type>lite</type>
>     <devtag>your-dev-tag</devtag>
>     <sort xsi:nil="true"/>
>     <locale xsi:nil="true"/>
>     <price xsi:nil="true"/>
>    </KeywordSearchRequest>
>   </ns1:KeywordSearchRequest>
>  </soapenv:Body>
> </soapenv:Envelope>
>
>
> and the following is the schema for KeywordRequest:
>
> <xsd:complexType name="KeywordRequest">
>   <xsd:all>
>     <xsd:element name="keyword" type="xsd:string"/>
>     <xsd:element name="page" type="xsd:string"/>
>     <xsd:element name="mode" type="xsd:string"/>
>     <xsd:element name="tag" type="xsd:string"/>
>     <xsd:element name="type" type="xsd:string"/>
>     <xsd:element name="devtag" type="xsd:string"/>
>     <xsd:element name="sort" type="xsd:string" minOccurs="0"/>
>     <xsd:element name="locale" type="xsd:string" minOccurs="0"/>
>     <xsd:element name="price" type="xsd:string" minOccurs="0"/>
>   </xsd:all>
> </xsd:complexType>
>
> I use Xerces 2.5 and its XNI(Grammer pool or something...) to check the
> validation,
> and it tells me the following error message:
>
> [Error] KeywordSearchRequestSample_gen_no_multiRef.xml:16:27:
> cvc-elt.3.1: Attribute
>  'http://www.w3.org/2001/XMLSchema-instance,nil' must not appear on
> element
> 'sort', because the {nillable} property of 'sort' is false.
>
>
> Does anyone know how to solve this problem?
>
> THANX
>
> Sting
>