xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: XmlBeans, WSDL, SOAP arrays, ...
Date Fri, 19 Mar 2004 23:01:59 GMT
Radu Preotiuc-Pietro wrote:

>hi alek,
>have you tried compiling GoogleSearch.wsdl _and_ the soap encoding schema file at the
same time?
>  
>
great idea however without special understanding of SOAPENC:Array i do 
not think that it is possible to get what needed ...

>XMLBeans does not include the soap-encoding Schema "natively" but does include support
for the "wsdl:arrayType" attribute.
>  
>
so here is what i got when scomp soap11.schemas.xmlsoap.org.xsd 
GoogleSearch.wsdl:

public interface GoogleSearchResult extends org.apache.xmlbeans.XmlObject
{
...
    /**
     * Gets the "resultElements" element
     */
    googleSearch.ResultElementArray getResultElements();
...
}

unfortunately ResultElementArray  is not what i wanted - it extends 
SOAPENC:Array but has no accessors to work with arrays elements (as i 
think SOAPENC:Array extends xsd:any so XmlBeans has no idea that should 
it treat as special kind of typed sequence ...)

public interface ResultElementArray extends 
org.xmlsoap.schemas.soap.encoding.Array
{
    public static final org.apache.xmlbeans.SchemaType type = 
(org.apache.xmlbeans.SchemaType)schema.system.sB766CB25D77C35DF7025FF42008F4903.TypeSystemHolder.typeSystem.resolveHandle("resultelementarray8fa7type");
   
    public static final class Factory
    {
        ...
    }
}

if i do modification to GoogleSearch schema (see below for details) to 
make array into sequence then the generated code for ResultElementArray 
is exactly what i need :

public interface ResultElementArray extends org.apache.xmlbeans.XmlObject
{
....  
    /**
     * Gets array of all "item" elements
     */
    java.lang.String[] getItemArray();
   
    /**
     * Gets ith "item" element
     */
    java.lang.String getItemArray(int i);
   
    /**
     * Gets (as xml) array of all "item" elements
     */
    org.apache.xmlbeans.XmlString[] xgetItemArray();
   
    /**
     * Gets (as xml) ith "item" element
     */
    org.apache.xmlbeans.XmlString xgetItemArray(int i);
   
    /**
     * Returns number of "item" element
     */
    int sizeOfItemArray();
// ... other nice accessors ...
}  

>There is no way in Schema to type an element without giving it a name, AFAIK.
>  
>
:(

so i wonder if this could be hacked to add support for those still 
existing clients that uses old SOAP 1.1 array encoding? or how much work 
would it take?

thanks,

alek

ps. below is modified GoogleSearch schema to use sequences instead of 
arrays that compiles fine:

<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:typens="urn:GoogleSearch"
             targetNamespace="urn:GoogleSearch">

      <xsd:complexType name="GoogleSearchResult">
        <xsd:all>
          <xsd:element name="documentFiltering"           
type="xsd:boolean"/>
          <xsd:element name="searchComments"              
type="xsd:string"/>
          <xsd:element name="estimatedTotalResultsCount"  type="xsd:int"/>
          <xsd:element name="estimateIsExact"             
type="xsd:boolean"/>
          <xsd:element name="resultElements"              
type="typens:ResultElementArray"/>
          <xsd:element name="searchQuery"                 
type="xsd:string"/>
          <xsd:element name="startIndex"                  type="xsd:int"/>
          <xsd:element name="endIndex"                    type="xsd:int"/>
          <xsd:element name="searchTips"                  
type="xsd:string"/>
          <xsd:element name="directoryCategories"         
type="typens:DirectoryCategoryArray"/>
          <xsd:element name="searchTime"                  
type="xsd:double"/>
        </xsd:all>
      </xsd:complexType>

      <xsd:complexType name="ResultElement">
        <xsd:all>
          <xsd:element name="summary" type="xsd:string"/>
          <xsd:element name="URL" type="xsd:string"/>
          <xsd:element name="snippet" type="xsd:string"/>
          <xsd:element name="title" type="xsd:string"/>
          <xsd:element name="cachedSize" type="xsd:string"/>
          <xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
          <xsd:element name="hostName" type="xsd:string"/>
          <xsd:element name="directoryCategory" 
type="typens:DirectoryCategory"/>
          <xsd:element name="directoryTitle" type="xsd:string"/>
        </xsd:all>
      </xsd:complexType>
 
      <xsd:complexType name="ResultElementArray">
        <xsd:sequence>
          <!--xsd:element name="item" type="xsd:string" minOccurs='0' 
maxOccurs='unbounded' /-->
          <!--xsd:any type="xsd:string" minOccurs='0' 
maxOccurs='unbounded' /-->
          <xsd:element name="item" type="xsd:string" minOccurs='0' 
maxOccurs='unbounded' />
        </xsd:sequence>
      </xsd:complexType>

      <xsd:complexType name="DirectoryCategoryArray">
        <xsd:sequence>
          <xsd:element name="item" type="typens:DirectoryCategory" 
minOccurs='0' maxOccurs='unbounded' />
        </xsd:sequence>
      </xsd:complexType>

      <xsd:complexType name="DirectoryCategory">
        <xsd:all>
          <xsd:element name="fullViewableName" type="xsd:string"/>
          <xsd:element name="specialEncoding" type="xsd:string"/>
        </xsd:all>
      </xsd:complexType>

</xsd:schema>

-- 
The best way to predict the future is to invent it - Alan Kay


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message