You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by csj <jo...@clarkson.edu> on 2005/06/27 15:52:30 UTC

schema building


All -

I am very stuck on building a schema for the following xml message.  I
feel I'm very close as the message validates if I remove the
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
attribute from the doSpellingSuggestion element.  Any help/pointers for
describing the encodingStyle attribute in my schema would be great.

Any help on this would be great.

Thanks.

-------------- Message -------------------

<?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:doSpellingSuggestion
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns1="urn:GoogleSearch">
   <key xsi:type="xsd:string">XXXXXXXXXXXXXXXXXXXXXXXx</key>
   <phrase xsi:type="xsd:string">rabbbit</phrase>
  </ns1:doSpellingSuggestion>

 </soapenv:Body>
</soapenv:Envelope>

------------  Schema ---------------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   elementFormDefault="qualified"
   targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:ns1="urn:GoogleSearch"
   version="1.0">

<xs:import namespace="urn:GoogleSearch"
schemaLocation="GoogledoSpellingSuggestion.xsd" />

<xs:element name="Envelope">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="Body">
         <xs:complexType>
           <xs:sequence>
            <xs:element ref="ns1:doSpellingSuggestion"/>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
     </xs:sequence>
   </xs:complexType>
</xs:element>

</xs:schema>

---------------

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/encoding/"
            targetNamespace="urn:GoogleSearch"
            xmlns:ns1="urn:GoogleSearch"
            version="1.0">

  <xsd:element name="doSpellingSuggestion"
type="ns1:doSpellingSuggestion"/>

  <xsd:complexType name="doSpellingSuggestion">
   <xsd:sequence>
    <xsd:element name="key" type="xsd:string"/>
    <xsd:element name="phrase" type="xsd:string"/>
   </xsd:sequence>
  </xsd:complexType>

</xsd:schema>

Re: schema building

Posted by Scott Nichol <sn...@scottnichol.com>.
The envelope does not use SOAP encoding.  No Apache SOAP release can support that.  The nightly builds of Apache SOAP do support it if you call SOAPContext#setDocLitSerialization(true) for the SOAPContext instance that will be used by your Call instance.

The setDocLitSerialization is really a hack.  It is not real literal serialization.  You should use Apache Axis to get real literal serialzation.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "csj" <jo...@clarkson.edu>
To: "Scott Nichol" <sn...@scottnichol.com>
Sent: Monday, June 27, 2005 11:24 AM
Subject: Re: schema building


> Scott, Thanks for the reply
> 
> if I run xmllint on this message with the below schemas I get this..
> 
> Being new to xml soap message and schemas I dont know how to describe the
> soapenv:encodingStyle attribute in this message.
> 
> Thanks.
> 
> ]# xmllint --schema GoogleSoapEnvelope.xsd GoogleMessage.xml
> <?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:doSpellingSuggestion xmlns:ns1="urn:GoogleSearch"
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> 
>    <key xsi:type="xsd:string">QLgFC0VQFHJNq8RfD6sDbGCQD6710PlS</key>
>    <phrase xsi:type="xsd:string">rabbbit</phrase>
> 
>  </ns1:doSpellingSuggestion>
> 
>  </soapenv:Body>
> </soapenv:Envelope>
> GoogleMessage.xml:8: element doSpellingSuggestion: Schemas validity error
> : Element 'ns1:doSpellingSuggestion': The attribute
> 'soapenv:encodingStyle' is not allowed.
> GoogleMessage.xml fails to validate
> ]#
> 
> 
> On Mon, 27 Jun 2005, Scott Nichol wrote:
> 
> > What is the message you get when it does not validate?
> >
> > Scott Nichol
> >
> > Do not send e-mail directly to this e-mail address,
> > because it is filtered to accept only mail from
> > specific mail lists.
> > ----- Original Message -----
> > From: "csj" <jo...@clarkson.edu>
> > To: <so...@ws.apache.org>
> > Sent: Monday, June 27, 2005 9:52 AM
> > Subject: schema building
> >
> >
> > >
> > >
> > > All -
> > >
> > > I am very stuck on building a schema for the following xml message.  I
> > > feel I'm very close as the message validates if I remove the
> > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > > attribute from the doSpellingSuggestion element.  Any help/pointers for
> > > describing the encodingStyle attribute in my schema would be great.
> > >
> > > Any help on this would be great.
> > >
> > > Thanks.
> > >
> > > -------------- Message -------------------
> > >
> > > <?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:doSpellingSuggestion
> > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > >       xmlns:ns1="urn:GoogleSearch">
> > >    <key xsi:type="xsd:string">XXXXXXXXXXXXXXXXXXXXXXXx</key>
> > >    <phrase xsi:type="xsd:string">rabbbit</phrase>
> > >   </ns1:doSpellingSuggestion>
> > >
> > >  </soapenv:Body>
> > > </soapenv:Envelope>
> > >
> > > ------------  Schema ---------------
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xs:schema
> > >    xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > >    elementFormDefault="qualified"
> > >    targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
> > >    xmlns:ns1="urn:GoogleSearch"
> > >    version="1.0">
> > >
> > > <xs:import namespace="urn:GoogleSearch"
> > > schemaLocation="GoogledoSpellingSuggestion.xsd" />
> > >
> > > <xs:element name="Envelope">
> > >    <xs:complexType>
> > >      <xs:sequence>
> > >        <xs:element name="Body">
> > >          <xs:complexType>
> > >            <xs:sequence>
> > >             <xs:element ref="ns1:doSpellingSuggestion"/>
> > >            </xs:sequence>
> > >          </xs:complexType>
> > >        </xs:element>
> > >      </xs:sequence>
> > >    </xs:complexType>
> > > </xs:element>
> > >
> > > </xs:schema>
> > >
> > > ---------------
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >             xmlns:soapenv="http://schemas.xmlsoap.org/soap/encoding/"
> > >             targetNamespace="urn:GoogleSearch"
> > >             xmlns:ns1="urn:GoogleSearch"
> > >             version="1.0">
> > >
> > >   <xsd:element name="doSpellingSuggestion"
> > > type="ns1:doSpellingSuggestion"/>
> > >
> > >   <xsd:complexType name="doSpellingSuggestion">
> > >    <xsd:sequence>
> > >     <xsd:element name="key" type="xsd:string"/>
> > >     <xsd:element name="phrase" type="xsd:string"/>
> > >    </xsd:sequence>
> > >   </xsd:complexType>
> > >
> > > </xsd:schema>
> > >
> >
> 
> --
> Chris Johnson
> johnsocs@clarkson.edu
> 

Re: schema building

Posted by Scott Nichol <sn...@scottnichol.com>.
What is the message you get when it does not validate?

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "csj" <jo...@clarkson.edu>
To: <so...@ws.apache.org>
Sent: Monday, June 27, 2005 9:52 AM
Subject: schema building


> 
> 
> All -
> 
> I am very stuck on building a schema for the following xml message.  I
> feel I'm very close as the message validates if I remove the
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> attribute from the doSpellingSuggestion element.  Any help/pointers for
> describing the encodingStyle attribute in my schema would be great.
> 
> Any help on this would be great.
> 
> Thanks.
> 
> -------------- Message -------------------
> 
> <?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:doSpellingSuggestion
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>       xmlns:ns1="urn:GoogleSearch">
>    <key xsi:type="xsd:string">XXXXXXXXXXXXXXXXXXXXXXXx</key>
>    <phrase xsi:type="xsd:string">rabbbit</phrase>
>   </ns1:doSpellingSuggestion>
> 
>  </soapenv:Body>
> </soapenv:Envelope>
> 
> ------------  Schema ---------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>    elementFormDefault="qualified"
>    targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
>    xmlns:ns1="urn:GoogleSearch"
>    version="1.0">
> 
> <xs:import namespace="urn:GoogleSearch"
> schemaLocation="GoogledoSpellingSuggestion.xsd" />
> 
> <xs:element name="Envelope">
>    <xs:complexType>
>      <xs:sequence>
>        <xs:element name="Body">
>          <xs:complexType>
>            <xs:sequence>
>             <xs:element ref="ns1:doSpellingSuggestion"/>
>            </xs:sequence>
>          </xs:complexType>
>        </xs:element>
>      </xs:sequence>
>    </xs:complexType>
> </xs:element>
> 
> </xs:schema>
> 
> ---------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns:soapenv="http://schemas.xmlsoap.org/soap/encoding/"
>             targetNamespace="urn:GoogleSearch"
>             xmlns:ns1="urn:GoogleSearch"
>             version="1.0">
> 
>   <xsd:element name="doSpellingSuggestion"
> type="ns1:doSpellingSuggestion"/>
> 
>   <xsd:complexType name="doSpellingSuggestion">
>    <xsd:sequence>
>     <xsd:element name="key" type="xsd:string"/>
>     <xsd:element name="phrase" type="xsd:string"/>
>    </xsd:sequence>
>   </xsd:complexType>
> 
> </xsd:schema>
> 

Re: schema building

Posted by Anne Thomas Manes <at...@gmail.com>.
Add this line to your complexType definition after the </sequence>:
<xs:anyAttribute namespace="##other" processContents="lax"/>

Anne

On 6/27/05, csj <jo...@clarkson.edu> wrote:
> 
> 
> All -
> 
> I am very stuck on building a schema for the following xml message.  I
> feel I'm very close as the message validates if I remove the
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> attribute from the doSpellingSuggestion element.  Any help/pointers for
> describing the encodingStyle attribute in my schema would be great.
> 
> Any help on this would be great.
> 
> Thanks.
> 
> -------------- Message -------------------
> 
> <?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:doSpellingSuggestion
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>       xmlns:ns1="urn:GoogleSearch">
>    <key xsi:type="xsd:string">XXXXXXXXXXXXXXXXXXXXXXXx</key>
>    <phrase xsi:type="xsd:string">rabbbit</phrase>
>   </ns1:doSpellingSuggestion>
> 
>  </soapenv:Body>
> </soapenv:Envelope>
> 
> ------------  Schema ---------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>    elementFormDefault="qualified"
>    targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
>    xmlns:ns1="urn:GoogleSearch"
>    version="1.0">
> 
> <xs:import namespace="urn:GoogleSearch"
> schemaLocation="GoogledoSpellingSuggestion.xsd" />
> 
> <xs:element name="Envelope">
>    <xs:complexType>
>      <xs:sequence>
>        <xs:element name="Body">
>          <xs:complexType>
>            <xs:sequence>
>             <xs:element ref="ns1:doSpellingSuggestion"/>
>            </xs:sequence>
>          </xs:complexType>
>        </xs:element>
>      </xs:sequence>
>    </xs:complexType>
> </xs:element>
> 
> </xs:schema>
> 
> ---------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns:soapenv="http://schemas.xmlsoap.org/soap/encoding/"
>             targetNamespace="urn:GoogleSearch"
>             xmlns:ns1="urn:GoogleSearch"
>             version="1.0">
> 
>   <xsd:element name="doSpellingSuggestion"
> type="ns1:doSpellingSuggestion"/>
> 
>   <xsd:complexType name="doSpellingSuggestion">
>    <xsd:sequence>
>     <xsd:element name="key" type="xsd:string"/>
>     <xsd:element name="phrase" type="xsd:string"/>
>    </xsd:sequence>
>   </xsd:complexType>
> 
> </xsd:schema>
>