xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radu Preotiuc-Pietro" <ra...@bea.com>
Subject RE: XmlBeans, WSDL, SOAP arrays, ...
Date Sat, 20 Mar 2004 00:53:51 GMT
I see, one thing that would really help here is the <xsd:any> accessors, of which there
has been some discussion about a month ago.
But what you really want I think could be achieved using a custom SchemaCodePrinter, which
is a V2 feature that just got added. Basically, all information about the array and the type
of the elements in the array is there, it's just that you'd like the generated type to be
different (include the nice array accessors), which is the purpose of the SchemaCodePrinter.
No hack required. Can be enabled/disabled from the command line.
This would be something interesting to pursue; if you are interested... (the SchemaCodePrinter
is fairly isolated, so there's no opportunity to break sthing)

Radu

-----Original Message-----
From: Aleksander Slominski [mailto:aslom@cs.indiana.edu]
Sent: Friday, March 19, 2004 3:02 PM
To: xmlbeans-dev@xml.apache.org
Subject: Re: XmlBeans, WSDL, SOAP arrays, ...


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/


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